Skip to content

Commit

Permalink
Gradle 8 compatability
Browse files Browse the repository at this point in the history
This applies the essential fixes needed to upgrade to Gradle 8.6 but
continues to use Gradle 7.6 in the plugin build system. This provides
for Gradle 8.x compatability.

Signed-off-by: Danno Ferrin <[email protected]>
  • Loading branch information
shemnon committed Apr 8, 2024
1 parent 1d912f4 commit 6295db1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package org.web3j.solidity.gradle.plugin
import groovy.transform.CompileStatic
import org.gradle.api.Action
import org.gradle.api.file.SourceDirectorySet
import org.gradle.api.internal.file.SourceDirectorySetFactory
import org.gradle.api.model.ObjectFactory
import org.gradle.api.reflect.HasPublicType
import org.gradle.api.reflect.TypeOf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ class SolidityPlugin implements Plugin<Project> {
def defaultOutputDir = new File(project.buildDir, "resources/$sourceSet.name/$NAME")

soliditySourceSet.solidity.srcDir(defaultSrcDir)
soliditySourceSet.solidity.outputDir = defaultOutputDir
try {
soliditySourceSet.solidity.destinationDirectory = defaultOutputDir
} catch (ReadOnlyPropertyException ignored) {
//TODO delete this catch block and unwrap the try block after Gradle 8 migration
soliditySourceSet.solidity.outputDir = defaultOutputDir
}

sourceSet.allJava.source(soliditySourceSet.solidity)
sourceSet.allSource.source(soliditySourceSet.solidity)
Expand Down Expand Up @@ -122,7 +127,7 @@ class SolidityPlugin implements Plugin<Project> {
compileTask.evmVersion = project.solidity.evmVersion
compileTask.allowPaths = project.solidity.allowPaths
compileTask.ignoreMissing = project.solidity.ignoreMissing
compileTask.outputs.dir(soliditySourceSet.solidity.outputDir)
compileTask.outputs.dir(soliditySourceSet.solidity.destinationDirectory)
compileTask.description = "Compiles $sourceSet.name Solidity source."

if (project.solidity.resolvePackages) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ class SolidityPluginTest {
}
}
}
tasks.named("jar").configure { dependsOn("compileSolidity") }
"""

def success = build()
Expand Down

0 comments on commit 6295db1

Please sign in to comment.