Skip to content

Commit

Permalink
wip: combine wasmcov env setup with near env setup
Browse files Browse the repository at this point in the history
  • Loading branch information
njelich committed Jan 16, 2024
1 parent 8cbb09f commit bc92748
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build files
/target
target

# Code Editor related files
.idea
Expand Down
78 changes: 59 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cargo-near/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ near-abi = { version = "0.4.0", features = ["__chunked-entries"] }
libloading = "0.7.3"
zstd = "0.11"
atty = "0.2.14"
wasmcov = { version = "0.1" }

color-eyre = "0.6"
inquire = "0.6"
Expand All @@ -49,3 +50,4 @@ near-primitives = "0.17.0"
near-jsonrpc-client = "0.6.0"
near-jsonrpc-primitives = "0.17.0"
dunce = "1"

18 changes: 18 additions & 0 deletions cargo-near/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,24 @@ pub(crate) fn compile_project(
}
}

//#[cfg(feature = "wasmcov")]
// final env: {"CARGO_PROFILE_DEV_DEBUG": "0", "CARGO_PROFILE_DEV_LTO": "off", "CARGO_PROFILE_DEV_OPT_LEVEL": "0", "RUSTFLAGS": "-Awarnings"}
// wasmcov env: export WASMCOV_DIR=/home/noah/cargo-near-new-project-template/wasmcov; export CARGO_TARGET_DIR=/home/noah/cargo-near-new-project-template/wasmcov/target; export RUSTC_BOOTSTRAP=1; export RUSTFLAGS="-Cinstrument-coverage -Zno-profiler-runtime -Zlocation-detail=none --emit=llvm-ir -Clto=no"

// parse wasmcov setup output (which is a series of export ENVVARNAME=value commands) into the same format as final_env, then merge them
wasmcov::setup(None).expect("Failed to setup wasmcov");
// let wasmcov_env = wasmcov_env
// .split("; ")
// .map(|s| {
// let mut split = s.splitn(2, '=');
// let key = split.next().unwrap();
// let value = split.next().unwrap();
// (key, value)
// })
// .collect::<BTreeMap<_, _>>();

// println!("wasmcov_env: {:?}", wasmcov_env);

let artifacts = invoke_cargo(
"build",
[&["--message-format=json-render-diagnostics"], args].concat(),
Expand Down

0 comments on commit bc92748

Please sign in to comment.