Skip to content

Commit 7b908a5

Browse files
authored
Replace shipkit-auto-version by custom version plugin (#9228)
* chore: Replace shipkit-auto-version by custom version plugin # Conflicts: # build.gradle * chore: Tracer version increments patch when on "release/v* branch * chore: Tracer version detects dirtiness on local builds, not on CI * chore: Tracer version plugin tests * chore: Make the property ignore buildSrc test only, not integration tests * chore: Apply PR suggestions from code review * chore: Suggestions from code review * chore: Don't declare the assertj library in the main catalog just yet
1 parent 708adc9 commit 7b908a5

File tree

5 files changed

+564
-10
lines changed

5 files changed

+564
-10
lines changed

build.gradle.kts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
id("com.github.spotbugs") version "5.0.14"
99
id("de.thetaphi.forbiddenapis") version "3.8"
1010

11-
id("org.shipkit.shipkit-auto-version") version "2.1.2"
11+
id("tracer-version")
1212
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
1313

1414
id("com.gradleup.shadow") version "8.3.6" apply false
@@ -56,11 +56,8 @@ apply(from = rootDir.resolve("gradle/spotless.gradle"))
5656

5757
val compileTask = tasks.register("compile")
5858

59-
val repoVersion = version
60-
6159
allprojects {
6260
group = "com.datadoghq"
63-
version = repoVersion
6461

6562
if (isCI.isPresent) {
6663
layout.buildDirectory = providers.provider {

buildSrc/build.gradle.kts

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
groovy
33
`java-gradle-plugin`
44
`kotlin-dsl`
5+
`jvm-test-suite`
56
id("com.diffplug.spotless") version "6.13.0"
67
}
78

@@ -25,6 +26,10 @@ gradlePlugin {
2526
id = "call-site-instrumentation"
2627
implementationClass = "datadog.gradle.plugin.CallSiteInstrumentationPlugin"
2728
}
29+
create("tracer-version-plugin") {
30+
id = "tracer-version"
31+
implementationClass = "datadog.gradle.plugin.version.TracerVersionPlugin"
32+
}
2833
}
2934
}
3035

@@ -42,19 +47,46 @@ dependencies {
4247
implementation("org.eclipse.aether", "aether-transport-http", "1.1.0")
4348
implementation("org.apache.maven", "maven-aether-provider", "3.3.9")
4449

50+
implementation("com.github.zafarkhaja:java-semver:0.10.2")
51+
4552
implementation("com.google.guava", "guava", "20.0")
4653
implementation("org.ow2.asm", "asm", "9.8")
4754
implementation("org.ow2.asm", "asm-tree", "9.8")
48-
49-
testImplementation(libs.spock.core)
50-
testImplementation(libs.groovy)
5155
}
5256

5357
tasks.compileKotlin {
5458
dependsOn(":call-site-instrumentation-plugin:build")
5559
}
5660

57-
tasks.test {
58-
useJUnitPlatform()
59-
enabled = project.hasProperty("runBuildSrcTests")
61+
testing {
62+
@Suppress("UnstableApiUsage")
63+
suites {
64+
val test by getting(JvmTestSuite::class) {
65+
dependencies {
66+
implementation(libs.spock.core)
67+
implementation(libs.groovy)
68+
}
69+
targets.configureEach {
70+
testTask.configure {
71+
enabled = project.hasProperty("runBuildSrcTests")
72+
}
73+
}
74+
}
75+
76+
val integTest by registering(JvmTestSuite::class) {
77+
dependencies {
78+
implementation(gradleTestKit())
79+
implementation("org.assertj:assertj-core:3.25.3")
80+
}
81+
// Makes the gradle plugin publish its declared plugins to this source set
82+
gradlePlugin.testSourceSet(sources)
83+
}
84+
85+
withType(JvmTestSuite::class).configureEach {
86+
useJUnitJupiter(libs.versions.junit5)
87+
targets.configureEach {
88+
testTask
89+
}
90+
}
91+
}
6092
}

0 commit comments

Comments
 (0)