Brendonovich / swift-rs

Call Swift functions from Rust with ease!
Apache License 2.0
246 stars 28 forks source link

`cargo publish --dry-run` fails without `--no-verify` when using `swift-rs` #32

Closed caoimhebyrne closed 1 year ago

caoimhebyrne commented 1 year ago

I have a crate which uses swift-rs, and when trying to publish to crates.io, I got this error:

$ cargo publish --dry-run
error: failed to verify package tarball

Caused by:
  Source directory was modified by build.rs during cargo publish. Build scripts should not modify anything outside of OUT_DIR.
  Added: /Users/caoimhe/Development/Personal/localauthentication-rs/target/package/localauthentication-rs-0.1.0/swift-lib/.build
    /Users/caoimhe/Development/Personal/localauthentication-rs/target/package/localauthentication-rs-0.1.0/swift-lib/.build/arm64-apple-macosx
    /Users/caoimhe/Development/Personal/localauthentication-rs/target/package/localauthentication-rs-0.1.0/swift-lib/.build/arm64-apple-macosx/build.db
    /Users/caoimhe/Development/Personal/localauthentication-rs/target/package/localauthentication-rs-0.1.0/swift-lib/.build/arm64-apple-macosx/debug
    /Users/caoimhe/Development/Personal/localauthentication-rs/target/package/localauthentication-rs-0.1.0/swift-lib/.build/arm64-apple-macosx/debug/ModuleCache
...

(like a million lines later lol)

  To proceed despite this, pass the `--no-verify` flag.

swift-rs should try and stick within OUT_DIR (if possible, I'm unsure if we can do this) when building as per the "Building a native library" example on the Cargo Book.

Otherwise, we should state in the documentation somewhere why we can't stick within OUT_DIR and anyone publishing their crates should use --no-verify.