Chris
05/03/2022, 1:24 PMAnze Sodja
05/03/2022, 1:49 PMAnze Sodja
05/03/2022, 1:51 PMChris
05/03/2022, 1:54 PMChris
05/03/2022, 1:57 PMAnze Sodja
05/03/2022, 2:29 PM--add-opens
.
I believe Groovy 4.0 for Gradle build scripts is still far away, since it will need to wait next major (8.0) and it needs some extra work and testing. It would be great if grolifant could fix that in their library if possible, but from the issue I see that is also not easy task to doChris
05/03/2022, 2:30 PM--add-opens
will work because the modules are dynamically generated. They don’t exist statically so cannot be opened in this manner.Louis Jacomet
05/03/2022, 3:45 PMLouis Jacomet
05/03/2022, 3:46 PMChris
05/03/2022, 3:46 PMAnze Sodja
05/03/2022, 5:31 PMdiff --git a/grolifant40/src/main/groovy/org/ysb33r/grolifant/api/v4/downloader/AbstractDistributionInstaller.groovy b/grolifant40/src/main/groovy/org/ysb33r/grolifant/api/v4/downloader/AbstractDistributionInstaller.groovy
index 742dfb8..2cb6b3c 100644
--- a/grolifant40/src/main/groovy/org/ysb33r/grolifant/api/v4/downloader/AbstractDistributionInstaller.groovy
+++ b/grolifant40/src/main/groovy/org/ysb33r/grolifant/api/v4/downloader/AbstractDistributionInstaller.groovy
@@ -220,9 +220,18 @@ abstract class AbstractDistributionInstaller implements DistributionInstaller {
distributionName,
projectOperations.gradleLogLevel
)
-
- this.artifactRootVerification = this.&verifyDistributionRoot as ArtifactRootVerification
- this.artifactUnpacker = this.&unpack as ArtifactUnpacker
+ this.artifactRootVerification = new ArtifactRootVerification() {
+ @Override
+ File apply(File file) {
+ return AbstractDistributionInstaller.this.verifyDistributionRoot(file)
+ }
+ }
+ this.artifactUnpacker = new ArtifactUnpacker() {
+ @Override
+ void accept(File file, File file2) {
+ AbstractDistributionInstaller.this.unpack(file, file2)
+ }
+ }
this.downloadRoot = projectOperations.map(projectOperations.gradleUserHomeDir, { File it ->
new File(it, basePath)
} as Transformer<File, File>)
So basically using normal classes instead of groovy method references that are converted to Closure.
It also works if you want to workaround it in your build, example from the Grolifant issue:
abstract class MyDistributionInstaller extends org.ysb33r.grolifant.api.v4.downloader.AbstractDistributionInstaller {
MyDistributionInstaller(
String distributionName,
String basePath,
org.ysb33r.grolifant.api.core.ProjectOperations projectOperations
) {
super(distributionName, basePath, projectOperations)
this.artifactRootVerification = new org.ysb33r.grolifant.api.v4.downloader.ArtifactRootVerification() {
@Override
File apply(File file) {
return MyDistributionInstaller.this.verifyDistributionRoot(file)
}
}
this.artifactUnpacker = new org.ysb33r.grolifant.api.v4.downloader.ArtifactUnpacker() {
@Override
void accept(File file, File file2) {
MyDistributionInstaller.this.unpack(file, file2)
}
}
}
}
tasks.register("doDownload") {
doFirst {
new MyDistributionInstaller("any", "download/", org.ysb33r.grolifant.api.core.ProjectOperations.create(project)) {
@Override
URI uriFromVersion(String version) {
return URI.create("<https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz>")
}
@Override
File verifyDistributionRoot(File distDir) {
distDir
}
}.getDistributionRoot("any").get()
}
}