Skip to content
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
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ The agent JAR is built in **3 critical steps** (see `agent/agent/build.gradle.kt
abstract class HttpClientTest {
@Environment(TOMCAT_8_JAVA_8)
static class Tomcat8Java8Test extends HttpClientTest {}

@Environment(TOMCAT_8_JAVA_11)
static class Tomcat8Java11Test extends HttpClientTest {}
}
Expand Down
10 changes: 10 additions & 0 deletions agent/agent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,18 @@ tasks {
delete(rootProject.file("licenses"))
}

val generateLicenseReportEnabled =
gradle.startParameter.taskNames.any { it.equals("generateLicenseReport") }
named("generateLicenseReport").configure {
dependsOn(cleanLicenses)
finalizedBy(":spotlessApply")
// disable licence report generation unless this task is explicitly run
// the files produced by this task are used by other tasks without declaring them as dependency
// which gradle considers an error
enabled = enabled && generateLicenseReportEnabled
}
if (generateLicenseReportEnabled) {
project.parent?.parent?.tasks?.getByName("spotlessMisc")?.dependsOn(named("generateLicenseReport"))
Comment on lines +165 to +176
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also copy from upstream

}
}

Expand Down
88 changes: 59 additions & 29 deletions buildSrc/src/main/kotlin/ai.spotless-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,42 +1,72 @@
import com.diffplug.gradle.spotless.SpotlessExtension

plugins {
id("com.diffplug.spotless")
}

spotless {
java {
googleJavaFormat()
licenseHeaderFile(rootProject.file("buildscripts/spotless.license.java"), "(package|import|public|// Includes work from:)")
licenseHeaderFile(
rootProject.file("buildscripts/spotless.license.java"),
"(package|import|public|// Includes work from:)"
)
toggleOffOn()
target("src/**/*.java")
}
kotlinGradle {
ktlint().editorConfigOverride(mapOf(
"indent_size" to "2",
"continuation_indent_size" to "2",
"max_line_length" to "160",
"ktlint_standard_no-wildcard-imports" to "disabled",
// ktlint does not break up long lines, it just fails on them
"ktlint_standard_max-line-length" to "disabled",
// ktlint makes it *very* hard to locate where this actually happened
"ktlint_standard_trailing-comma-on-call-site" to "disabled",
// depends on ktlint_standard_wrapping
"ktlint_standard_trailing-comma-on-declaration-site" to "disabled",
// also very hard to find out where this happens
"ktlint_standard_wrapping" to "disabled"
))
// not sure why it's not using the indent settings from .editorconfig
ktlint().editorConfigOverride(
mapOf(
"indent_size" to "2",
"continuation_indent_size" to "2",
"max_line_length" to "160",
"ktlint_standard_no-wildcard-imports" to "disabled",
// ktlint does not break up long lines, it just fails on them
"ktlint_standard_max-line-length" to "disabled",
// ktlint makes it *very* hard to locate where this actually happened
"ktlint_standard_trailing-comma-on-call-site" to "disabled",
// depends on ktlint_standard_wrapping
"ktlint_standard_trailing-comma-on-declaration-site" to "disabled",
// also very hard to find out where this happens
"ktlint_standard_wrapping" to "disabled",
// we use variable names like v1_10Deps
"ktlint_standard_property-naming" to "disabled",
// prevent moving comment to next line in latestDepTestLibrary("xxx") { // see xxx module
"ktlint_standard_function-literal" to "disabled"
)
)
}
format("misc") {
// not using "**/..." to help keep spotless fast
target(
".gitattributes",
".gitconfig",
".editorconfig",
"*.md",
"src/**/*.md",
"docs/**/*.md",
"*.sh",
"src/**/*.properties")
indentWithSpaces()
trimTrailingWhitespace()
endWithNewline()
}

// Use root declared tool deps to avoid issues with high concurrency.
// see https://github.com/diffplug/spotless/tree/main/plugin-gradle#dependency-resolution-modes
if (project == rootProject) {
spotless {
format("misc") {
target(
".gitignore",
".gitattributes",
".gitconfig",
".editorconfig",
"**/*.md",
"**/*.sh",
"**/*.dockerfile",
"**/gradle.properties"
)
leadingTabsToSpaces()
trimTrailingWhitespace()
endWithNewline()
}
predeclareDeps()
}

with(extensions["spotlessPredeclare"] as SpotlessExtension) {
java {
googleJavaFormat()
}
kotlinGradle {
ktlint()
}
}
}
Loading