Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up Spotless #981

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{groovy,java}]
indent_size = 4

[*.{kt,kts}]
ij_kotlin_imports_layout = *
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ij_kotlin_line_break_after_multiline_when_entry = false
ij_kotlin_name_count_to_use_star_import = 999
ij_kotlin_name_count_to_use_star_import_for_members = 999
ij_kotlin_packages_to_use_import_on_demand = unset
ktlint_code_style = intellij_idea
ktlint_standard_function-expression-body = disabled

[*.md]
trim_trailing_whitespace = false
103 changes: 57 additions & 46 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,68 +1,79 @@
plugins {
groovy
`java-gradle-plugin`
id("shadow.convention.publish")
id("shadow.convention.deploy")
groovy
`java-gradle-plugin`
id("shadow.convention.publish")
id("shadow.convention.deploy")
id("com.diffplug.spotless") version "7.0.0.BETA2"
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

spotless {
kotlinGradle {
ktlint()
}
}

dependencies {
compileOnly(localGroovy())
compileOnly(localGroovy())

implementation("org.jdom:jdom2:2.0.6.1")
implementation("org.ow2.asm:asm-commons:9.7")
implementation("commons-io:commons-io:2.17.0")
implementation("org.apache.ant:ant:1.10.15")
implementation("org.codehaus.plexus:plexus-utils:4.0.1")
implementation("org.codehaus.plexus:plexus-xml:4.0.4")
implementation("org.apache.logging.log4j:log4j-core:2.24.0")
implementation("org.vafer:jdependency:2.11")
implementation("org.jdom:jdom2:2.0.6.1")
implementation("org.ow2.asm:asm-commons:9.7")
implementation("commons-io:commons-io:2.17.0")
implementation("org.apache.ant:ant:1.10.15")
implementation("org.codehaus.plexus:plexus-utils:4.0.1")
implementation("org.codehaus.plexus:plexus-xml:4.0.4")
implementation("org.apache.logging.log4j:log4j-core:2.24.0")
implementation("org.vafer:jdependency:2.11")

testImplementation("org.spockframework:spock-core:2.3-groovy-3.0") {
exclude(group = "org.codehaus.groovy")
}
testImplementation("org.spockframework:spock-junit4:2.3-groovy-3.0")
testImplementation("xmlunit:xmlunit:1.6")
testImplementation("org.apache.commons:commons-lang3:3.17.0")
testImplementation("com.google.guava:guava:33.3.0-jre")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.0")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.11.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation("org.spockframework:spock-core:2.3-groovy-3.0") {
exclude(group = "org.codehaus.groovy")
}
testImplementation("org.spockframework:spock-junit4:2.3-groovy-3.0")
testImplementation("xmlunit:xmlunit:1.6")
testImplementation("org.apache.commons:commons-lang3:3.17.0")
testImplementation("com.google.guava:guava:33.3.0-jre")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.0")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.11.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

val isCI = providers.environmentVariable("CI").isPresent

tasks.withType<Test>().configureEach {
useJUnitPlatform()
useJUnitPlatform()

maxParallelForks = Runtime.getRuntime().availableProcessors()
maxParallelForks = Runtime.getRuntime().availableProcessors()

if (isCI) {
testLogging.showStandardStreams = true
minHeapSize = "1g"
maxHeapSize = "1g"
}
if (isCI) {
testLogging.showStandardStreams = true
minHeapSize = "1g"
maxHeapSize = "1g"
}

systemProperty("shadowVersion", version)
systemProperty("shadowVersion", version)

// Required to test configuration cache in tests when using withDebug()
// https://github.com/gradle/gradle/issues/22765#issuecomment-1339427241
jvmArgs(
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/java.util.concurrent.atomic=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens", "java.base/java.net=ALL-UNNAMED",
)
// Required to test configuration cache in tests when using withDebug()
// https://github.com/gradle/gradle/issues/22765#issuecomment-1339427241
jvmArgs(
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.base/java.util.concurrent.atomic=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens",
"java.base/java.net=ALL-UNNAMED",
)
}

tasks.register("release") {
dependsOn(
tasks.publish,
tasks.publishPlugins,
tasks.gitPublishPush,
)
dependsOn(
tasks.publish,
tasks.publishPlugins,
tasks.gitPublishPush,
)
}
34 changes: 17 additions & 17 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
repositories {
mavenCentral()
gradlePluginPortal()
}

includeBuild("build-logic")
includeBuild("build-logic")
}

plugins {
id("com.gradle.develocity") version "3.18.1"
id("com.gradle.develocity") version "3.18.1"
}

develocity {
buildScan {
termsOfUseUrl = "https://gradle.com/terms-of-service"
termsOfUseAgree = "yes"
// TODO: workaround for https://github.com/gradle/gradle/issues/22879.
val isCI = providers.environmentVariable("CI").isPresent
publishing.onlyIf { isCI }
}
buildScan {
termsOfUseUrl = "https://gradle.com/terms-of-service"
termsOfUseAgree = "yes"
// TODO: workaround for https://github.com/gradle/gradle/issues/22879.
val isCI = providers.environmentVariable("CI").isPresent
publishing.onlyIf { isCI }
}
}

dependencyResolutionManagement {
repositories {
mavenCentral()
}
repositories {
mavenCentral()
}
}

rootProject.name = "shadow"

enableFeaturePreview("STABLE_CONFIGURATION_CACHE")
enableFeaturePreview("STABLE_CONFIGURATION_CACHE")