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

Make: package_version less brittle #675

Merged
merged 1 commit into from Jan 5, 2023

Conversation

markmandel
Copy link
Member

What type of PR is this?

Uncomment only one /kind <> line, press enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking
/kind bug

/kind cleanup

/kind documentation
/kind feature
/kind hotfix

What this PR does / Why we need it:

There is no easy / cross platform way to get at the local crate's version, so we are doing some grepping, since we can assume grep is installed on local machines.

This change makes the grep pipeline less brittle by looking for the name="quilkin" block first before grepping for the version details.

Which issue(s) this PR fixes:

Unblocks #670

Special notes for your reviewer:

N/A

There is no easy / cross platform way to get at the local crate's
version, so we are doing some grepping, since we can assume grep is
installed on local machines.

This change makes the grep pipeline less brittle by looking for the
`name="quilkin"` block first before grepping for the version details.

Unblocks googleforgames#670
@markmandel markmandel added kind/cleanup Refactoring code, fixing up documentation, etc area/build-tools Development tooling. labels Jan 4, 2023
@quilkin-bot
Copy link
Collaborator

Build Succeeded 🥳

Build Id: b3b0b2a9-6921-4cde-9528-f12f6179cae9

The following development images have been built, and will exist for the next 30 days:

To build this version:

git fetch git@github.com:googleforgames/quilkin.git pull/675/head:pr_675 && git checkout pr_675
cargo build

@markmandel markmandel added this to the 0.5.0 milestone Jan 4, 2023
@XAMPPRocky
Copy link
Collaborator

There is no easy / cross platform way to get at the local crate's version, so we are doing some grepping, since we can assume grep is installed on local machines.

If we're willing to depend on jq locally (I believe we already depend on it in CI). The following command works and is less brittle than grep, because it pulls the version out of the JSON metadata.

cargo metadata --no-deps | jq '.packages | map(select(.name | test("quilkin")))[0].version'

@markmandel
Copy link
Member Author

If we're willing to depend on jq locally (I believe we already depend on it in CI). The following command works and is less brittle than grep, because it pulls the version out of the JSON metadata.

I thought about this, but I wasn't feeling very comfortable assuming people had jq installed, and making it a hard dependency for building Quilkin artifacts. Whereas I feel way more comfortable with grep/awk being locally installed.

I tried to also run jq through the build image, but it got really messy really fast (also quite slow), so I figured stick with the greppy solution instead.

@XAMPPRocky XAMPPRocky merged commit 51b25a2 into googleforgames:main Jan 5, 2023
@markmandel markmandel deleted the fix/make-version branch January 5, 2023 19:11
markmandel added a commit to markmandel/quilkin that referenced this pull request Jan 5, 2023
googleforgames#675 was better than the original, but still potentially brittle if the
format of the Cargo.toml changed.

This is better than googleforgames#675, since gets the value from a `cargo` command,
so it no longer matters if the Cargo.toml changes -- everything should
still work as always, since it's a format.

We are also now only relying on `cargo` and `awk` as dev dependencies,
which is actually one less dependency than before (grep).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build-tools Development tooling. kind/cleanup Refactoring code, fixing up documentation, etc size/xs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants