Skip to content

Commit

Permalink
SONARGO-69 Convert Groovy DSL to Kotlin DSL, convert version catalog …
Browse files Browse the repository at this point in the history
…to TOML (#37)
  • Loading branch information
petertrr authored Dec 16, 2024
1 parent 8f7fb9d commit 9744396
Show file tree
Hide file tree
Showing 12 changed files with 310 additions and 285 deletions.
28 changes: 0 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -181,31 +181,3 @@ artifactory {
// The name of this variable is important because it's used by the delivery process when extracting version from Artifactory build info.
clientConfig.info.addEnvironmentProperty('PROJECT_VERSION', "${version}")
}

void enforceJarSizeAndCheckContent(File file, long minSize, long maxSize) {
long size = file.length()
if (size < minSize) {
throw new GradleException("${file.path} size ($size) too small. Min is $minSize")
} else if (size > maxSize) {
throw new GradleException("${file.path} size ($size) too large. Max is $maxSize")
}
checkJarEntriesPathUniqueness file
}

// A jar should not contain 2 entries with the same path, furthermore Pack200 will fail to unpack it
void checkJarEntriesPathUniqueness(File file) {
def allNames = new HashSet()
def duplicatedNames = new HashSet()
file.withInputStream { input ->
new JarInputStream(input).withCloseable { jarInput ->
for (def jarEntry = jarInput.nextJarEntry; jarEntry != null; jarEntry = jarInput.nextJarEntry) {
if (!allNames.add(jarEntry.name)) {
duplicatedNames.add jarEntry.name
}
}
}
}
if (!duplicatedNames.empty) {
throw new GradleException("Duplicated entries in the jar: '${file.path}': ${duplicatedNames.join(', ')}")
}
}
32 changes: 32 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[versions]
slang-dependencies = "1.17.0.6351"
analyzer-commons = "2.16.0.3141"
plugin-api = "10.10.0.2391"
sonarqube = "10.0.0.68432"
orchestrator = "3.42.0.312"
sonarlint = "9.0.0.74282"
minimal-json = "0.9.5"
mockito-core = "5.13.0"
assertj-core = "3.26.3"
junit-jupiter = "5.11.0"

[libraries]
sonar-plugin-api = { group = "org.sonarsource.api.plugin", name = "sonar-plugin-api", version.ref = "plugin-api" }
sonar-analyzer-commons = { group = "org.sonarsource.analyzer-commons", name = "sonar-analyzer-commons", version.ref = "analyzer-commons" }
slang-api = { group = "org.sonarsource.slang", name = "slang-api", version.ref = "slang-dependencies" }
slang-checks = { group = "org.sonarsource.slang", name = "slang-checks", version.ref = "slang-dependencies" }
slang-plugin = { group = "org.sonarsource.slang", name = "slang-plugin", version.ref = "slang-dependencies" }
checkstyle-import = { group = "org.sonarsource.slang", name = "checkstyle-import", version.ref = "slang-dependencies" }
minimal-json = { group = "com.eclipsesource.minimal-json", name = "minimal-json", version.ref = "minimal-json" }
sonar-plugin-api-test-fixtures = { group = "org.sonarsource.api.plugin", name = "sonar-plugin-api-test-fixtures", version.ref = "plugin-api" }
sonar-plugin-api-impl = { group = "org.sonarsource.sonarqube", name = "sonar-plugin-api-impl", version.ref = "sonarqube" }
sonar-orchestrator = { group = "org.sonarsource.orchestrator", name = "sonar-orchestrator", version.ref = "orchestrator" }
sonarlint-core = { group = "org.sonarsource.sonarlint.core", name = "sonarlint-core", version.ref = "sonarlint" }
sonar-ws = { group = "org.sonarsource.sonarqube", name = "sonar-ws", version.ref = "sonarqube" }
slang-antlr = { group = "org.sonarsource.slang", name = "slang-antlr", version.ref = "slang-dependencies" }
slang-testing = { group = "org.sonarsource.slang", name = "slang-testing", version.ref = "slang-dependencies" }
mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito-core" }
assertj-core = { group = "org.assertj", name = "assertj-core", version.ref = "assertj-core" }
junit-jupiter-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit-jupiter" }
junit-jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit-jupiter" }
junit-vintage-engine = { group = "org.junit.vintage", name = "junit-vintage-engine", version.ref = "junit-jupiter" }
26 changes: 0 additions & 26 deletions its/plugin/build.gradle

This file was deleted.

26 changes: 26 additions & 0 deletions its/plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
id("org.sonarsource.cloud-native.java-conventions")
}

dependencies {
testImplementation(libs.sonar.analyzer.commons)
testImplementation(libs.sonar.ws)
testImplementation(libs.assertj.core)
testImplementation(libs.sonarlint.core)
testImplementation(libs.sonar.orchestrator)
testRuntimeOnly(libs.junit.vintage.engine)
}

sonarqube.isSkipProject = true

tasks.test {
onlyIf {
project.hasProperty("plugin") || project.hasProperty("its")
}
filter {
includeTestsMatching("org.sonarsource.slang.Tests")
includeTestsMatching("org.sonarsource.slang.SonarLintTest")
}
systemProperty("java.awt.headless", "true")
outputs.upToDateWhen { false }
}
22 changes: 0 additions & 22 deletions its/ruling/build.gradle

This file was deleted.

22 changes: 22 additions & 0 deletions its/ruling/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
id("org.sonarsource.cloud-native.java-conventions")
}

dependencies {
testImplementation(libs.sonar.analyzer.commons)
testImplementation(libs.assertj.core)
testImplementation(libs.sonar.orchestrator)
testRuntimeOnly(libs.junit.vintage.engine)
}

sonarqube.isSkipProject = true

tasks.test {
onlyIf {
project.hasProperty("its") ||
project.hasProperty("ruling")
}

systemProperty("java.awt.headless", "true")
outputs.upToDateWhen { false }
}
75 changes: 0 additions & 75 deletions settings.gradle

This file was deleted.

46 changes: 46 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
pluginManagement {
includeBuild("build-logic")
repositories {
mavenCentral()
gradlePluginPortal()
}
}

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

develocity {
server = "https://develocity.sonar.build"
buildScan {
tag(if (System.getenv("CI").isNullOrEmpty()) "local" else "CI")
tag(System.getProperty("os.name"))
if (System.getenv("CIRRUS_BRANCH") == "master") {
tag("master")
}
if (System.getenv("CIRRUS_PR")?.isBlank() == false) {
tag("PR")
}
value("Build Number", System.getenv("BUILD_NUMBER"))
value("Branch", System.getenv("CIRRUS_BRANCH"))
value("PR", System.getenv("CIRRUS_PR"))
}
}

val isCI = System.getenv("CI") != null
buildCache {
local {
isEnabled = !isCI
}
remote(develocity.buildCache) {
isEnabled = true
isPush = isCI
}
}

rootProject.name = "sonar-go"

include(":sonar-go-to-slang")
include(":sonar-go-plugin")
include(":its:plugin")
include(":its:ruling")
103 changes: 0 additions & 103 deletions sonar-go-plugin/build.gradle

This file was deleted.

Loading

0 comments on commit 9744396

Please sign in to comment.