使用“ cargo rustc--o filename”构建时,可以从输出文件名中忽略哈希吗?

时间:2019-06-16 13:30:22

标签: rust rust-cargo

有没有办法控制货物的输出文件名? cargo rustc -- -o filename给出文件名哈希

$ mkdir output-filename
$ cd output-filename/
$ cargo init
    Created binary (application) package
$ cargo rustc -v --release -- -o filename
  Compiling output-filename v0.1.0 (/private/tmp/output-filename)
    Running `rustc --edition=2018 --crate-name output_filename src/main.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 -o filename -C metadata=c961d75f8bcf3c48 -C extra-filename=-c961d75f8bcf3c48 --out-dir /private/tmp/output-filename/target/release/deps -L dependency=/private/tmp/output-filename/target/release/deps`
warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type

warning: ignoring --out-dir flag due to -o flag

warning: ignoring -C extra-filename flag due to -o flag

    Finished release [optimized] target(s) in 0.39s
$ ls
Cargo.lock          filename-c961d75f8bcf3c48   src
Cargo.toml          filename-c961d75f8bcf3c48.d target

输出甚至建议忽略-C extra-filename=-c961d75f8bcf3c48,但事实并非如此。我可以编写脚本,例如

mv $(ls filename* | grep -E 'filename-\w+$') filename

但是我宁愿了解如何控制货物/锈蚀。

0 个答案:

没有答案