Skip to content

Commit d2c6359

Browse files
committed
Migrate gradle file to kotlin DSL
1 parent a79c38a commit d2c6359

29 files changed

+475
-533
lines changed

build.gradle

Lines changed: 0 additions & 78 deletions
This file was deleted.

build.gradle.kts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
plugins {
2+
alias(libs.plugins.spotless) apply false
3+
alias(libs.plugins.errorprone)
4+
}
5+
6+
subprojects {
7+
apply(plugin = "com.diffplug.spotless")
8+
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
9+
format("misc") {
10+
target("*.gradle", "*.gradle.kts", ".gitattributes", ".gitignore")
11+
trimTrailingWhitespace()
12+
leadingTabsToSpaces()
13+
endWithNewline()
14+
}
15+
antlr4 {
16+
target("**/*.g4")
17+
antlr4Formatter()
18+
}
19+
}
20+
21+
tasks.withType<Test> {
22+
maxParallelForks = Runtime.getRuntime().availableProcessors()
23+
}
24+
25+
plugins.withType<JavaPlugin> {
26+
tasks.withType<Test>().configureEach {
27+
jvmArgs("-Xshare:off")
28+
}
29+
configure<JavaPluginExtension> {
30+
toolchain {
31+
languageVersion.set(JavaLanguageVersion.of(25))
32+
}
33+
}
34+
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
35+
java {
36+
targetExclude("**/build/generated-src/**/*.java", "**/build/generated/**/*.java")
37+
removeUnusedImports()
38+
palantirJavaFormat(libs.versions.palantir.get()).style("GOOGLE")
39+
}
40+
}
41+
42+
apply(plugin = "net.ltgt.errorprone")
43+
dependencies {
44+
"errorprone"(libs.errorprone.core)
45+
"errorprone"(libs.nullaway)
46+
}
47+
plugins.withId("java-library") {
48+
dependencies {
49+
"api"(libs.jspecify)
50+
}
51+
}
52+
plugins.withId("java") {
53+
if (!project.plugins.hasPlugin("java-library")) {
54+
dependencies {
55+
"implementation"(libs.jspecify)
56+
}
57+
}
58+
}
59+
tasks.withType<JavaCompile>().configureEach {
60+
(options as ExtensionAware).extensions.configure<net.ltgt.gradle.errorprone.ErrorProneOptions>("errorprone") {
61+
error("NullAway")
62+
excludedPaths.set(".*/build/generated/.*")
63+
option("NullAway:AnnotatedPackages", "org.smoothbuild")
64+
// Avoid errors when field is injected by picocli.
65+
// In some cases, when picocli does not always inject some field
66+
// (for example user is not required to provide some option in commandline),
67+
// such field is annotated in code with @Nullable.
68+
option("NullAway:ExternalInitAnnotations", "picocli.CommandLine.Command")
69+
}
70+
}
71+
72+
@Suppress("UnstableApiUsage")
73+
configure<TestingExtension> {
74+
suites {
75+
val test by getting(JvmTestSuite::class) {
76+
useJUnitJupiter()
77+
}
78+
}
79+
}
80+
}
81+
}

gradle/libs.versions.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[versions]
2+
spotless = "8.2.0"
3+
errorprone-plugin = "5.0.0"
4+
errorprone-core = "2.46.0"
5+
nullaway = "0.12.15"
6+
palantir = "2.83.0"
7+
8+
[libraries]
9+
errorprone-core = { group = "com.google.errorprone", name = "error_prone_core", version.ref = "errorprone-core" }
10+
nullaway = { group = "com.uber.nullaway", name = "nullaway", version.ref = "nullaway" }
11+
antlr4 = "org.antlr:antlr4:4.13.2"
12+
antlr4-runtime = "org.antlr:antlr4-runtime:4.13.2"
13+
guava = "com.google.guava:guava:33.5.0-jre"
14+
jspecify = "org.jspecify:jspecify:1.0.0"
15+
dagger = "com.google.dagger:dagger:2.59"
16+
dagger-compiler = "com.google.dagger:dagger-compiler:2.59"
17+
okio = "com.squareup.okio:okio:3.16.4"
18+
picocli = "info.picocli:picocli:4.7.7"
19+
zip4j = "net.lingala.zip4j:zip4j:2.11.5"
20+
awaitility = "org.awaitility:awaitility:4.3.0"
21+
guava-testlib = "com.google.guava:guava-testlib:33.5.0-jre"
22+
jakarta-inject = "jakarta.inject:jakarta.inject-api:2.0.1"
23+
junit-jupiter-engine = "org.junit.jupiter:junit-jupiter-engine:6.0.2"
24+
junit-jupiter-api = "org.junit.jupiter:junit-jupiter-api:6.0.2"
25+
junit-jupiter-params = "org.junit.jupiter:junit-jupiter-params:6.0.2"
26+
mockito = "org.mockito:mockito-core:5.21.0"
27+
truth = "com.google.truth:truth:1.4.5"
28+
junit4 = "junit:junit:4.13.2"
29+
30+
[bundles]
31+
testingFrameworks = ["junit-jupiter-api", "junit-jupiter-params", "mockito", "truth", "guava-testlib", "awaitility"]
32+
33+
[plugins]
34+
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
35+
errorprone = { id = "net.ltgt.errorprone", version.ref = "errorprone-plugin" }

settings.gradle

Lines changed: 0 additions & 42 deletions
This file was deleted.

settings.gradle.kts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
rootProject.name = "smooth-build"
2+
3+
include("src:testing")
4+
include("src:common")
5+
include("src:antlr-smooth")
6+
include("src:compiler-frontend")
7+
include("src:virtual-machine")
8+
include("src:compiler-backend")
9+
include("src:evaluator")
10+
include("src:antlr-report-matcher")
11+
include("src:cli")
12+
include("src:standard-library")
13+
include("src:distribution")
14+
include("src:system-test")
15+
16+
dependencyResolutionManagement {
17+
repositories {
18+
mavenCentral()
19+
}
20+
}

src/antlr-report-matcher/build.gradle

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import org.gradle.api.plugins.antlr.AntlrTask
2+
3+
plugins {
4+
id("antlr")
5+
}
6+
7+
tasks.withType<AntlrTask>().configureEach {
8+
arguments.add("-visitor")
9+
}
10+
11+
dependencies {
12+
antlr(libs.antlr4)
13+
}

src/antlr-smooth/build.gradle

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/antlr-smooth/build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import org.gradle.api.plugins.antlr.AntlrTask
2+
3+
plugins {
4+
id("antlr")
5+
}
6+
7+
tasks.withType<AntlrTask>().configureEach {
8+
arguments.add("-visitor")
9+
}
10+
11+
dependencies {
12+
antlr(libs.antlr4)
13+
}

src/cli/build.gradle

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)