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
  • Loading branch information
petertrr committed Dec 12, 2024
1 parent 7e4becb commit 54a0bf2
Show file tree
Hide file tree
Showing 13 changed files with 269 additions and 256 deletions.
28 changes: 0 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -238,31 +238,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(', ')}")
}
}
31 changes: 31 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[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" }
1 change: 1 addition & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=bed1da33cca0f557ab13691c77f38bb67388119e4794d113e051039b80af9bb1
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
Expand Down
21 changes: 0 additions & 21 deletions its/plugin/build.gradle

This file was deleted.

21 changes: 21 additions & 0 deletions its/plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
dependencies {
testImplementation(libs.sonar.analyzer.commons)
testImplementation(libs.sonar.ws)
testImplementation(libs.assertj.core)
testImplementation(libs.sonarlint.core)
testImplementation(libs.sonar.orchestrator)
}

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 }
}
17 changes: 0 additions & 17 deletions its/ruling/build.gradle

This file was deleted.

17 changes: 17 additions & 0 deletions its/ruling/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
dependencies {
testImplementation(libs.sonar.analyzer.commons)
testImplementation(libs.assertj.core)
testImplementation(libs.sonar.orchestrator)
}

sonarqube.isSkipProject = true

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

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

This file was deleted.

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

rootProject.name = "sonar-go"

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

This file was deleted.

Loading

0 comments on commit 54a0bf2

Please sign in to comment.