Skip to content

Gradle SourceSets issue when configuring web3j-solidity-gradle-plugin #73

@fchitakova

Description

@fchitakova

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(screenshot_2024-06-05_at_9 52 44_480).

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions