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

Add support for solc's --include-path to compile_source #133

Open
boxydog opened this issue Nov 9, 2021 · 2 comments
Open

Add support for solc's --include-path to compile_source #133

boxydog opened this issue Nov 9, 2021 · 2 comments

Comments

@boxydog
Copy link

boxydog commented Nov 9, 2021

Overview

I am trying to compile a file that has multiple includes from a node module.

My entire working command line is:

/Users/zzz/.solcx/solc-v0.8.10 solidity/contracts/MyContract.sol --combined-json abi,asm,ast,bin,bin-runtime,devdoc,function-debug,function-debug-runtime,generated-sources,generated-sources-runtime,hashes,metadata,opcodes,srcmap,srcmap-runtime,storage-layout,userdoc --include-path solidity/node_modules --base-path .

I added the --include-path and --base-path on the end to get it to work.

When I look at compile_files it doesn't have include_path, or a way to add arguments to the compile line.

Or maybe it does, and I just don't understand.

Personally, I'd add a way to add to the command line in general, so people can work around missing parameters without source modifications.

However, my use case just requires include_path. That flag can be added multiple times, see https://docs.soliditylang.org/en/v0.8.9/path-resolution.html#base-path-and-include-paths.

Specification

Add include_path list.

Or, add extra_arguments list where I can add my own arguments on the end.

@rfreis
Copy link
Contributor

rfreis commented Jul 17, 2023

Hi @boxydog , how are you ?

I've gone through the same issue as you and worked around bypassing the function. I'm sharing the code below, if it's still useful for anyone else:

from solcx.main import _compile_combined_json
compiled_fundme = _compile_combined_json(
    source_files="FundMe.sol",
    output_values=["abi", "bin"],
    base_path=os.getcwd(),
    include_path=f"{os.getcwd()}/node_modules"
)

@boxydog
Copy link
Author

boxydog commented Jul 19, 2023

@rfreis - I am well, thanks. I hope you are also well.

I am no longer working on this, so I can't comment on your solution, but good job contributing to the wider world.

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

2 participants