Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
5d26731
Fix URIs
cmichi Nov 2, 2020
806929f
Make `generate-metadata` output consistent with `build`
cmichi Nov 2, 2020
7161a6d
Add `cargo contract pack`
cmichi Nov 2, 2020
5e3f520
Return error instead of panicking
cmichi Nov 3, 2020
e7fbaba
Use blake2_hash()
cmichi Nov 3, 2020
61f7261
Replace match with if
cmichi Nov 3, 2020
6cc0a67
Pass reference instead of ownership
cmichi Nov 3, 2020
d9eb49e
Generate metadata.json and <contract>.pack
cmichi Nov 3, 2020
4d1edfa
Output .wasm, .json, .pack
cmichi Nov 3, 2020
0eb1949
Return result object instead of tuple
cmichi Nov 3, 2020
3b3206e
Get it to run with '--features test-ci-only'
cmichi Nov 3, 2020
f5450d6
Rename .pack to .contract
cmichi Nov 4, 2020
c71639f
Apply suggestions from code review
Nov 4, 2020
2aa7c96
Introduce '--skip-packing' and '--skip-metadata'
cmichi Nov 4, 2020
9fc63a0
Merge branch 'master' into cmichi-implement-cargo-pack
cmichi Nov 5, 2020
b40a82e
Apply suggestions from code review
Nov 5, 2020
bd6477f
Short help message
cmichi Nov 5, 2020
294d206
Output deprecated error for 'generate-metadata'
cmichi Nov 5, 2020
bb6f5e5
Rename pack ➜ bundle
cmichi Nov 5, 2020
8b7f712
Add 'cargo contract check' command
cmichi Nov 5, 2020
e89b6df
Optimize resulting Wasm file, except on 'check'
cmichi Nov 5, 2020
0850779
Do not make unoptimized file easily mistake for optimized one
cmichi Nov 5, 2020
4dc41b7
Get it to run with
cmichi Nov 5, 2020
85efad8
Update readme
cmichi Nov 5, 2020
44d3a85
Make unoptimized wasm not show up in target folder
cmichi Nov 5, 2020
63a7131
Update comments
cmichi Nov 5, 2020
54a7105
Remove 'generate-metadata' variants
cmichi Nov 5, 2020
73d8e94
Move dispatch logic into metadata
cmichi Nov 6, 2020
134c07a
Update src/main.rs
Nov 6, 2020
1e7dabb
Move logic into build.rs
cmichi Nov 6, 2020
c7e2ffe
Improve progress output
cmichi Nov 6, 2020
8229246
Make clippy happy
cmichi Nov 6, 2020
3500946
Fix progress output
cmichi Nov 6, 2020
d2290c4
Make it work with `--features test-ci-only`
cmichi Nov 6, 2020
f8246d3
Apply cargo fmt
cmichi Nov 6, 2020
939a19b
Always use optimized Wasm for metadata hash
cmichi Nov 6, 2020
007bb65
Always use optimized Wasm for metadata hash
cmichi Nov 6, 2020
c99bd37
Make it work with `--features test-ci-only`
cmichi Nov 6, 2020
c74e3aa
Switch naming
cmichi Nov 6, 2020
bc965c7
Fix metadata/bundle output
cmichi Nov 6, 2020
da0c4ef
Use enum `BuildArtifacts` instead of boolean flags
cmichi Nov 6, 2020
c521d61
Improve misleading fn name
cmichi Nov 6, 2020
8b2b3d2
Make it work with `--features test-ci-only`
cmichi Nov 6, 2020
d08a6f1
Make output more concise
cmichi Nov 9, 2020
9ed109b
Print optimization result at the end
cmichi Nov 9, 2020
693f987
Improve output
cmichi Nov 9, 2020
160b992
Replace 5-tuple return value with struct
cmichi Nov 9, 2020
c699312
Include hash only for bundle in metadata
cmichi Nov 9, 2020
923cded
Make it work with `--features test-ci-only`
cmichi Nov 9, 2020
fcb66c6
Fix doc test
cmichi Nov 9, 2020
c5296ad
Remove comments
cmichi Nov 9, 2020
4cdc220
Introduce wrapper type CodeHash
cmichi Nov 9, 2020
930a309
Make it work with `--features test-ci-only`
cmichi Nov 9, 2020
4403bd7
Display important results bold
cmichi Nov 9, 2020
0c596f0
Include size diff for `code-only` as well
cmichi Nov 9, 2020
d9a0f10
Remove comment
cmichi Nov 9, 2020
8737b9b
Shorten code
cmichi Nov 9, 2020
234b45f
Clone metadata for correct UI output
cmichi Nov 9, 2020
8474209
Remove unnecessary return
cmichi Nov 9, 2020
b6b9cad
Fix return type
cmichi Nov 9, 2020
1c067d9
Print metadata generation in correct step
cmichi Nov 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make unoptimized wasm not show up in target folder
  • Loading branch information
cmichi committed Nov 5, 2020
commit 44d3a8517f76fde40f1d95e47d873cf7313c4ac1
26 changes: 12 additions & 14 deletions src/cmd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,8 @@ pub(crate) fn execute(
verbosity: Option<Verbosity>,
unstable_options: UnstableFlags,
optimize_contract: bool,
) -> Result<PathBuf> {
let mut crate_metadata = CrateMetadata::collect(manifest_path)?;
if !optimize_contract {
crate_metadata.dest_wasm.set_extension("wasm.unoptimized");
}
) -> Result<Option<PathBuf>> {
let crate_metadata = CrateMetadata::collect(manifest_path)?;
execute_with_metadata(
&crate_metadata,
verbosity,
Expand All @@ -267,7 +264,7 @@ pub(crate) fn execute_with_metadata(
verbosity: Option<Verbosity>,
unstable_options: UnstableFlags,
optimize_contract: bool,
) -> Result<PathBuf> {
) -> Result<Option<PathBuf>> {
println!(
" {} {}",
"[1/3]".bold(),
Expand All @@ -280,15 +277,16 @@ pub(crate) fn execute_with_metadata(
"Post processing wasm file".bright_green().bold()
);
post_process_wasm(&crate_metadata)?;
if optimize_contract {
println!(
" {} {}",
"[3/3]".bold(),
"Optimizing wasm file".bright_green().bold()
);
optimize_wasm(&crate_metadata)?;
if !optimize_contract {
return Ok(None);
}
Ok(crate_metadata.dest_wasm.clone())
println!(
" {} {}",
"[3/3]".bold(),
"Optimizing wasm file".bright_green().bold()
);
optimize_wasm(&crate_metadata)?;
Ok(Some(crate_metadata.dest_wasm.clone()))
}

#[cfg(feature = "test-ci-only")]
Expand Down
3 changes: 2 additions & 1 deletion src/cmd/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ impl GenerateMetadataCommand {
self.verbosity,
self.unstable_options.clone(),
true,
)?;
)?
.expect("dest_wasm must exist");

let wasm = fs::read(&self.crate_metadata.dest_wasm)?;
Ok((dest_wasm, blake2_hash(wasm.as_slice())))
Expand Down
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ fn exec(cmd: Command) -> Result<String> {
verbosity.try_into()?,
unstable_options.try_into()?,
true,
)?;
)?
.expect("dest_wasm must exist");
return Ok(format!(
"\nYour contract's code is ready. You can find it here:\n{}",
dest_wasm.display().to_string().bold()
Expand Down Expand Up @@ -319,12 +320,13 @@ fn exec(cmd: Command) -> Result<String> {
unstable_options,
} => {
let manifest_path = ManifestPath::try_from(manifest_path.as_ref())?;
let _dest_unoptimized_wasm = cmd::build::execute(
let maybe_dest_wasm = cmd::build::execute(
&manifest_path,
verbosity.try_into()?,
unstable_options.try_into()?,
false,
)?;
assert!(maybe_dest_wasm.is_none(), "no dest_wasm should exist");
Ok(format!("\nYour contract's code was built successfully."))
}
Command::GenerateMetadata {
Expand Down