Skip to content

Conversation

@axic
Copy link
Contributor

@axic axic commented Apr 20, 2017

Fixes #2897. Depends on #2729.

bool isTargetRequired(Json::Value const& _targets, string const& _target)
{
for (auto const& target: _targets)
if (target == _target)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to support sub matches, e.g. evm.assembly should be enabled by both evm.assembly, evm, evm.*, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chriseth do you have any code suggestion for doing so? E.g. requiring evm.assembly matches both the user supplied evm.assembly, evm.* and evm, without hardcoding these paths.

@axic axic force-pushed the jsonio-target-selection branch 2 times, most recently from 5255f71 to bdf2ddd Compare April 24, 2017 15:15
@axic axic force-pushed the jsonio-target-selection branch from bdf2ddd to f214c66 Compare May 2, 2017 16:05
@axic axic force-pushed the jsonio-target-selection branch from f214c66 to a2fc9b1 Compare May 30, 2017 18:12
@axic axic force-pushed the jsonio-target-selection branch from a2fc9b1 to 27ab6bf Compare June 27, 2017 08:26
@chriseth
Copy link
Contributor

What is left to do here? Can you work on this next, @axic?

@axic
Copy link
Contributor Author

axic commented Jul 13, 2017

Reviewed it again, I think the API (isTargetRequired) and the part using it is clear enough, but the actual implementation is broken, hence the tests failures.

It also doesn't support wildcards properly and shortest match.

@axic axic force-pushed the jsonio-target-selection branch from 27ab6bf to fa6f8b3 Compare July 13, 2017 23:24
@axic axic force-pushed the jsonio-target-selection branch 2 times, most recently from 5027c83 to a7aa3bc Compare July 19, 2017 11:15
@axic
Copy link
Contributor Author

axic commented Aug 10, 2017

Need to add tests for matching different combinations (evm, evm.*, evm.assembly, etc.)

},
"outputSelection": {
"fileA": {
"A": [ "abi", "devdoc", "userdoc", "evm", "metadata" ]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is annoying, one of the reasons for the failing tests was a missing comma here at the end 😕

@axic axic force-pushed the jsonio-target-selection branch 5 times, most recently from d8ac20f to 1e62516 Compare August 10, 2017 20:29
@axic axic force-pushed the jsonio-target-selection branch from a6a62b6 to dea2b70 Compare August 23, 2017 12:17
@axic axic force-pushed the jsonio-target-selection branch 3 times, most recently from 378c0d5 to c369352 Compare October 5, 2017 10:21
Changelog.md Outdated
Features:
* Parser: Better error message for unexpected trailing comma in parameter lists.
* Standard JSON: Support the ``outputSelection`` field for selective compilation of supplied sources.
* Standard JSON: Support the ``outputSelection`` field for selective compilation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move to 0.4.19

@axic axic changed the title [WIP] Support target selection in JSON I/O [WIP] Support target artifact selection in JSON I/O Oct 18, 2017
@axic axic force-pushed the jsonio-target-selection branch 2 times, most recently from bd622d1 to 64bd962 Compare October 19, 2017 01:20
@axic
Copy link
Contributor Author

axic commented Oct 19, 2017

Depends on argotorg/solc-js#159.

@axic axic force-pushed the jsonio-target-selection branch from 64bd962 to 76b9165 Compare October 19, 2017 13:10
@axic
Copy link
Contributor Author

axic commented Oct 19, 2017

@chriseth This is working now (as confirmed by circleci). It still needs support for shorcuts (e.g. evm.bytecode matching evm.bytecode.object)

@axic
Copy link
Contributor Author

axic commented Oct 19, 2017

@chriseth can you review this? it may be worth even merging it in this state, though more tests cannot hurt.

input["settings"]["optimizer"]["runs"] = 200;

// Enable all SourceUnit-level outputs.
input["settings"]["outputSelection"]["*"][""][0] = "*";
Copy link
Contributor

Choose a reason for hiding this comment

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

Does [0] automatically make it an array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Had an ugly large code before to do it manually.

return sources;
}

bool isTargetRequired(Json::Value const& _targets, string const& _target)
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps better requested than required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, but also please see my other naming suggestion below.

{
/// Special case for SourceUnit-level targets (such as AST)
if (
_targets[file].isMember("") &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you extract this condition into a function and also use it in line 129?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

129?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, 179

@axic axic changed the title [WIP] Support target artifact selection in JSON I/O Support target artifact selection in JSON I/O Nov 22, 2017
@axic axic force-pushed the jsonio-target-selection branch from c9f237f to cb9fe1d Compare November 22, 2017 13:35
@axic
Copy link
Contributor Author

axic commented Nov 22, 2017

@chriseth I think this should be ready now?

@axic axic force-pushed the jsonio-target-selection branch from cb9fe1d to 8a86249 Compare November 22, 2017 13:36
@axic axic force-pushed the jsonio-target-selection branch from 8a86249 to 9b9405e Compare November 22, 2017 16:30
@axic
Copy link
Contributor Author

axic commented Nov 22, 2017

@chriseth added two more commits to simplify/optimize it even more (last 3 commits should be squashed). Please check those two.

@chriseth
Copy link
Contributor

Looks good!

@axic axic force-pushed the jsonio-target-selection branch from 9b9405e to cb06f02 Compare November 29, 2017 16:09
@axic axic force-pushed the jsonio-target-selection branch from cb06f02 to 3576ccf Compare November 29, 2017 20:10
@axic axic merged commit ffb3a3c into develop Nov 29, 2017
@axic axic deleted the jsonio-target-selection branch November 29, 2017 21:09
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

Successfully merging this pull request may close these issues.

3 participants