Skip to content

Commit

Permalink
Moved ./validator/.justfile to ./justfile-rust
Browse files Browse the repository at this point in the history
  • Loading branch information
alpeb committed Dec 4, 2023
1 parent a7397d3 commit d45f06f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
3 changes: 2 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ rs-check-dir dir *flags:
##

validator *args:
{{ just_executable() }} --justfile=validator/.justfile {{ args }}
TARGETCRATE=linkerd-network-validator \
{{ just_executable() }} --justfile=justfile-rust {{ args }}

##
## cni-plugin
Expand Down
33 changes: 18 additions & 15 deletions validator/.justfile → justfile-rust
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# This justfile includes recipes for building and packaging the validator for
# release. This file is separated so that we can invoke cargo, etc when building
# defaults. If this logic were in the top-level justfile, then these tools would
# be invoked (possibly updating Rust, etc), for unrelated targets.
# This justfile includes recipes for building and packaging the validator and
# reinitialize-pods crates for release. This file is separated so that we can
# invoke cargo, etc when building defaults. If this logic were in the main
# justfile, then these tools would be invoked (possibly updating Rust, etc),
# for unrelated targets.
#
# Users are expected to interact with this via the top-level Justfile.
# Users are expected to interact with this via the main Justfile.

crate := env_var('TARGETCRATE')

# The version name to use for packages.
version := `just-cargo crate-version linkerd-network-validator`
version := `just-cargo crate-version $TARGETCRATE`

profile := 'debug'

Expand All @@ -25,13 +28,13 @@ _cargo-target := if arch == "amd64" {
`rustup show | sed -n 's/^Default host: \(.*\)/\1/p'`
}

_target-dir := "../target" / _cargo-target / profile
_target-bin := _target-dir / "linkerd-network-validator"
_target-dir := "target" / _cargo-target / profile
_target-bin := _target-dir / crate

_package-name := "linkerd-network-validator-" + version + "-" + arch
_package-tgz := "../target/package" / _package-name + ".tgz"
_package-dir := "../target/package" / _package-name
_package-bin := _package-dir / "linkerd-network-validator"
_package-name := crate + "-" + version + "-" + arch
_package-tgz := "target/package" / _package-name + ".tgz"
_package-dir := "target/package" / _package-name
_package-bin := _package-dir / crate
_package-dbg := _package-bin + ".dbg"

_cargo := 'just-cargo profile=' + profile + ' target=' + _cargo-target
Expand All @@ -43,10 +46,10 @@ package: build
{{ _objcopy }} --only-keep-debug {{ _target-bin }} {{ _package-bin }}.dbg
{{ _objcopy }} --strip-unneeded {{ _target-bin }} {{ _package-bin }}
{{ _objcopy }} --add-gnu-debuglink={{ _package-dbg }} {{ _package-bin }}
tar -C ../target/package -czf {{ _package-tgz }} {{ _package-name }}
(cd ../target/package && {{ _shasum }} {{ _package-name }}.tgz > {{ _package-name }}.txt)
tar -C target/package -czf {{ _package-tgz }} {{ _package-name }}
(cd target/package && {{ _shasum }} {{ _package-name }}.tgz > {{ _package-name }}.txt)
@rm -rf {{ _package-dir }}

build *flags:
{{ _cargo }} fetch --locked
{{ _cargo }} build --workspace -p linkerd-network-validator {{ flags }}
{{ _cargo }} build --workspace -p {{ crate }} {{ flags }}

0 comments on commit d45f06f

Please sign in to comment.