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

Setting foundryRoot in ethers-abigen-plugin is not respected #166

Closed
phoefflingdvc opened this issue Sep 13, 2024 · 4 comments · Fixed by #167
Closed

Setting foundryRoot in ethers-abigen-plugin is not respected #166

phoefflingdvc opened this issue Sep 13, 2024 · 4 comments · Fixed by #167
Labels
type: bug Confirmed bugs or reports that are very likely to be bugs.

Comments

@phoefflingdvc
Copy link

Module

Other

What version of ethers-kt are you using?

1.2.0

What version of Java you are working on?

21.0.4 (Eclipse Adoptium 21.0.4+7-LTS)

Are you developing an Android app? If yes, please provide the OS version.

No response

📝 Description

Hi,

we are using foundry for solidity development.
In order to keep our src/main folder clean and make development easier, we moved the foundry project from src/main/solidity to solidity.

Configuration:

ethersAbigen {
    foundrySource("com.example.abi") {
        foundryRoot = "solidity"
    }
}

The result is:
Failed to load foundry config: Could not find file src/main/solidity/foundry.toml

I think this is a lazy evaluation issue and could be fixed by switching to from String to Property<String>.
The RegularFile should be a RegularFileProperty and everything becomes lazy.

Example:

tasks.register("lazyRoot") {
    val foundryRoot: Property<String> = objects.property(String::class.java).convention("src/main/solidity")
    val foundryConfigFile: RegularFileProperty = objects.fileProperty().convention(foundryRoot.map { layout.projectDirectory.dir(it).file("foundry.toml") })

    foundryRoot.set("somewhere")

    doLast {
        println("foundryRoot: ${foundryRoot.get()}")
        println("foundryConfigFile: ${foundryConfigFile.get()}")
    }
}

Thanks for the project, blockchain on the JVM needs some love ...

📑 Stack trace

No response

💻 Code to reproduce the bug

build.gradle.kts

plugins {
    kotlin("jvm") version "2.0.10"
    id("io.kriptal.ethers.abigen-plugin") version "1.2.0"
}

ethersAbigen {
    foundrySource("com.example.abi") {
        foundryRoot = "solidity"
    }
}

repositories {
    mavenCentral()
}
@phoefflingdvc phoefflingdvc added the type: bug Confirmed bugs or reports that are very likely to be bugs. label Sep 13, 2024
@ArtificialPB
Copy link
Member

Thanks for reporting this issue - was able to replicate it locally and prepared a fix.

Can you try the changes in the PR to make sure it now works for you? Instructions for locally testing the plugin are documented in ethers-abigen-plugin/README.md. Happy to help you with setting it up if you encounter any issues!

@ArtificialPB
Copy link
Member

@phoefflingdvc released v1..2.1 which addresses this issue.

LMK if you find any other issues

@phoefflingdvc
Copy link
Author

Thanks for the quick fix.
I found some more issues regarding the general design of this plugin, but this is a new feature request and needs some discussions upfront.

@ArtificialPB
Copy link
Member

@phoefflingdvc you can open an issue and we can discuss it here, or we can talk directly on our Discord channel: https://discord.com/invite/rx35NzQGSb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Confirmed bugs or reports that are very likely to be bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants