-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathbuild.gradle
294 lines (274 loc) · 12.9 KB
/
build.gradle
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
buildscript {
ext {
junit5Version = '5.10.1' // https://junit.org/junit5/
junit5PlatformVersion = '1.10.1'
// For some reason IntelliJ doesn't like these new versions I have commented out. TODO look at this
// junit5Version = '5.11.3' // https://junit.org/junit5/
// junit5PlatformVersion = '1.11.3'
slf4jVersion = '2.0.16' // http://www.slf4j.org/download.html
log4jVersion = '2.24.2' // https://logging.apache.org/log4j/2.x/release-notes.html
// Note: Since Jackson 2.14, Android SDK 26 is required
// https://github.com/FasterXML/jackson/wiki/Jackson-Releases
jacksonVersion = '2.18.2' // https://github.com/FasterXML/jackson-databind/tags
retrofitVersion = "2.11.0" // https://github.com/square/retrofit/tags
shadowVersion = '8.1.1' // https://github.com/johnrengelman/shadow/releases
ioLibVersion = '2.3.0' // https://github.com/retrodaredevil/io-lib/releases
okhttpVersion = "4.12.0" // https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
couchdbJavaVersion = '1.1.2'
// couchdbJavaVersion = "8582268195".substring(0, 10)
dockerComposePluginVersion = "0.17.11" // https://github.com/avast/gradle-docker-compose-plugin/releases
errorpronePluginVersion = '4.1.0' // https://github.com/tbroyer/gradle-errorprone-plugin/releases
errorproneCoreVersion = '2.36.0' // https://mvnrepository.com/artifact/com.google.errorprone/error_prone_core
antlrVersion = "4.13.2" // https://github.com/antlr/antlr4/releases
}
}
plugins {
id 'com.diffplug.spotless' version '6.22.0' // https://mvnrepository.com/artifact/com.diffplug.spotless/spotless-plugin-gradle
id 'net.ltgt.errorprone' version "$errorpronePluginVersion"
id "com.avast.gradle.docker-compose" version "$dockerComposePluginVersion"
}
version "0.0.1-SNAPSHOT"
description = """SolarThing"""
group = "me.retrodaredevil.solarthing"
spotless {
// More info on ratchet https://github.com/diffplug/spotless/tree/master/plugin-gradle#ratchet
// ratchetFrom 'origin/master'
// https://github.com/diffplug/spotless/tree/master/plugin-gradle#eclipse-jdt if you have eclipse xml
enforceCheck = false // doesn't have to be formatted correctly for ./gradlew build to work
format 'javaBasic', com.diffplug.gradle.spotless.JavaExtension, {
target fileTree('.') {
include '**/*.java'
exclude '**/build/**', '**/build-*/**'
}
toggleOffOn()
removeUnusedImports()
endWithNewline()
trimTrailingWhitespace()
}
format 'javaIndent', com.diffplug.gradle.spotless.JavaExtension, {
target fileTree('.') {
include '**/*.java'
exclude '**/build/**', '**/build-*/**'
}
toggleOffOn()
indentWithTabs()
toggleOffOn("/*", "*/") // It doesn't like tabs then a space, which are present in Javadocs, so just disable
}
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
}
// https://docs.gradle.org/current/userguide/working_with_files.html#sec:reproducible_archives
tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'net.ltgt.errorprone'
repositories {
maven { url "https://jitpack.io" }
maven { url "https://repo.maven.apache.org/maven2" }
}
dependencies {
// https://mvnrepository.com/artifact/com.google.errorprone/error_prone_core
errorprone "com.google.errorprone:error_prone_core:$errorproneCoreVersion"
errorprone "com.google.errorprone:error_prone_annotations:$errorproneCoreVersion"
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junit5Version
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit5Version"
testImplementation "org.junit.platform:junit-platform-commons:$junit5PlatformVersion"
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: junit5Version
testImplementation 'com.tngtech.archunit:archunit:1.0.1' // https://github.com/TNG/ArchUnit/releases
// https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
implementation 'org.jetbrains:annotations:24.0.1' // https://search.maven.org/search?q=g:org.jetbrains%20AND%20a:annotations
}
test {
useJUnitPlatform()
}
tasks.withType(JavaCompile).configureEach {
options.errorprone {
// disableWarningsInGeneratedCode = true // doesn't seem to work
disable("MissingSummary") // Our JavaDocs don't need to be perfect
disable("StringSplitter") // Yes String.split(String) has surprising behavior, but we know how to be careful.
disable("EqualsGetClass") // Most of the time we prefer that equality checks don't evaluate to true for subclasses
disable("NullableOnContainingClass") // This is dumb, who would do it this way? A.B reads as a fully qualified name to me...
disable("InvalidLink") // So many times this is wrong. #equals(Object) is a valid link!
disable("ComparableType") // different Identifiers need to be able to be compared to each other, so we disable this for now.
disable("DoNotClaimAnnotations") // TODO figure how how to make our annotation processor more "correct"
// disable("ReturnValueIgnored") // remove this once this is fixed: https://github.com/google/error-prone/issues/3292 // TODO can we enable this now?
disable("UnusedMethod") // This is useful, but has this issue: https://github.com/google/error-prone/issues/3144 // issue is now "completed", but annotations not customizable for
disable("InlineMeSuggester") // Wrong when annotated by annotations, and I don't need this feature
disable("EmptyCatch") // This is a great warning, but IntelliJ wants ignored exceptions to be named "ignored" and ErrorProne wants "ok"...
disable("FutureReturnValueIgnored") // For "send and forget" stuff, this is really annoying
disable("UnusedVariable") // We are OK with this most of the time
disable("CanonicalDuration") // I will specify my durations in whatever units I please
error("MissingOverride")
// Experimental Errors
enable("ClassName")
warn("DepAnn")
warn("EmptyIf")
warn("InsecureCryptoUsage")
// Experimental Warnings
warn("AnnotationPosition")
warn("ConstantPatternCompile")
warn("DifferentNameButSame")
error("EqualsBrokenForNull")
warn("InconsistentOverloads")
warn("InitializeInline")
warn("InterfaceWithOnlyStatics")
warn("InterruptedExceptionSwallowed")
warn("Interruption")
// warn("MemberName") // useful, but stuff like _myVariable does not work, and that can be useful *sometimes*
warn("NonCanonicalStaticMemberImport")
// warn("PreferJavaTimeOverload") // SolarThing uses a lot of dateMillis, and many times it does not make sense to use java.time
warn("RedundantOverride")
warn("RedundantThrows")
// warn("ThrowSpecificExceptions") // TODO Something we need to work on in the SolarThing codebase
warn("TransientMisuse")
warn("TryWithResourcesVariable")
warn("UnnecessarilyFullyQualified")
warn("UnnecessaryAnonymousClass") // suggest
warn("UnusedException")
// Experimental Suggestions
warn("ConstantField")
// warn("FieldCanBeFinal") // Useful on everything but :client module, because of the usages of @JsonProperty on mutable fields.
warn("FieldCanBeLocal")
warn("FieldCanBeStatic")
// warn("FieldMissingNullable") // There are many private fields where this is easy enough to tell
warn("ForEachIterable")
warn("LambdaFunctionalInterface")
// warn("MethodCanBeStatic") // TODO Very, very useful, but I don't need this warning in tests
// error("MissingBraces") // I would love to enforce this in all places except equals(), so disable for now
error("MixedArrayDimensions")
// error("MultiVariableDeclaration") // While frowned upon many times, we use this a lot and it is helpful somtimes
error("MultipleTopLevelClasses")
error("PackageLocation")
// warn("ParameterMissingNullable") // This is useful. Maybe uncomment if we become more religious about use of @Nullable
error("PrivateConstructorForUtilityClass") // not completely ideal for spring classes with static initialization
warn("RemoveUnusedImports") // Only a warning because https://github.com/antlr/antlr4/issues/2568 and https://github.com/google/error-prone/issues/463
// warn("ReturnMissingNullable") // Useful onlyl if we become more religious about use of @Nullable
warn("ReturnsNullCollection")
warn("SwitchDefault")
error("SymbolToString")
warn("ThrowsUncheckedException") // we should be unchecked exceptions in JavaDoc instead
warn("TryFailRefactoring")
error("TypeToString")
// warn("UngroupedOverloads") //
warn("UnnecessaryBoxedAssignment")
warn("UnnecessaryBoxedVariable")
error("UnnecessaryStaticImport")
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile){
options.compilerArgs << "-Xlint:deprecation"
}
}
publishing {
publications {
mavenJava(MavenPublication) {
// thanks https://stackoverflow.com/a/68515859/5434860
groupId = "${group}"
artifactId = "${project.name}"
version = "${version}"
from project.components.java
}
}
}
}
project(":core"){
apply plugin: 'java'
dependencies {
annotationProcessor project(":process-annotations")
}
}
project(":common"){
apply plugin: 'java'
dependencies {
api project(":core")
api project(":action-lang")
annotationProcessor project(":process-annotations")
}
}
project(":client"){
apply plugin: 'java'
apply plugin: 'docker-compose'
dependencies {
api project(":core")
api project(":common")
api project(":serviceapi")
annotationProcessor project(":process-annotations")
}
test {
useJUnitPlatform {
excludeTags 'integration'
}
}
tasks.register('integration', Test) {
// In the future, we can use the Test Suite feature rather than doing this manually: https://docs.gradle.org/7.3.1/userguide/jvm_test_suite_plugin.html
useJUnitPlatform {
includeTags 'integration'
}
}
dockerCompose {
useComposeFiles = ['../testing/couchdb-compose.yml']
isRequiredBy integration
}
}
project(":serviceapi"){
apply plugin: 'java'
dependencies {
api project(":core")
annotationProcessor project(":process-annotations")
}
}
project(":server"){
apply plugin: 'java'
dependencies {
api project(":core")
api project(":common")
api project(":serviceapi")
annotationProcessor project(":process-annotations")
}
}
project(":action-node"){
apply plugin: 'java'
dependencies {
annotationProcessor project(":process-annotations")
}
}
project(":notation-script"){
apply plugin: 'java'
dependencies {
annotationProcessor project(":process-annotations")
}
}
project(":action-lang"){
apply plugin: 'java'
dependencies {
api(project(":notation-script")){
// we do this because https://github.com/gradle/gradle/issues/820
exclude group: "org.antlr", module: "antlr-runtime"
exclude group: "org.antlr", module: "antlr4"
// We exclude antlr4-runtime because we add it below as an api dependency rather than an implementation dependency
exclude group: "org.antlr", module: "antlr4-runtime"
exclude group: "org.antlr", module: "ST4"
}
// https://mvnrepository.com/artifact/org.antlr/antlr4-runtime
api group: 'org.antlr', name: 'antlr4-runtime', version: "$antlrVersion"
api project(":action-node")
annotationProcessor project(":process-annotations")
}
}
wrapper {
gradleVersion = '8.11.1'
distributionType = Wrapper.DistributionType.ALL
}