|
| 1 | +import buildlogic.getLibrary |
| 2 | +import buildlogic.stringyLibs |
| 3 | + |
| 4 | +plugins { |
| 5 | + id("eclipse") |
| 6 | + id("idea") |
| 7 | + id("checkstyle") |
| 8 | + id("buildlogic.common") |
| 9 | +} |
| 10 | + |
| 11 | +tasks |
| 12 | + .withType<JavaCompile>() |
| 13 | + .matching { it.name == "compileJava" || it.name == "compileTestJava" } |
| 14 | + .configureEach { |
| 15 | + val disabledLint = listOf( |
| 16 | + "processing", "path", "fallthrough", "serial", "overloads", |
| 17 | + ) |
| 18 | + options.release.set(21) |
| 19 | + options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" }) |
| 20 | + options.isDeprecation = true |
| 21 | + options.encoding = "UTF-8" |
| 22 | + options.compilerArgs.add("-parameters") |
| 23 | + //options.compilerArgs.add("-Werror") |
| 24 | + } |
| 25 | + |
| 26 | +configure<CheckstyleExtension> { |
| 27 | + configFile = rootProject.file("config/checkstyle/checkstyle.xml") |
| 28 | + toolVersion = "10.16.0" |
| 29 | +} |
| 30 | + |
| 31 | +tasks.withType<Test>().configureEach { |
| 32 | + useJUnitPlatform() |
| 33 | +} |
| 34 | + |
| 35 | +dependencies { |
| 36 | + "compileOnly"(stringyLibs.getLibrary("jsr305")) |
| 37 | + "testImplementation"(platform(stringyLibs.getLibrary("junit-bom"))) |
| 38 | + "testImplementation"(stringyLibs.getLibrary("junit-jupiter-api")) |
| 39 | + "testImplementation"(stringyLibs.getLibrary("junit-jupiter-params")) |
| 40 | + "testRuntimeOnly"(stringyLibs.getLibrary("junit-jupiter-engine")) |
| 41 | +} |
| 42 | + |
| 43 | +// Java 8 turns on doclint which we fail |
| 44 | +tasks.withType<Javadoc>().configureEach { |
| 45 | + options.encoding = "UTF-8" |
| 46 | + (options as StandardJavadocDocletOptions).apply { |
| 47 | + //addBooleanOption("Werror", true) |
| 48 | + addBooleanOption("Xdoclint:all", true) |
| 49 | + addBooleanOption("Xdoclint:-missing", true) |
| 50 | + tags( |
| 51 | + "apiNote:a:API Note:", |
| 52 | + "implSpec:a:Implementation Requirements:", |
| 53 | + "implNote:a:Implementation Note:" |
| 54 | + ) |
| 55 | + } |
| 56 | +} |
| 57 | + |
| 58 | +configure<JavaPluginExtension> { |
| 59 | + withJavadocJar() |
| 60 | + withSourcesJar() |
| 61 | +} |
| 62 | + |
| 63 | +tasks.named("check").configure { |
| 64 | + dependsOn("checkstyleMain", "checkstyleTest") |
| 65 | +} |
0 commit comments