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

Change rules for selecting filename for generated files #220

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

krzkaczor
Copy link

@krzkaczor krzkaczor commented Jun 10, 2018

Closes #219.
Behaviour is now the same as for native solc.

EDITED by @r0qs:
I pushed my attempt to finish this PR. It adds the overwrite flag and tests to it.
The first commit was necessary to allow the tests to clean the .bin and .abi artifacts generated by the test cases. Before, they weren't clean after each run, and with the addition of the overwrite functionality, they would not work.

@coveralls
Copy link

coveralls commented Jun 10, 2018

Coverage Status

Coverage: 84.729% (+0.2%) from 84.537% when pulling 5b5bd05 on krzkaczor:kk/fix-cli-output-filename into c572d36 on ethereum:master.

solcjs Outdated
@@ -115,7 +115,7 @@ function writeFile (file, content) {
}

for (var contractName in output.contracts) {
var contractFileName = contractName.replace(/[:./]/g, '_');
var contractFileName = contractName.replace(/(.*):/, '');
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens in case of collisions?

@chriseth
Copy link
Contributor

solc is looking for collisions. If there are none, it uses the contract name, otherwise the fully qualified name with : and others replaced by _

@krzkaczor
Copy link
Author

@chriseth okay i can recrete this behaviour in solcjs. I just think that current state of things is wrong.

@axic
Copy link
Member

axic commented Nov 13, 2018

@krzkaczor it would be appreciated. Please also rebase :)

@r0qs
Copy link
Member

r0qs commented Sep 27, 2022

Hi, I believe we can have this. And maybe add a --overwrite flag like the one in solc to prevent the name collisions? So the behavior of solc-js and solc would be compatible.
What do you think @chriseth?

@krzkaczor would you like to finish this, or should we take it over?

@krzkaczor
Copy link
Author

@r0qs please, take over :)

@r0qs r0qs force-pushed the kk/fix-cli-output-filename branch 2 times, most recently from be371c2 to db0e88f Compare September 29, 2022 13:04
@r0qs r0qs self-assigned this Sep 29, 2022
@r0qs r0qs requested a review from cameel November 21, 2022 11:26
@r0qs r0qs force-pushed the kk/fix-cli-output-filename branch from db0e88f to 8c6f1af Compare November 21, 2022 11:37
@r0qs r0qs force-pushed the kk/fix-cli-output-filename branch from 8c6f1af to fd73c07 Compare March 20, 2023 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI generates weird names for smart contract files
6 participants