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

removeReferencesToSrcFromDocs and copyDocsToSeperateOutput are broken #194

Open
opeik opened this issue Oct 13, 2021 · 0 comments
Open

removeReferencesToSrcFromDocs and copyDocsToSeperateOutput are broken #194

opeik opened this issue Oct 13, 2021 · 0 comments

Comments

@opeik
Copy link

opeik commented Oct 13, 2021

Hi there,

I've been playing around with naersk and I have some feedback regarding the cargo doc features.

  1. The build always fails if either removeReferencesToSrcFromDocs or copyDocsToSeperateOutput is true
hello-world-deps> [naersk] cargo_version (read): 1.55.0 (32da73ab1 2021-08-23)
hello-world-deps> [naersk] cargo_message_format (set): json-diagnostic-rendered-ansi
hello-world-deps> [naersk] cargo_release: --release
hello-world-deps> [naersk] cargo_options:
hello-world-deps> [naersk] cargo_build_options: $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format
hello-world-deps> [naersk] cargo_test_options: $cargo_release -j "$NIX_BUILD_CORES"
hello-world-deps> [naersk] RUST_TEST_THREADS: 16
hello-world-deps> [naersk] cargo_bins_jq_filter: .
hello-world-deps> [naersk] cargo_build_output_json (created): /build/tmp.DCWsYiblwo
hello-world-deps> [naersk] crate_sources: /nix/store/xb4kq9f7wc66yzywh3cp4q6inlc5lfg8-crates-io
hello-world-deps> [naersk] RUSTFLAGS:
hello-world-deps> [naersk] CARGO_BUILD_RUSTFLAGS:
hello-world-deps> [naersk] CARGO_BUILD_RUSTFLAGS (updated): --remap-path-prefix /nix/store/xb4kq9f7wc66yzywh3cp4q6inlc5lfg8-crates-io=/sources
hello-world-deps> building
hello-world-deps> cargo build $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format
hello-world-deps>    Compiling hello-world v0.1.0 (/build/dummy-src)
hello-world-deps>     Finished release [optimized] target(s) in 0.17s
hello-world-deps> running tests
hello-world-deps> cargo test $cargo_release -j "$NIX_BUILD_CORES"
hello-world-deps>    Compiling hello-world v0.1.0 (/build/dummy-src)
hello-world-deps>     Finished release [optimized] target(s) in 0.14s
hello-world-deps>      Running unittests (out/release/deps/hello_world-be61e781608f632d)
hello-world-deps> running 0 tests
hello-world-deps> test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
hello-world-deps>    Doc-tests hello-world
hello-world-deps> running 0 tests
hello-world-deps> test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
hello-world-deps> docPhase
hello-world-deps> cargo doc --offline $cargo_release -j "$NIX_BUILD_CORES"
hello-world-deps>    Compiling hello-world v0.1.0 (/build/dummy-src)
hello-world-deps>  Documenting hello-world v0.1.0 (/build/dummy-src)
hello-world-deps>     Finished release [optimized] target(s) in 0.24s
hello-world-deps> find: 'target/doc': No such file or directory

I believe this is due to this line referencing target/doc rather than out/doc.

If you disable removeReferencesToSrcFromDocs but leave copyDocsToSeperateOutput enabled, it fails in a similar way:

hello-world> [naersk] cargo_version (read): 1.55.0 (32da73ab1 2021-08-23)
hello-world> [naersk] cargo_message_format (set): json-diagnostic-rendered-ansi
hello-world> [naersk] cargo_release: --release
hello-world> [naersk] cargo_options:
hello-world> [naersk] cargo_build_options: $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format
hello-world> [naersk] cargo_test_options: $cargo_release -j "$NIX_BUILD_CORES"
hello-world> [naersk] RUST_TEST_THREADS: 16
hello-world> [naersk] cargo_bins_jq_filter: select(.reason == "compiler-artifact" and .executable != null and .profile.test == false)
hello-world> [naersk] cargo_build_output_json (created): /build/tmp.iqRXIyCEGe
hello-world> [naersk] crate_sources: /nix/store/xb4kq9f7wc66yzywh3cp4q6inlc5lfg8-crates-io
hello-world> [naersk] RUSTFLAGS:
hello-world> [naersk] CARGO_BUILD_RUSTFLAGS:
hello-world> [naersk] CARGO_BUILD_RUSTFLAGS (updated): --remap-path-prefix /nix/store/xb4kq9f7wc66yzywh3cp4q6inlc5lfg8-crates-io=/sources
hello-world> [naersk] pre-installing dep /nix/store/nafixzixdjjfgpdng78krkvl5xhiykgv-hello-world-deps-0.1.0
hello-world> building
hello-world> cargo build $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format
hello-world>    Compiling hello-world v0.1.0 (/build/source)
hello-world>     Finished release [optimized] target(s) in 0.16s
hello-world> running tests
hello-world> cargo test $cargo_release -j "$NIX_BUILD_CORES"
hello-world>    Compiling hello-world v0.1.0 (/build/source)
hello-world>     Finished release [optimized] target(s) in 0.16s
hello-world>      Running unittests (out/release/deps/hello_world-b38ddf54d5e372c7)
hello-world> running 1 test
hello-world> test tests::test_hello ... ok
hello-world> test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
hello-world> docPhase
hello-world> cargo doc --offline $cargo_release -j "$NIX_BUILD_CORES"
hello-world>  Documenting hello-world v0.1.0 (/build/source)
hello-world>     Finished release [optimized] target(s) in 0.30s
hello-world> installing
hello-world> [naersk] Using file /build/tmp.iqRXIyCEGe to retrieve build (executable) products
hello-world> [naersk] found executable hello-world -> /nix/store/jigcsq0b2irpzsbyps9bixb76iq3zwyj-hello-world-0.1.0/bin/hello-world
hello-world> cp: cannot stat 'target/doc': No such file or directory

Again, I believe this is failing here due to referencing target/doc instead of out/doc.

  1. The doDocFail doesn't set RUSTDOCFLAGS to -D warnings as I expected

This one is subjective but I don't think I've ever seen cargo doc fail outright except when -D warnings is set. A failOnWarnings flag which sets both RUSTFLAGS and RUSTDOCFLAGS to -D warnings would be great.

  1. The docs don't appear to be copied to result/doc

Maybe I'm missing something but I figured that was what copyDocsToSeperateOutput implied.

@opeik opeik changed the title Broken cargo doc option removeReferencesToSrcFromDocs and copyDocsToSeperateOutput are broken Oct 13, 2021
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

1 participant