Skip to content

Commit 07ae1b6

Browse files
authored
Merge pull request #468 from nebula-plugins/gradle-9-support
Gradle 9.x support
2 parents 8253051 + cd8bccb commit 07ae1b6

14 files changed

Lines changed: 160 additions & 145 deletions

File tree

.github/workflows/nebula.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
matrix:
2424
# test against latest update of some major Java version(s), as well as specific LTS version(s)
25-
java: [8, 17, 21]
25+
java: [17, 21]
2626
name: Gradle Build without Publish
2727
steps:
2828
- uses: actions/checkout@v4
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
distribution: 'zulu'
3737
java-version: |
38-
8
38+
17
3939
${{ matrix.java }}
4040
java-package: jdk
4141
- uses: actions/cache@v4
@@ -75,7 +75,7 @@ jobs:
7575
with:
7676
distribution: 'zulu'
7777
java-version: |
78-
8
78+
17
7979
21
8080
java-package: jdk
8181
- uses: actions/cache@v4
@@ -120,7 +120,7 @@ jobs:
120120
with:
121121
distribution: 'zulu'
122122
java-version: |
123-
8
123+
17
124124
21
125125
java-package: jdk
126126
- uses: actions/cache@v4

build.gradle

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*/
1717
plugins {
18-
id 'com.netflix.nebula.plugin-plugin' version '21.3.3'
18+
id 'com.netflix.nebula.plugin-plugin' version '22.0.2'
1919
id 'java-library'
2020
}
2121

@@ -46,7 +46,7 @@ dependencies {
4646
// Where logging goes is a runtime decision
4747
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
4848
}
49-
api('org.vafer:jdeb:1.10') {
49+
api('org.vafer:jdeb:1.14') {
5050
// Individual listing so that they translate into the pom file
5151
exclude group: 'org.apache.maven', module: 'maven-core'
5252
exclude group: 'org.apache.maven', module: 'maven-plugin-api'
@@ -66,10 +66,6 @@ tasks.withType(Javadoc) {
6666
options.links(javaApiUrl, groovyApiUrl)
6767
}
6868

69-
test {
70-
maxHeapSize = '384m'
71-
}
72-
7369
gradlePlugin {
7470
plugins {
7571
ospackage {

gradle.lockfile

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,41 @@
33
# This file is expected to be part of source control.
44
cglib:cglib-nodep:3.2.2=integTestRuntimeClasspath,testRuntimeClasspath
55
com.bmuschko:gradle-docker-plugin:3.2.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
6+
com.github.luben:zstd-jni:1.5.6-3=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
67
com.github.stefanbirkner:system-rules:1.19.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
7-
com.netflix.nebula:nebula-test:10.6.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
8-
commons-io:commons-io:2.6=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
8+
com.netflix.nebula:nebula-test:11.0.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
9+
commons-codec:commons-codec:1.17.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
10+
commons-io:commons-io:2.16.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
11+
io.airlift:aircompressor:0.27=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
12+
javax.inject:javax.inject:1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
913
junit:junit-dep:4.11=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
1014
junit:junit:4.13.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
11-
org.apache.ant:ant-launcher:1.10.12=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
12-
org.apache.ant:ant:1.10.12=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
13-
org.apache.commons:commons-compress:1.21=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
14-
org.apache.commons:commons-lang3:3.9=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
15-
org.apache.maven.shared:maven-shared-utils:3.3.3=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
16-
org.apache.maven:maven-archiver:3.5.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
17-
org.apache.maven:maven-model:3.1.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
15+
org.apache.ant:ant-launcher:1.10.15=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
16+
org.apache.ant:ant:1.10.15=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
17+
org.apache.commons:commons-compress:1.26.2=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
18+
org.apache.commons:commons-lang3:3.14.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
19+
org.apache.groovy:groovy:4.0.4=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
20+
org.apache.maven:maven-archiver:3.6.3=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
1821
org.apiguardian:apiguardian-api:1.1.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
1922
org.bouncycastle:bcpg-jdk15on:1.62=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
2023
org.bouncycastle:bcprov-jdk15on:1.62=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
21-
org.codehaus.groovy:groovy:3.0.12=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
22-
org.codehaus.plexus:plexus-archiver:4.2.3=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
23-
org.codehaus.plexus:plexus-interpolation:1.26=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
24-
org.codehaus.plexus:plexus-io:3.2.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
24+
org.codehaus.plexus:plexus-archiver:4.10.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
25+
org.codehaus.plexus:plexus-interpolation:1.27=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
26+
org.codehaus.plexus:plexus-io:3.5.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
2527
org.hamcrest:hamcrest-core:1.3=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
2628
org.hamcrest:hamcrest:2.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
27-
org.iq80.snappy:snappy:0.4=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
28-
org.junit.platform:junit-platform-commons:1.9.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
29-
org.junit.platform:junit-platform-engine:1.9.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
29+
org.junit.platform:junit-platform-commons:1.13.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
30+
org.junit.platform:junit-platform-engine:1.13.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
31+
org.junit.platform:junit-platform-launcher:1.13.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
3032
org.objenesis:objenesis:2.4=integTestRuntimeClasspath,testRuntimeClasspath
31-
org.opentest4j:opentest4j:1.2.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
33+
org.opentest4j:opentest4j:1.3.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
3234
org.redline-rpm:redline:1.2.10=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
33-
org.slf4j:slf4j-api:1.7.5=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
34-
org.spockframework:spock-core:2.3-groovy-3.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
35-
org.spockframework:spock-junit4:2.3-groovy-3.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
35+
org.slf4j:slf4j-api:1.7.36=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
36+
org.sonatype.plexus:plexus-cipher:1.4=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
37+
org.sonatype.plexus:plexus-sec-dispatcher:1.4=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
38+
org.spockframework:spock-core:2.3-groovy-4.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
39+
org.spockframework:spock-junit4:2.3-groovy-4.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
3640
org.tukaani:xz:1.4=compileClasspath,integTestCompileClasspath,testCompileClasspath
37-
org.tukaani:xz:1.8=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
38-
org.vafer:jdeb:1.10=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
41+
org.tukaani:xz:1.9=integTestRuntimeClasspath,runtimeClasspath,testRuntimeClasspath
42+
org.vafer:jdeb:1.14=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
3943
empty=annotationProcessor,integTestAnnotationProcessor,testAnnotationProcessor

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=7197a12f450794931532469d4ff21a59ea2c1cd59a3ec3f89c035c3c420a6999
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-rc-1-bin.zip
54
networkTimeout=10000
65
validateDistributionUrl=true
76
zipStoreBase=GRADLE_USER_HOME

src/main/groovy/com/netflix/gradle/plugins/deb/Deb.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import com.netflix.gradle.plugins.packaging.AbstractPackagingCopyAction
2020
import com.netflix.gradle.plugins.packaging.Dependency
2121
import com.netflix.gradle.plugins.packaging.SystemPackagingTask
2222
import com.netflix.gradle.plugins.utils.DeprecationLoggerUtils
23+
import groovy.transform.CompileDynamic
2324
import org.gradle.api.file.ProjectLayout
2425
import org.gradle.api.internal.ConventionMapping
2526
import org.gradle.api.internal.IConventionAware
@@ -31,7 +32,8 @@ import org.gradle.work.DisableCachingByDefault
3132
import javax.inject.Inject
3233

3334
@DisableCachingByDefault
34-
class Deb extends SystemPackagingTask {
35+
@CompileDynamic
36+
abstract class Deb extends SystemPackagingTask {
3537

3638
@Inject
3739
Deb(ProjectLayout projectLayout) {

src/main/groovy/com/netflix/gradle/plugins/docker/DockerCopyAction.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ class DockerCopyAction extends AbstractPackagingCopyAction<SystemPackageDockerfi
4646

4747
@Override
4848
protected void end() {
49-
dockerfileInstructionManager.create(task.archivePath)
49+
dockerfileInstructionManager.create(task.archiveFile.get().asFile)
5050
}
5151
}

src/main/groovy/com/netflix/gradle/plugins/docker/SystemPackageDockerfile.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import org.gradle.work.DisableCachingByDefault
99
import javax.inject.Inject
1010

1111
@DisableCachingByDefault
12-
class SystemPackageDockerfile extends SystemPackagingTask {
12+
abstract class SystemPackageDockerfile extends SystemPackagingTask {
1313
private final DockerfileInstructionManager dockerfileInstructionManager
1414
private static final ARCHIVE_NAME = 'Dockerfile'
1515

src/main/groovy/com/netflix/gradle/plugins/packaging/OsPackageAbstractArchiveTask.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.netflix.gradle.plugins.packaging
22

3+
import groovy.transform.CompileDynamic
34
import org.gradle.api.tasks.Internal
45
import org.gradle.api.tasks.bundling.AbstractArchiveTask
56
import org.gradle.work.DisableCachingByDefault
67

78
import javax.annotation.Nullable
89

910
@DisableCachingByDefault
11+
@CompileDynamic
1012
abstract class OsPackageAbstractArchiveTask extends AbstractArchiveTask {
1113

1214
OsPackageAbstractArchiveTask() {

src/main/groovy/com/netflix/gradle/plugins/rpm/Rpm.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package com.netflix.gradle.plugins.rpm
1919
import com.netflix.gradle.plugins.packaging.AbstractPackagingCopyAction
2020
import com.netflix.gradle.plugins.packaging.SystemPackagingTask
2121
import com.netflix.gradle.plugins.utils.DeprecationLoggerUtils
22+
import groovy.transform.CompileDynamic
2223
import org.gradle.api.file.ProjectLayout
2324
import org.gradle.api.tasks.InputFile
2425
import org.gradle.api.tasks.Optional
@@ -34,7 +35,8 @@ import org.gradle.api.internal.IConventionAware
3435
import javax.inject.Inject
3536

3637
@DisableCachingByDefault
37-
class Rpm extends SystemPackagingTask {
38+
@CompileDynamic
39+
abstract class Rpm extends SystemPackagingTask {
3840
@InputFile
3941
@Optional
4042
@PathSensitive(PathSensitivity.NONE)
Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,64 @@
11
package com.netflix.gradle.plugins.utils
22

3+
import groovy.transform.CompileDynamic
34
import org.gradle.api.file.FileCopyDetails
45
import org.gradle.api.file.SyncSpec
5-
import org.gradle.util.GradleVersion
66

77
/**
88
* Utility class to get the unix permission of a file.
99
*/
10+
@CompileDynamic
1011
class FilePermissionUtil {
1112

1213
/**
1314
* Get the unix permission of a file.
14-
* Gradle 8.3 introduced a new way to get the unix permission of a file.
15-
* Gradle 8.8 deprecated the old way. @see https://docs.gradle.org/8.8-rc-1/userguide/upgrading_version_8.html#unix_file_permissions_deprecated
16-
* @param details
17-
* @return
15+
*
16+
* <p>In Gradle 9.0, the new permissions API (details.permissions.toUnixNumeric()) may not correctly
17+
* detect executable bits for files, often returning 0644 instead of 0755 for executable files.
18+
* This method implements a fallback mechanism that detects when the API fails to identify executable
19+
* files and uses filesystem-level checks (File.canExecute()) to determine the correct permissions.</p>
20+
*
21+
* <p>The fallback logic is triggered when:
22+
* <ul>
23+
* <li>The file exists and is marked as executable at the filesystem level</li>
24+
* <li>But the Gradle permissions API reports no executable bits (mode & 0111 == 0)</li>
25+
* </ul>
26+
* In such cases, this method uses direct filesystem permission checks to return appropriate
27+
* Unix permission values (0755 for rwx, 0555 for r-x, etc.).</p>
28+
*
29+
* @param details FileCopyDetails containing file information and permissions
30+
* @return Unix permission as integer (e.g., 0755, 0644)
1831
*/
1932
static int getUnixPermission(FileCopyDetails details) {
20-
return isOlderThanGradle8_3() ? details.mode : details.permissions.toUnixNumeric()
33+
34+
int newApiMode = details.permissions.toUnixNumeric()
35+
36+
// Gradle 9.0 permissions API may not detect executable bits correctly
37+
// Fallback: check the actual file permissions if the API seems wrong
38+
try {
39+
if (details.file?.canExecute() && (newApiMode & 0111) == 0) {
40+
// File is executable but new API didn't detect it - use filesystem check
41+
boolean readable = details.file.canRead()
42+
boolean writable = details.file.canWrite()
43+
boolean executable = details.file.canExecute()
44+
45+
if (readable && writable && executable) {
46+
return 0755 // rwxr-xr-x
47+
} else if (readable && executable) {
48+
return 0555 // r-xr-xr-x
49+
} else {
50+
return 0644 // rw-r--r--
51+
}
52+
}
53+
} catch (Exception e) {
54+
return newApiMode
55+
}
56+
57+
return newApiMode
2158
}
2259

2360
/**
2461
* Get the unix permission of a file.
25-
* Gradle 8.3 introduced a new way to get the unix permission of a file.
26-
* Gradle 8.8 deprecated the old way. @see https://docs.gradle.org/8.8-rc-1/userguide/upgrading_version_8.html#unix_file_permissions_deprecated
2762
* @param details
2863
* @return
2964
*/
@@ -32,9 +67,7 @@ class FilePermissionUtil {
3267
return null
3368
}
3469

35-
if(isOlderThanGradle8_3()) {
36-
return copySpecInternal.fileMode
37-
} else if(copySpecInternal.filePermissions.present){
70+
if(copySpecInternal.filePermissions.present){
3871
copySpecInternal.filePermissions.get().toUnixNumeric()
3972
} else {
4073
return null
@@ -43,8 +76,6 @@ class FilePermissionUtil {
4376

4477
/**
4578
* Get the unix permission of a directory.
46-
* Gradle 8.3 introduced a new way to get the unix permission of a file.
47-
* Gradle 8.8 deprecated the old way. @see https://docs.gradle.org/8.8-rc-1/userguide/upgrading_version_8.html#unix_file_permissions_deprecated
4879
* @param copySpecInternal
4980
* @return
5081
*/
@@ -53,9 +84,7 @@ class FilePermissionUtil {
5384
return null
5485
}
5586

56-
if(isOlderThanGradle8_3()) {
57-
return copySpecInternal.dirMode
58-
} else if(copySpecInternal.dirPermissions.present){
87+
if(copySpecInternal.dirPermissions.present){
5988
copySpecInternal.dirPermissions.get().toUnixNumeric()
6089
} else {
6190
return null
@@ -64,31 +93,24 @@ class FilePermissionUtil {
6493

6594
/**
6695
* Set the unix permission of a file.
67-
* Gradle 8.3 introduced a new way to set the unix permission of a file.
6896
* @param copySpec
6997
* @param permission
7098
*/
7199
static void setFilePermission(SyncSpec copySpec, int permission) {
72-
isOlderThanGradle8_3() ?
73-
copySpec.setFileMode(permission) : copySpec.filePermissions {
100+
copySpec.filePermissions {
74101
it.unix(permission)
75102
}
76103
}
77104

78105
/**
79106
* Set the unix permission of a directory.
80-
* Gradle 8.3 introduced a new way to set the unix permission of a file.
81107
* @param copySpec
82108
* @param permission
83109
*/
84110
static void setDirPermission(SyncSpec copySpec, int permission) {
85-
isOlderThanGradle8_3() ?
86-
copySpec.setDirMode(permission) : copySpec.dirPermissions {
111+
copySpec.dirPermissions {
87112
it.unix(permission)
88113
}
89114
}
90115

91-
private static final isOlderThanGradle8_3() {
92-
return GradleVersion.current().baseVersion < GradleVersion.version('8.3').baseVersion
93-
}
94116
}

0 commit comments

Comments
 (0)