There are a handful of things I'm not able to do because of my dependency on rustling-ontology:
cargo clippy
needs my sources to be newer than my target or won't report anything - so it goes through my dependencies.cargo tarpaulin
wants to instrument everything through a full rebuild even though I don't want coverage information on my dependencies (and running it overwrites things intarget/debug
, so thencargo build
wants to do a full rebuild too)grcov
doesn't work because there's some-sys
crate that fails to build, so I can't get code coverage from it either.
Because of this build script and other dependencies (I think serde), cargo build
takes nearly four minutes to complete.
I would ideally tell Cargo/Rust "here's a binary blob, just use that" instead of regretting every time I build.
I've tried to:
- determine if I can package up the library binaries and ask Cargo to just use them instead of rebuilding.
- Run
cargo build -p my_package
to ask Cargo to just leave whatever is built in target/ and use it. export OUT_DIR=
outside target/ - my hope was I could patch build.rs to just copy prebuilt training data in place. Cargo doesn't seem to recognize myOUT_DIR
, and it looks like the package does some heavy lifting at build time with the output.cargo vendor
and try to snip some of the dependencies. Cargo notices I'm futzing with vendored code and is rightfully upset.[patch."https://github.com/snipsco/rustling-ontology"]
I tried to spin some of the dependencies in a local copy of this package, but other packages need the data I've snipped, and at some point I realized this isn't going to work.tar cvf cached-target.tar target/
and untar the correct cache as I need it. This is the closest I've come to a working solution.- [UPDATED] Use
sccache
, but it seems like sccache is "smart" enough to require a rebuild since there's abuild.rs
associated.
I understand there are reasons why depending on precompiled libraries could break; but literally this is the same shell in the same directory of the same laptop, with the same system boot time as all the previous builds I've done; is there a release valve for this?
I'm using Rust 1.44.0-nightly 2020-04-09
cargo tree
of the relevant dependencies (discussion of it follows):
my_example_app v0.1.0
├── snips-nlu-lib v0.65.6 (git+https://github.com/snipsco/snips-nlu-rs#88a047aacf40f3316a9cbdde850ea1798af39c2a)
<some dependencies cut>
│ ├── base64 v0.10.1
│ ├── serde v1.0.106 (*)
│ ├── serde_json v1.0.51 (*)
│ ├── snips-nlu-ontology v0.67.1 (git+https://github.com/snipsco/snips-nlu-ontology?tag=0.67.1#194f99d87fa506ef1175b7dce70841c389940a29)
│ │ ├── failure v0.1.7 (*)
│ │ ├── serde v1.0.106 (*)
│ │ ├── serde_derive v1.0.106 (*)
│ │ └── serde_json v1.0.51 (*)
│ ├── snips-nlu-parsers v0.4.3 (git+https://github.com/snipsco/snips-nlu-parsers?tag=0.4.3#8cfdae50437732fcf906af90626c8db196729d30)
│ │ ├── failure v0.1.7 (*)
│ │ ├── gazetteer-entity-parser v0.8.0 (git+https://github.com/snipsco/gazetteer-entity-parser?tag=0.8.0#0e117818081782d1f295376f4cb3e1bb084e397c)
│ │ │ ├── failure v0.1.7 (*)
│ │ │ ├── fnv v1.0.6 (*)
│ │ │ ├── rmp-serde v0.13.7
│ │ │ │ ├── byteorder v1.3.4 (*)
│ │ │ │ ├── rmp v0.8.9
│ │ │ │ │ ├── byteorder v1.3.4 (*)
│ │ │ │ │ └── num-traits v0.2.11 (*)
│ │ │ │ └── serde v1.0.106 (*)
│ │ │ ├── serde v1.0.106 (*)
│ │ │ └── serde_json v1.0.51 (*)
│ │ ├── itertools v0.8.2 (*)
│ │ ├── lazy_static v1.4.0 (*)
│ │ ├── regex v1.3.6 (*)
│ │ ├── rustling-ontology v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ ├── rmp-serde v0.14.3
│ │ │ │ ├── byteorder v1.3.4 (*)
│ │ │ │ ├── rmp v0.8.9 (*)
│ │ │ │ └── serde v1.0.106 (*)
│ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892)
│ │ │ │ ├── failure v0.1.7 (*)
│ │ │ │ ├── fnv v1.0.6 (*)
│ │ │ │ ├── rustling-core v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892)
│ │ │ │ │ ├── failure v0.1.7 (*)
│ │ │ │ │ ├── regex v1.3.6 (*)
│ │ │ │ │ ├── serde v1.0.106 (*)
│ │ │ │ │ ├── smallvec v0.6.13 (*)
│ │ │ │ │ └── string-interner v0.7.1
│ │ │ │ │ └── serde v1.0.106 (*)
│ │ │ │ ├── rustling-ml v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892)
│ │ │ │ │ ├── failure v0.1.7 (*)
│ │ │ │ │ ├── fnv v1.0.6 (*)
│ │ │ │ │ └── serde v1.0.106 (*)
│ │ │ │ └── serde v1.0.106 (*)
│ │ │ ├── rustling-ontology-grammar v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ │ ├── rustling-ontology-de v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ │ │ ├── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ │ │ ├── chrono v0.4.8 (*)
│ │ │ │ │ │ ├── derive-new v0.5.8
│ │ │ │ │ │ │ ├── proc-macro2 v1.0.10 (*)
│ │ │ │ │ │ │ ├── quote v1.0.3 (*)
│ │ │ │ │ │ │ └── syn v1.0.17 (*)
│ │ │ │ │ │ ├── enum_primitive v0.1.1
│ │ │ │ │ │ │ └── num-traits v0.1.43
│ │ │ │ │ │ │ └── num-traits v0.2.11 (*)
│ │ │ │ │ │ ├── failure v0.1.7 (*)
│ │ │ │ │ │ └── vec_map v0.8.1 (*)
│ │ │ │ │ └── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ │ ├── failure v0.1.7 (*)
│ │ │ │ │ ├── log v0.4.8 (*)
│ │ │ │ │ ├── regex v1.3.6 (*)
│ │ │ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ │ │ └── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ ├── rustling-ontology-en v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ │ │ ├── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ │ └── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ ├── rustling-ontology-es v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ │ │ ├── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ │ └── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ ├── rustling-ontology-fr v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ │ │ ├── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ │ └── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ ├── rustling-ontology-it v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ │ │ ├── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ │ └── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ ├── rustling-ontology-ja v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ │ ├── regex v1.3.6 (*)
│ │ │ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ │ │ ├── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ │ └── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ ├── rustling-ontology-ko v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ │ ├── failure v0.1.7 (*)
│ │ │ │ │ ├── regex v1.3.6 (*)
│ │ │ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ │ │ ├── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ │ └── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ ├── rustling-ontology-pt v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ │ │ ├── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ │ └── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ ├── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ └── rustling-ontology-zh v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0)
│ │ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ │ ├── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ │ └── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ ├── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ ├── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ └── serde v1.0.106 (*)
│ │ │ [build-dependencies]
│ │ │ ├── rmp-serde v0.14.3 (*)
│ │ │ ├── rustling v0.9.1 (git+https://github.com/snipsco/rustling?tag=0.9.1#758074a27c339fa9e0cd477baee1f378fd0c2892) (*)
│ │ │ ├── rustling-ontology-grammar v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ ├── rustling-ontology-moment v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ ├── rustling-ontology-values v0.19.3 (git+https://github.com/snipsco/rustling-ontology?tag=0.19.3#3bb1313de543aa2a8027da9fc11c435db0cce8c0) (*)
│ │ │ └── serde v1.0.106 (*)
<more dependencies cut>
rustling-ontology
brings in rustling-ontology-grammar
, then a number of language specific crates.
The crate has a build.rs
that trains the language model for each of the available languages. I believe it then takes the output of that and uses serde to generate actual Rust code which is compiled at build time. This process alone takes a few minutes and has a number of *-sys dependencies.
Issues:
grcov
does not work with some of the sys dependencies withinrustling-ontology
; it gives me errors about compiling C code. I'm sure I could go spelunking in GitHub, but the truth is - I don't want grcov to cover anything related torustling-ontology
(or any of those subtree of packages).cargo tarpaulin
/cargo build
/cargo build --release
/cargo clippy
. Clippy requires a full rebuild (due to bugs) to provide useful information. Since I'm not going to fix any lint issues in there, I don't want Clippy to go throughrustling-ontology
and have to wait for minutes while it retrains and re-serdes. Tarpaulin also does a full rebuild, and it seems like it crosses wires with the debug build on occasion, so just getting code coverage on unit tests takes minutes. Using-p
to scope to a specific package doesn't help.
Reproduction
You'll notice that rustling-ontology
takes quite a while to build if you run:
$ git clone https://github.com/snipsco/snips-nlu-rs
$ cd snips-nlu-rs
$ cargo run --example interactive_parsing_cli data/tests/models/nlu_engine
I guess in a nutshell, I would like to have some library dependencies brought in only as pre-compiled binaries into my executable.