Comments (1)
Hey there, sorry for the long silence. >_<
I have been noticing this too lately, it's pretty annoying. Unfortunately I'm not sure if there's a good "quick fix" at the moment. You can ask Nx to cache the artifacts produced by a build command, like this:
// project.json
{
"name": "my-cargo-project",
"targets": {
"build": {
"executor": "@nxrs/cargo:build",
"options": {},
"configurations": {
"dev": {
"profile": "dev"
},
"release": {
"profile": "release"
}
},
"defaultConfiguration": "local",
"outputs": ["{workspaceRoot}/target/{{ options.profile }}"]
// ^^^^^^^^^ This is the option you need to set
}
// ...
}
}
But Nx will then store a copy of your entire target/<profile>
directory in .nx/cache
for every unique build output it sees. Rust's target
directories can easily become pretty huge, and Nx keeps those cached outputs around indefinitely, so this can very quickly explode the disk space consumed by a project.
There's another problem with this too — the target/<profile>
directories include all of your workspace's compiled dependencies, so you could end up in a situation like this:
project-a
was built a long time ago but hasn't been modified since thenproject-b
was built more recently, with updated versions of some sharedcrates.io
dependenciesproject-a
does not depend onproject-b
, so that old cache forproject-a
is still considered valid- You run
nx build project-a
which is a cache hit for that older build - The newer versions of your compiled dependencies are overwritten by the older cached outputs
This is likely fixable by adding those external crates.io
dependencies to the dependency graph, but it looks like that API was not exposed until Nx v19.0.0, which just released yesterday, and I'd like to let that simmer and mature a bit before I upgrade all of my projects to it. This is on my radar though — thanks for the report!
In the meantime, this can be worked around by passing --skip-nx-cache
to any build
commands that may require a forced update. I know this is far from ideal, but cargo
does have its own caching and incremental compilation system, so it shouldn't slow your builds down too much. But it does potentially make CI/CD kind of a pain to deal with.
from cargo.
Related Issues (20)
- Warning from NX when running build, test, or lint command HOT 5
- Add support for Zola HOT 4
- Cannot compute dep graph HOT 9
- cargo.exe popup window on save (windows) HOT 1
- Project name in nx configuration file HOT 3
- target option for build seems to be ignored / not implemented HOT 4
- Local dependencies for publishable crates HOT 2
- Support for affected dependent builds? HOT 1
- TypeError: builder.addDependency is not a function HOT 1
- [bug] Cannot build when the crate and bin name differ
- Plugin defines cargo dependencies to be implicit dependencies HOT 4
- Default project configuration for libraries doesn't include build configuration
- project future and wasm support HOT 2
- [Bug Report] target handling in 0.4.0 introduces error with --configuration HOT 2
- Thank you for the plugin! Any roadmap? HOT 2
- Cannot build app HOT 6
- Not an issue but big thanks. HOT 1
- Add Tauri as part of option HOT 1
- Rust - w.a.s.m. support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo.