Skip to content

Commit

Permalink
twoliter: add "build-all" task to Makefile.toml
Browse files Browse the repository at this point in the history
`buildsys` no longer depends on BUILDSYS_VARIANT, so it's OK to have
a task that tells cargo to build everything in the workspace.

Since various scripts might depend on the "latest" symlink created by
the "build-variant" task, create the same links in the "build-all"
task.

Signed-off-by: Ben Cressey <[email protected]>
  • Loading branch information
bcressey committed Sep 6, 2024
1 parent 572ff01 commit 350b5fb
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions twoliter/embedded/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,7 @@ if [ -d "${BUILDSYS_ROOT_DIR}/variants/target/${BUILDSYS_ARCH}" ]; then
"${BUILDSYS_ROOT_DIR}/target/${BUILDSYS_ARCH}"
fi
# Save built artifacts for each architecture. We don't set this everywhere
# because we build host tools with cargo as well, like buildsys and pubsys.
# Save built artifacts for each architecture in path just for buildsys.
export CARGO_TARGET_DIR="${BUILDSYS_ROOT_DIR}/target/${BUILDSYS_ARCH}"
# The workspace manifest directory could be under variants, or at the root.
Expand Down Expand Up @@ -830,9 +829,8 @@ if [ -z "${BUILDSYS_KIT}" ]; then
fi
export PATH="${TWOLITER_TOOLS_DIR}:${PATH}"
# Save built artifacts for each architecture. We don't set this everywhere
# because we build host tools with cargo as well, like buildsys and pubsys.
export CARGO_TARGET_DIR=${BUILDSYS_ROOT_DIR}/target/${BUILDSYS_ARCH}
# Save built artifacts for each architecture in path just for buildsys.
export CARGO_TARGET_DIR="${BUILDSYS_ROOT_DIR}/target/${BUILDSYS_ARCH}"
cargo build \
${CARGO_BUILD_ARGS} \
Expand All @@ -859,9 +857,8 @@ if [ -d "${BUILDSYS_ROOT_DIR}/variants/target/${BUILDSYS_ARCH}" ]; then
"${BUILDSYS_ROOT_DIR}/target/${BUILDSYS_ARCH}"
fi
# Save built artifacts for each architecture. We don't set this everywhere
# because we build host tools with cargo as well, like buildsys and pubsys.
export CARGO_TARGET_DIR=${BUILDSYS_ROOT_DIR}/target/${BUILDSYS_ARCH}
# Save built artifacts for each architecture in path just for buildsys.
export CARGO_TARGET_DIR="${BUILDSYS_ROOT_DIR}/target/${BUILDSYS_ARCH}"
rm -rf "${BUILDSYS_OUTPUT_DIR}/latest"
cargo build \
Expand Down Expand Up @@ -894,6 +891,28 @@ ln -snf "${BUILDSYS_VERSION_FULL}" "${OUTPUT_LOGS_DIR}/latest"
'''
]

[tasks.build-all]
dependencies = ["fetch", "build-sbkeys", "publish-setup", "cargo-metadata"]
script = [
'''
export PATH="${TWOLITER_TOOLS_DIR}:${PATH}"
# Save built artifacts for each architecture in path just for buildsys.
export CARGO_TARGET_DIR="${BUILDSYS_ROOT_DIR}/target/${BUILDSYS_ARCH}"
find "${BUILDSYS_IMAGES_DIR}" -mindepth 2 -maxdepth 2 -type l \
-name latest -exec rm {} \;
cargo build \
${CARGO_BUILD_ARGS} \
${CARGO_MAKE_CARGO_ARGS} \
${CARGO_MAKE_CARGO_LIMIT_JOBS}
find "${BUILDSYS_IMAGES_DIR}" -mindepth 2 -maxdepth 2 -type d \
-name "${BUILDSYS_VERSION_FULL}" -exec ln -srnf {} {}/../latest \;
'''
]

[tasks.check-licenses]
dependencies = ["fetch"]
script = [
Expand Down

0 comments on commit 350b5fb

Please sign in to comment.