Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Don't invalidate Cargo caches #117

Merged
merged 4 commits into from
Oct 27, 2024
Merged

fix: Don't invalidate Cargo caches #117

merged 4 commits into from
Oct 27, 2024

Conversation

apljungquist
Copy link
Contributor

No description provided.

Two root causes were identified:
* Varying `RUSTFLAGS`
* Always touching `bindings.rs`

Varying `RUSTFLAGS`
-------------------

When building for one of the non-host targets we set `RUSTFLAGS` to
help the linker find the right sysroot. This also affects artifacts
built for host in this invocation notably our build scripts and their
dependencies. When building for host again, even if we don't build our
build scripts, any mutual dependencies will see their caches
invalidated causing some recompilation. By using one target dir for
each set of flags the caches can be reused.

Always touching `bindings.rs`
-----------------------------

This caused recompilation only for `cargo doc`, presumably because the
timestamp of one of the dependencies for the artifact being compiled
had been updated. A small example that reproduces the problem is:

```sh
cargo build -p acap-build
cargo-acap-build --target aarch64 -- -p licensekey_handler
cargo build -p acap-build
```

Background
----------

In an upcoming change I want to test that two different ways of
producing EAP files are equivalent. To do so I want to build the apps
twice but with different environment variables. Since all compilation
should be cached I thought I could just run `make check_all` and
`make check_generated_files_container` twice, but it turns out many
artifacts are compiled again on the second run. Since running the tests
on the second run is unnecessary I don't think I will use this
approach, but being able to leverage the caches should make development
faster. I'm not sure about the effect on CI though because I've seen
indications that it is the build commands that are incompatible with
each other and with each of the other commands for the other target.
@apljungquist apljungquist requested a review from a team as a code owner October 27, 2024 16:48
@apljungquist apljungquist merged commit e0d2cac into main Oct 27, 2024
2 checks passed
@apljungquist apljungquist deleted the caches branch October 27, 2024 18:35
apljungquist added a commit that referenced this pull request Nov 5, 2024
* upstream/main: (48 commits)
  chore: Use workspace dependencies consistently (#126)
  fix(axevent_example): Return `Break` from signal handlers (#125)
  chore(deps): bump ghcr.io/devcontainers/features/common-utils (#124)
  feat(device-manager): Allow unsigned ACAPs (#122)
  feat(acap-build): Enable bypassing `acap-build` (#119)
  chore: streamline CI (#118)
  fix: Don't invalidate Cargo caches (#117)
  fix(acap-ssh-utils): Warn users that commands may break (#114)
  feat: Factor out `acap-build` wrapper to lib crate (#112)
  feat: Add `fleet-manager` program (#111)
  feat: Add edge storage wrapper and example (#108)
  fix: Measure apparent size (#107)
  chore(acap-logging): Bump version (#106)
  fix(cargo-acap-sdk): Set executable bits (#105)
  fix(acap-logging)!: Disable default features for env_logger (#103)
  chore: Track size of apps (#102)
  chore: Don't use clearly defined for license info (#101)
  Update rust toolchain to 1.80.1 (#100)
  fix!: Make builds reproducible in dev-container (#99)
  feat(axevent)!: Use generic callbacks and remove leak (#59)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant