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

Using naersk with other Rust tools #118

Closed
ldesgoui opened this issue Oct 7, 2020 · 3 comments
Closed

Using naersk with other Rust tools #118

ldesgoui opened this issue Oct 7, 2020 · 3 comments

Comments

@ldesgoui
Copy link

ldesgoui commented Oct 7, 2020

Hello,

I find naersk very pleasant and helpful, I would love to be able to use it with other tools in order to produce different outputs, i.e. clippy, tarpaulin.
Would that be achievable?

Thanks

@nmattia
Copy link
Collaborator

nmattia commented Oct 8, 2020

Definitely. Just override the cargoTestCommands (see the configuration doc) and add (for instance) clippy to the nativeBuildInputs in override. Just make sure that doCheck is set.

@ldesgoui
Copy link
Author

ldesgoui commented Oct 8, 2020

That seems fine on some projects, but it seems like some dependencies cause trouble, namely proc_macro_hack via const-random or wasm_bindgen_macro via wasm-bindgen (build deps only?)

these derivations will be built:
  /nix/store/hkrjjj53jf9x8ps3gfch7149jz8v2wm3-rust-workspace-unknown.drv
building '/nix/store/hkrjjj53jf9x8ps3gfch7149jz8v2wm3-rust-workspace-unknown.drv'...
unpacking sources
unpacking source archive /nix/store/4a8aqp67p0n1j21w9mkqgjinhza3hzqc-source
source root is source
patching sources
configuring
[naersk] cargo_version (read): 1.48.0-nightly (9d1a4863a 2020-10-05)
[naersk] cargo_message_format (set): json-diagnostic-rendered-ansi
[naersk] cargo_release: --release
[naersk] cargo_options: -Z unstable-options
[naersk] cargo_build_options: $cargo_release -j "$NIX_BUILD_CORES" --out-dir out --message-format=$cargo_message_format
[naersk] cargo_test_options: $cargo_release -j "$NIX_BUILD_CORES"
[naersk] RUST_TEST_THREADS: 4
[naersk] cargo_bins_jq_filter: select(.reason == "compiler-artifact" and .executable != null and .profile.test == false)
[naersk] cargo_build_output_json (created): /build/tmp.xRCWxwW5Na
[naersk] crate_sources: /nix/store/2w48j9x6kf854gl6m0af7i8z7q6pl5qn-crates-io
[naersk] RUSTFLAGS:
[naersk] CARGO_BUILD_RUSTFLAGS:
[naersk] CARGO_BUILD_RUSTFLAGS (updated): --remap-path-prefix /nix/store/2w48j9x6kf854gl6m0af7i8z7q6pl5qn-crates-io=/sources
[naersk] pre-installing dep /nix/store/l1xc4v4lfsam6888vv498ywrcfm658gn-rust-workspace-deps-unknown
building
cargo -Z unstable-options build $cargo_release -j "$NIX_BUILD_CORES" --out-dir out --message-format=$cargo_message_format
   Compiling naersk-test v0.1.0 (/build/source/naersk-test)
    Finished release [optimized] target(s) in 0.14s
running tests
cargo -Z unstable-options test $cargo_release -j "$NIX_BUILD_CORES"
   Compiling naersk-test v0.1.0 (/build/source/naersk-test)
    Finished release [optimized] target(s) in 0.18s
     Running target/release/deps/wasm_test-368f5d4a0dc7dd52

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

cargo -Z unstable-options clippy $cargo_release -j "$NIX_BUILD_CORES"
    Checking const-random v0.1.11
error[E0463]: can't find crate for `proc_macro_hack`
 --> /sources/const-random-0.1.11/src/lib.rs:2:5
  |
2 | use proc_macro_hack::proc_macro_hack;
  |     ^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `const-random`

To learn more, run the command again with --verbose.
builder for '/nix/store/hkrjjj53jf9x8ps3gfch7149jz8v2wm3-rust-workspace-unknown.drv' failed with exit code 101
error: build of '/nix/store/hkrjjj53jf9x8ps3gfch7149jz8v2wm3-rust-workspace-unknown.drv' failed

It also forces clippy to run and pass on every build, I could live with it but I'd rather have it run in a different GitLab job that's allowed to fail.

@ldesgoui
Copy link
Author

I came back to this, the failure only happens when I mix and match nightly cargo and stable rust, when they're both nightly it's fine! Closing

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

No branches or pull requests

2 participants