Skip to content

Commit

Permalink
Fixed and adjusted the following.
Browse files Browse the repository at this point in the history
*Gradle build in build.gradle.kts had failed during spotless check because the plugin org.graalvm.buildtools.native was not found
-Solution: I have applied a plugin and made it work

*spotlessJavaCheck task failed because certain files did not conform to the formatting rules defined in the Spotless configuration
-Solution: Initiated an auto fix using ./gradlew :sdk:trace:spotlessApply

*Lastly as requested i initiated
./gradlew spotlessApply to ensure a consist code formating and the build was successful with no errors!

Relate to open-telemetry#6797
  • Loading branch information
Victorsesan committed Oct 24, 2024
1 parent ef46f8f commit a9fb915
Show file tree
Hide file tree
Showing 3 changed files with 1,543 additions and 696 deletions.
108 changes: 50 additions & 58 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,79 +1,71 @@
plugins {
`kotlin-dsl`

// When updating, update below in dependencies too
id("com.diffplug.spotless") version "6.25.0"
`kotlin-dsl`
// When updating, update below in dependencies too
id("com.diffplug.spotless") version "6.25.0"
}

if (!hasLauncherForJavaVersion(17)) {
throw GradleException(
"JDK 17 is required to build and gradle was unable to detect it on the system. " +
"Please install it and see https://docs.gradle.org/current/userguide/toolchains.html#sec:auto_detection " +
"for details on how gradle detects java toolchains."
)
throw GradleException(
"JDK 17 is required to build and gradle was unable to detect it on the system. " +
"Please install it and see https://docs.gradle.org/current/userguide/toolchains.html#sec:auto_detection " +
"for details on how gradle detects java toolchains."
)
}

fun hasLauncherForJavaVersion(version: Int): Boolean {
return try {
javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(version) }.get()
true
} catch (e: Exception) {
false
}
return try {
javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(version)) }.get()
true
} catch (e: Exception) {
false
}
}

spotless {
kotlinGradle {
ktlint().editorConfigOverride(mapOf(
"indent_size" to "2",
"continuation_indent_size" to "2",
"max_line_length" to "160",
"insert_final_newline" to "true",
"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"
))
target("**/*.gradle.kts")
}
kotlinGradle {
ktlint().editorConfigOverride(mapOf(
"indent_size" to "2",
"continuation_indent_size" to "2",
"max_line_length" to "160",
"insert_final_newline" to "true",
"ktlint_standard_no-wildcard-imports" to "disabled",
"ktlint_standard_max-line-length" to "disabled",
"ktlint_standard_trailing-comma-on-call-site" to "disabled",
"ktlint_standard_trailing-comma-on-declaration-site" to "disabled",
"ktlint_standard_wrapping" to "disabled"
))
target("**/*.gradle.kts")
}
}

repositories {
mavenCentral()
gradlePluginPortal()
mavenLocal()
mavenCentral()
gradlePluginPortal()
mavenLocal()
}

dependencies {
implementation(enforcedPlatform("com.squareup.wire:wire-bom:5.1.0"))
implementation("com.google.auto.value:auto-value-annotations:1.11.0")
// When updating, update above in plugins too
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
// Needed for japicmp but not automatically brought in for some reason.
implementation("com.google.guava:guava:33.3.1-jre")
implementation("com.squareup:javapoet:1.13.0")
implementation("com.squareup.wire:wire-compiler")
implementation("com.squareup.wire:wire-gradle-plugin")
implementation("gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.18")
implementation("gradle.plugin.io.morethan.jmhreport:gradle-jmh-report:0.9.6")
implementation("me.champeau.gradle:japicmp-gradle-plugin:0.4.3")
implementation("me.champeau.jmh:jmh-gradle-plugin:0.7.2")
implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.0.1")
implementation("net.ltgt.gradle:gradle-nullaway-plugin:2.0.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21")
implementation("org.owasp:dependency-check-gradle:10.0.4")
implementation("ru.vyarus:gradle-animalsniffer-plugin:1.7.1")
implementation(enforcedPlatform("com.squareup.wire:wire-bom:5.1.0"))
implementation("com.google.auto.value:auto-value-annotations:1.11.0")
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
implementation("com.google.guava:guava:33.3.1-jre")
implementation("com.squareup:javapoet:1.13.0")
implementation("com.squareup.wire:wire-compiler")
implementation("com.squareup.wire:wire-gradle-plugin")
implementation("gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.18")
implementation("gradle.plugin.io.morethan.jmhreport:gradle-jmh-report:0.9.6")
implementation("me.champeau.gradle:japicmp-gradle-plugin:0.4.3")
implementation("me.champeau.jmh:jmh-gradle-plugin:0.7.2")
implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.0.1")
implementation("net.ltgt.gradle:gradle-nullaway-plugin:2.0.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21")
implementation("org.owasp:dependency-check-gradle:10.0.4")
implementation("ru.vyarus:gradle-animalsniffer-plugin:1.7.1")
}

// We can't apply conventions to this build so include important ones such as the Java compilation
// target.
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
Loading

0 comments on commit a9fb915

Please sign in to comment.