Skip to content

Commit

Permalink
Add Cargo.lock to generated files (#93)
Browse files Browse the repository at this point in the history
Without this, updating `Cargo.lock` in a way that is incompatible with
the manifest files would not cause CI to fail, despite the use of the
`--locked` option.

My theory is that when `cargo-acap-build` is invoked, directly from the
`Makefile` or indirectly via `cargo-acap-sdk`, it uses `cargo metadata`
which updates the lockfile, causing later `cargo` invocations to
succeed even when using the `--locked` option.

Disproved theories include:
- The `cargo install` commands in `install-venv.sh` update the lockfile
  (checking the diff immediately after this step reveals no diff)
- Some other action, prior to `make check_all` update the lockfile
  (checking the diff immediately before this step reveals no diff)

`Makefile`:
- Use `cargo metadata` because it reconciles the lockfile without
  updating packages as `cargo update` would, and faster and with fewer
  side effects than something like `cargo build`.
- Force the target to make sure it the lockfile is updated and the
  check works as intended, even if run before or without the other
  checks.
  • Loading branch information
apljungquist committed Sep 16, 2024
1 parent dca9309 commit 42cf92d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ check_format:
.PHONY: check_format

## Check that generated files are up to date
check_generated_files: $(patsubst %/,%/src/bindings.rs,$(wildcard crates/*-sys/))
check_generated_files: Cargo.lock $(patsubst %/,%/src/bindings.rs,$(wildcard crates/*-sys/))
git update-index -q --refresh
git --no-pager diff --exit-code HEAD -- $^
.PHONY: check_generated_files
Expand Down Expand Up @@ -256,6 +256,9 @@ fix_lint:
## Nouns
## =====

Cargo.lock: FORCE
cargo metadata > /dev/null

.devhost/constraints.txt: .devhost/requirements.txt
pip-compile \
--allow-unsafe \
Expand Down

0 comments on commit 42cf92d

Please sign in to comment.