-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.gradle
More file actions
140 lines (120 loc) · 4.68 KB
/
Copy pathbuild.gradle
File metadata and controls
140 lines (120 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.rodnansol:spring-configuration-property-documenter-gradle-plugin:${springConfigPropertyDocumenterPluginVersion}"
}
}
plugins {
id "org.springframework.boot" version "${springBootVersion}" apply false
id "io.spring.dependency-management" version "${springDependencyManagementPluginVersion}" apply false
id "com.diffplug.spotless" version "${spotlessVersion}" apply false
id "com.google.protobuf" version "${protobufPluginVersion}" apply false
id "org.graalvm.buildtools.native" version "${graalvmBuildToolsVersion}" apply false
id "net.ltgt.errorprone" version "${errorPronePluginVersion}" apply false
id "io.github.danielliu1123.deployer" version "${deployerVersion}"
}
deploy {
dirs = subprojects.stream()
.map(e -> e.layout.buildDirectory.dir("repo").get().getAsFile())
.filter(e -> e.exists())
.toList()
username = System.getenv("MAVENCENTRAL_USERNAME")
password = System.getenv("MAVENCENTRAL_PASSWORD")
publishingType = io.github.danielliu1123.deployer.PublishingType.WAIT_FOR_PUBLISHED
}
//allprojects { // uncomment this if you want to get IDE support, only for debugging purpose!
subprojects {
if (it.name == "grpc-starter-dependencies") {
// skip the bom project
return
}
apply plugin: "java"
apply plugin: "java-library"
java {
sourceCompatibility = 17
targetCompatibility = 17
}
javadoc {
// Suppress warnings about missing Javadoc comments
options.addStringOption('Xdoclint:none', '-quiet')
}
configurations {
optional
compileOnly.extendsFrom optional
}
repositories {
mavenLocal()
mavenCentral()
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs += ["-parameters"]
// https://github.com/uber/NullAway/wiki/JSpecify-Support#supported-jdk-versions
options.compilerArgs += ["-XDaddTypeAnnotationsToSymbol=true"]
options.encoding = "UTF-8"
}
test {
systemProperties("spring.cloud.compatibility-verifier.enabled": "false")
useJUnitPlatform()
jvmArgs("-XX:+EnableDynamicAgentLoading")
}
afterEvaluate {
tasks.findByName("bootRun")?.configure {
systemProperty("spring.cloud.compatibility-verifier.enabled", "false")
}
}
// dependency management
apply plugin: "io.spring.dependency-management"
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
mavenBom "com.google.protobuf:protobuf-bom:${protobufVersion}"
mavenBom "io.grpc:grpc-bom:${grpcVersion}"
}
}
dependencies {
compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
testCompileOnly("org.projectlombok:lombok")
testAnnotationProcessor("org.projectlombok:lombok")
// https://docs.gradle.org/current/userguide/upgrading_version_8.html#test_framework_implementation_dependencies
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
// spotless
apply plugin: "com.diffplug.spotless"
spotless {
encoding "UTF-8"
java {
toggleOffOn()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
palantirJavaFormat()
importOrder()
formatAnnotations()
targetExclude "**/generated/**"
custom("Refuse wildcard imports", {
if (it =~ /\nimport .*\*;/) {
throw new IllegalStateException("Do not use wildcard imports, 'spotlessApply' cannot resolve this issue, please fix it manually.")
}
} as Closure<String>)
}
}
apply plugin: "net.ltgt.errorprone"
dependencies {
errorprone "com.google.errorprone:error_prone_core:${errorProneCoreVersion}"
errorprone "com.uber.nullaway:nullaway:${nullAwayVersion}"
}
tasks.withType(JavaCompile).configureEach {
options.errorprone {
// https://github.com/tbroyer/gradle-errorprone-plugin?tab=readme-ov-file#properties
excludedPaths = ".*/(generated|examples)/.*"
// https://github.com/uber/NullAway/wiki/Configuration
check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR)
option("NullAway:AnnotatedPackages", "grpcstarter")
option("NullAway:HandleTestAssertionLibraries", "true")
}
}
}
apply from: "${rootDir}/gradle/generate-configuration-properties-docs.gradle"