From 350b5fb88af1b60a1c6b4fb3adcc7d936cc65936 Mon Sep 17 00:00:00 2001 From: Ben Cressey Date: Fri, 30 Aug 2024 21:48:56 +0000 Subject: [PATCH] twoliter: add "build-all" task to Makefile.toml `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 --- twoliter/embedded/Makefile.toml | 35 +++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/twoliter/embedded/Makefile.toml b/twoliter/embedded/Makefile.toml index e347a307..c9dec286 100644 --- a/twoliter/embedded/Makefile.toml +++ b/twoliter/embedded/Makefile.toml @@ -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. @@ -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} \ @@ -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 \ @@ -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 = [