solidity-gradle-plugin
solidity-gradle-plugin copied to clipboard
Gradle SourceSets issue when configuring web3j-solidity-gradle-plugin
Hi Team,
We want to use web3j-solidity-gradle-plugin(version 0.5.0) for its Solidity contracts compiling feature but we faced issues with the gradle configuration, while configurint the path, where our solidity contracts are located.
We are using Gradle 8.6 and we tried the suggested source set configuration in your documentation, but we kept getting Unresolved reference: srcDir
error.
In order to workaround the problem, we tried using allowPaths
property (instead of srcDir
) and our configuration looked like this:
sourceSets {
test {
solidity {
allowPaths = arrayListOf("src/test/resources/contracts/EvmCodes")
setOutputComponents(
org.web3j.solidity.gradle.plugin.OutputComponent.ABI,
org.web3j.solidity.gradle.plugin.OutputComponent.BIN
)
output.resourcesDir = file("out/compiledSol")
setEvmVersion(org.web3j.solidity.gradle.plugin.EVMVersion.SHANGHAI)
setOptimize(true)
setOptimizeRuns(500)
}
}
}
Unfortunately, this approach did not work too. The output directory out/compiledSol
was created with every Gradle build but it did not contain any compiled contracts, but only some config files().
We are now forced to take the workaround path by moving our contracts to default directory and not be able to set any custom sourceSets configuration.
Can you please try to help with this? Is this expected behaviour and how can we fix it?