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

Change rust build to use the --locked flag #1978

Closed
wants to merge 1 commit into from

Conversation

frederikrothenberger
Copy link
Contributor

@frederikrothenberger frederikrothenberger commented Oct 23, 2023

This change makes builds fail if the Cargo.lock file is outdated, which prevents future PRs such as #1972.

This change makes builds fail if the `Cargo.lock` file is outdated,
which prevents future PRs such as #1972.
Copy link
Collaborator

@nmattia nmattia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks that makes a lot of sense! should it be part of the build script though? we may only want it enabled on CI

@frederikrothenberger
Copy link
Contributor Author

Thanks that makes a lot of sense! should it be part of the build script though? we may only want it enabled on CI

CI does not call cargo build directly. Should I make it an optional flag on the build script?

@nmattia
Copy link
Collaborator

nmattia commented Oct 23, 2023

@frederikrothenberger may even be able to get away with an extra step like so:

$ cargo generate-lockfile --locked

@frederikrothenberger
Copy link
Contributor Author

@frederikrothenberger may even be able to get away with an extra step like so:

$ cargo generate-lockfile --locked

I don't think this does what we want? It fails if dependencies could be updated. What we want is failure if the lock file must be updated, right?

@nmattia
Copy link
Collaborator

nmattia commented Oct 23, 2023

True, this might work:

$ cargo update --workspace --locked
    Updating crates.io index
    Updating sha2 v0.10.7 -> v0.10.8
error: the lock file /Users/nicolas/internet-identity/Cargo.lock needs to be updated but --locked was passed to prevent this
If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.

found here: https://users.rust-lang.org/t/check-if-the-cargo-lock-is-up-to-date-without-building-anything/91048/5

Either way, a separate step testing specifically for this might be clearer & less invasive

@frederikrothenberger
Copy link
Contributor Author

Superseded by #1979.

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.

2 participants