Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

feat(solc): use relative paths and --base-path option #1317

Merged
merged 4 commits into from
May 27, 2022

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented May 27, 2022

Motivation

Closes #1315

working with paths is hard.

Ideally, we want to work with absolute paths because we resolve them in the Graph anyway and Project::root is not guaranteed to be cwd.

however, absolute/relative paths result in different solc metadata, so when invoking solc, we want to be consistent, or rather OS and local disk independent.

with 0.6.9, solc supports a --base-path option so we use that instead and also set the cwd of the solc process to Project::root.

This also introduces the CompilerInput::with_base_path function that will strip Project::root from:

  • source paths
  • output selection
  • remappings

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog

Copy link
Owner

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call

@gakonst gakonst merged commit 54f1b9d into gakonst:master May 27, 2022
mattsse added a commit to mattsse/ethers-rs that referenced this pull request May 28, 2022
* feat(solc): use relative paths and --base-path option

* chore: update CHANGELOG

* strip lib paths
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use solc --base-path to project root by default
2 participants