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
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
os: [ ubuntu-latest, windows-latest ]
# Always test on the latest version and some LTS.
java: [ 17, 21, 24 ]
# Test on the minimum Gradle version and the latest.
gradle: [ 8.3, current ]
exclude:
# Gradle 8.3 doesn't support Java 24.
- gradle: 8.3
java: 24
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -22,7 +28,7 @@ jobs:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- uses: gradle/actions/setup-gradle@v4
- run: ./gradlew build
- run: ./gradlew build --info "-PtestGradleVersion=${{ matrix.gradle }}"

publish-snapshot:
needs: build
Expand Down
6 changes: 6 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ val isCI = providers.environmentVariable("CI").isPresent
tasks.withType<Test>().configureEach {
useJUnitPlatform()

val testGradleVersion = providers.gradleProperty("testGradleVersion").orNull.let {
if (it == null || it == "current") GradleVersion.current().version else it
}
logger.info("Using test Gradle version: $testGradleVersion")
systemProperty("TEST_GRADLE_VERSION", testGradleVersion)

maxParallelForks = Runtime.getRuntime().availableProcessors()

if (isCI) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class RelocationUtil {
JarFile jf = new JarFile(jar)
jf.entries().each { entry ->
if (entry.name.endsWith(".class") && entry.name != "module-info.class") {
packages << entry.name[0..entry.name.lastIndexOf('/') - 1].replaceAll('/', '.')
def i = entry.name.lastIndexOf('/')
if (i != -1) {
packages << entry.name.take(i).replaceAll('/', '.')
}
}
}
jf.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ include 'api', 'main'

buildFile.text = replaceTokens(fullSnippet)

GradleRunner runner = GradleRunner.create().withProjectDir(tempDir).withPluginClasspath().forwardOutput()
GradleRunner runner = GradleRunner.create()
.withGradleVersion(PluginSpecification.TEST_GRADLE_VERSION)
.withProjectDir(tempDir)
.withPluginClasspath()
.forwardOutput()

runner.withArguments(":main:build", "-m").build()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ abstract class PluginSpecification extends Specification {

public static final String SHADOW_VERSION = System.getProperty("shadowVersion")

public static final String TEST_GRADLE_VERSION = System.getProperty("TEST_GRADLE_VERSION")

AppendableMavenFileRepository repo

def setup() {
Expand Down Expand Up @@ -55,6 +57,7 @@ abstract class PluginSpecification extends Specification {

GradleRunner getRunner() {
GradleRunner.create()
.withGradleVersion(TEST_GRADLE_VERSION)
.withProjectDir(dir.toFile())
.forwardOutput()
.withPluginClasspath()
Expand Down