Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fchitakova opened this issue Jun 5, 2024 · 3 comments
Open

Comments

@fchitakova
Copy link

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?

@NickSneo
Copy link
Contributor

Hey @fchitakova , let me check and reproduce this. Thanks for raising the issue

@bcg-mmorca
Copy link

bcg-mmorca commented Sep 11, 2024

Any update on this issue?

I'm getting the same error Unresolved reference: srcDir with web3j-solidity-gradle-plugin(version 0.5.0 also 0.5.1, and gradle 8.8).

@NickSneo
Copy link
Contributor

@shashankiitbhu Is working on a fix for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants