jamiebrynes7 / spatialos-sdk-rs

Rust integration of the SpatialOS C API bindings
Apache License 2.0
21 stars 6 forks source link

[WIP] downloading dependencies at build time #167

Closed Chris-Nicholls closed 4 years ago

Chris-Nicholls commented 4 years ago

Requiring the environment variable "SPATIAL_LIBS_DIR" has been causing me a bunch of issues (cargo check can't be run by IDEs for example).

This change has helped me with my setup significantly - it downloads the dependencies when spatial-os-sdk is built, and links to them in that directory. It also doens't redownload every time which significantly helps compile times.

Not comprehensive, but wanted to see what you thought of doing it this way.

codecov[bot] commented 4 years ago

Codecov Report

Merging #167 into master will increase coverage by 1.92%. The diff coverage is 40.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #167      +/-   ##
==========================================
+ Coverage   19.96%   21.89%   +1.92%     
==========================================
  Files          41       41              
  Lines        4217     4188      -29     
==========================================
+ Hits          842      917      +75     
+ Misses       3375     3271     -104     
Impacted Files Coverage Δ
cargo-spatial/src/download.rs 49.01% <40.00%> (+49.01%) :arrow_up:
cargo-spatial/src/local.rs 0.00% <0.00%> (ø)
cargo-spatial/src/config.rs 0.00% <0.00%> (ø)
cargo-spatial/src/errors.rs 0.00% <0.00%> (ø)
project-example/src/main.rs 0.00% <0.00%> (ø)
cargo-spatial/src/codegen.rs 0.00% <0.00%> (ø)
spatialos-sdk/src/worker/parameters.rs 5.15% <0.00%> (+0.02%) :arrow_up:
spatialos-sdk/src/worker/schema/primitives.rs 33.87% <0.00%> (+0.80%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 51154b9...b49697b. Read the comment docs.

jamiebrynes7 commented 4 years ago

I think we could probably merge the two approaches?

First look for a lib in SPATIAL_LIB_DIR (or possibly specified by Spatial.toml?), then try to download the libraries.

This way you get the benefit of:

There's also scope for being more intelligent about partial downloads for the platform you are building for (rather than everything).

Thoughts @Chris-Nicholls?

jamiebrynes7 commented 4 years ago

Merged #168 for downloading the packages at build time if SPATIAL_LIB_DIR isn't set.