-
Notifications
You must be signed in to change notification settings - Fork 119
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 option to build with unmodified original manifest #51
Conversation
Suggestion from @Robbepop: uglify this option to discourage use
Also maybe print a warning:
|
# Conflicts: # src/cmd/build.rs
@Robbepop I've made this an unstable option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
#[derive(Debug, StructOpt)] | ||
struct UnstableOptions { | ||
/// Use the original manifest (Cargo.toml), do not modify for build optimizations | ||
#[structopt(long = "unstable-options", short = "Z", number_of_values = 1)] | ||
options: Vec<String>, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would this look like if we specify multiple unstable options? Each having their own -Z
or one -Z
for all? I guess we should mimic rustc
here that requires one -Z
per unstable feature usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed that should work i.e. 1 -Z
per option, I took this pattern from https://github.com/TeXitoi/structopt/blob/master/examples/keyvalue.rs#L22
By default a contract's
Cargo.toml
will be amended to optimize the final Wasm binary. At the moment that means just removing therlib
crate type if present, though in the future we may make further modifications.This PR provides the option
-Z original-manifest
(feedback on the name appreciated) to disable all modifications to theCargo.toml
: it will just build using the original file. Note that this is introduced as anunstable-option
(short-Z
)This will result in a larger final contract binary size if
rlib
is enabled, but gives full control to the user for options from theCargo.toml
. This is useful for troubleshooting e.g use-ink/ink#364.Options
In general we should try to minimize the number of options/flags we support in order to keep it as simple as possible, so this and other options should be considered through that lens.
Update: with this in mind I have added this as an
unstable-option
(short-Z
),