Skip to content

Commit c2ea476

Browse files
author
Alexander Furer
committed
format and compile delomboked sources
1 parent 4afb86b commit c2ea476

File tree

4 files changed

+49
-15
lines changed

4 files changed

+49
-15
lines changed

grpc-spring-boot-starter-demo/build.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,20 @@ dependencies {
7070
testCompile('org.springframework.cloud:spring-cloud-starter-consul-discovery')
7171
testCompile 'com.pszymczyk.consul:embedded-consul:2.1.4'
7272
testCompile 'org.awaitility:awaitility:4.0.3'
73-
74-
7573
testCompile "org.springframework.cloud:spring-cloud-config-server"
7674
testCompile "org.springframework.cloud:spring-cloud-config-client"
77-
testCompile "com.playtika.testcontainers:embedded-keycloak:2.0.6"
7875
testCompile "org.springframework.cloud:spring-cloud-starter-bootstrap"
7976

77+
testCompile "com.playtika.testcontainers:embedded-keycloak:2.0.8"
78+
constraints {
79+
testCompile('org.testcontainers:testcontainers:1.15.3'){
80+
because 'embedded-keycloak or testcontainers should be upgraded when https://github.com/testcontainers/testcontainers-java/issues/4125 fixed.'
81+
}
82+
83+
}
8084

81-
testImplementation 'org.hamcrest:hamcrest:2.1'
8285

86+
testImplementation 'org.hamcrest:hamcrest:2.1'
8387
testImplementation 'org.mockito:mockito-core:2.23.0'
8488

8589
customSecurityTestCompile sourceSets.test.output

grpc-spring-boot-starter-demo/src/test/java/org/lognet/springboot/grpc/auth/JwtAuthBaseTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected ByteBuffer generateToken() {
7979
return ByteBuffer.wrap(new ObjectMapper().readTree(response.getBody())
8080
.at("/access_token")
8181
.asText().getBytes());
82-
} catch (JsonProcessingException e) {
82+
} catch ( Exception e) {
8383
throw new RuntimeException(e);
8484
}
8585
}

grpc-spring-boot-starter/build.gradle

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ buildscript {
1010
}
1111
plugins {
1212
id "de.undercouch.download" version "4.1.1"
13+
id "com.github.sherter.google-java-format" version "0.9"
14+
1315
}
1416
apply plugin: 'java'
1517
apply plugin: 'org.springframework.boot'
@@ -47,24 +49,39 @@ task generateReleaseNotes(type: JavaExec, group: "documentation") {
4749
}
4850
}
4951
}
50-
52+
def delombokOutputDir = file("$buildDir/delombok")
5153
task delombok(type: io.franzbecker.gradle.lombok.task.DelombokTask) {
52-
def outputDir = file("$buildDir/delombok")
53-
outputs.dir(outputDir)
54+
55+
outputs.dir(delombokOutputDir)
5456
for (srcDir in project.sourceSets.main.java.srcDirs) {
5557
inputs.dir(srcDir)
56-
args(srcDir, "-d", outputDir)
58+
args(srcDir, "-d", delombokOutputDir)
5759
}
5860
doFirst {
59-
outputDir.deleteDir()
61+
delombokOutputDir.deleteDir()
6062
}
6163
}
6264

65+
googleJavaFormat {
66+
toolVersion = '1.9'
67+
source = delombokOutputDir
68+
include '**/*.java'
69+
}
70+
tasks.verifyGoogleJavaFormat {
71+
enabled false
72+
}
73+
tasks.googleJavaFormat {
74+
dependsOn tasks.delombok
75+
}
6376
task sourceJar(type: Jar) {
77+
dependsOn(tasks.googleJavaFormat)
6478
classifier "sources"
65-
from delombok
79+
from delombokOutputDir
80+
}
81+
javadoc {
82+
dependsOn tasks.googleJavaFormat
83+
source = delombokOutputDir
6684
}
67-
6885
task javadocJar(type: Jar, dependsOn: javadoc) {
6986
classifier "javadoc"
7087
from javadoc.destinationDir
@@ -168,6 +185,19 @@ dependencies {
168185

169186

170187
}
171-
compileJava.dependsOn(processResources)
188+
if(null!=System.getenv("CI")) {
189+
compileJava {
190+
dependsOn(processResources, tasks.googleJavaFormat)
191+
source googleJavaFormat.source
192+
include { FileTreeElement e ->
193+
def included = true
194+
if (e.name.toLowerCase().endsWith("java")) {
195+
included = e.file.absolutePath.startsWith(delombokOutputDir.absolutePath)
196+
}
197+
198+
return included
199+
}
200+
}
201+
}
172202

173203

grpc-spring-boot-starter/src/main/java/org/lognet/springboot/grpc/autoconfigure/GRpcServerProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public static class NettyServerProperties {
113113
/**
114114
* grpc listen address. <P>If configured, takes precedence over {@code grpc.port} property value.</p>
115115
* Supported format:
116-
* <li>{@code host:port} (if port is less than 1, uses random value)
117-
* <li>{@code host:} (uses default grpc port, 6565 )
116+
* <ul><li>{@code host:port} (if port is less than 1, uses random value)
117+
* <li>{@code host:} (uses default grpc port, 6565 )</ul>
118118
*/
119119
private InetSocketAddress primaryListenAddress;
120120

0 commit comments

Comments
 (0)