Skip to content

Commit

Permalink
Make: package_version less brittle
Browse files Browse the repository at this point in the history
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
  • Loading branch information
markmandel committed Jan 4, 2023
1 parent 192376f commit ca06bb6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build/Makefile
Expand Up @@ -29,10 +29,10 @@ rust_toolchain := $(shell grep channel $(project_path)/rust-toolchain.toml | awk

# if this is a release, don't put the sha, otherwise, leave it off.
ifdef QUILKIN_RELEASE
package_version := $(shell grep version -m 1 $(project_path)/Cargo.toml | awk '{print $$3}')
package_version := $(shell grep -A1 -w "name = \"quilkin\"" $(project_path)/Cargo.toml | grep version -m 1 | awk '{print $$3}')
else
git_sha := $(shell git rev-parse --short=7 HEAD)
package_version := $(shell grep version -m 1 $(project_path)/Cargo.toml | awk '{print $$3}')-${git_sha}
package_version := $(shell grep -A1 -w "name = \"quilkin\"" $(project_path)/Cargo.toml | grep version -m 1 | awk '{print $$3}')-${git_sha}
endif

# Set this value if you want to use an external registry
Expand Down

0 comments on commit ca06bb6

Please sign in to comment.