From 89f62223b247fb66dede300ff918e835593e1aeb Mon Sep 17 00:00:00 2001 From: Riff Date: Sun, 14 Nov 2021 12:44:18 -0800 Subject: [PATCH] Fix debug flavor in official build, due to cargo-make command line change. (#155) --- Makefile.toml | 19 +++++++++++++++++-- build/azure-pipeline/workflow-common.yml | 13 ++++--------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index 94a1d2f..af2307d 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -24,7 +24,7 @@ set_env BUILD_TAG "${BUILD_VERSION}.${git_branch}" # Build settings BUILD_VERSION = "${CARGO_MAKE_CRATE_VERSION}" BUILD_BRANCH = { value = "", condition = { env_not_set = ["BUILD_BRANCH"] } } -BUILD_CONFIG = { source = "${CARGO_MAKE_PROFILE}", default_value = "debug", mapping = {"production" = "release" } } +BUILD_CONFIG = { source = "${CARGO_MAKE_PROFILE}", default_value = "debug", mapping = { "production" = "release" } } BUILD_TARGET = { value = "${CARGO_MAKE_RUST_TARGET_TRIPLE}", condition = { env_not_set = ["BUILD_TARGET"] } } # Cargo make doesn't support passing target as parameter yet, so we have to manually set these variables instead of reading from predefined ones. @@ -198,7 +198,22 @@ cargo install cargo-tarpaulin [tasks.build] description = "Build the program." clear = true -dependencies = ["format", "cargo-build", "make-symbol", "sign-binary"] +dependencies = ["dump-env", "format", "cargo-build", "make-symbol", "sign-binary"] + +[tasks.dump-env] +description = "Dump environment variables." +script_runner = "@duckscript" +script = ''' +echo "PROFILE = ${CARGO_MAKE_PROFILE}" +echo "BUILD_VERSION = ${BUILD_VERSION}" +echo "BUILD_BRANCH = ${BUILD_BRANCH}" +echo "BUILD_CONFIG = ${BUILD_CONFIG}" +echo "BUILD_TARGET = ${BUILD_TARGET}" +echo "BUILD_ARCH = ${BUILD_ARCH}" +echo "BUILD_OS = ${BUILD_OS}" +echo "BUILD_FLAVOR = ${BUILD_FLAVOR}" +echo "GCC_XCOMPILER_ID = ${GCC_XCOMPILER_ID}" +''' # Format the code in dev profile. [tasks.format] diff --git a/build/azure-pipeline/workflow-common.yml b/build/azure-pipeline/workflow-common.yml index 7cdf908..ee0394c 100644 --- a/build/azure-pipeline/workflow-common.yml +++ b/build/azure-pipeline/workflow-common.yml @@ -125,10 +125,8 @@ stages: displayName: Install cargo make binary on Linux/MAC condition: and(succeeded(), not(startsWith(variables['target_short'], 'windows.'))) - - script: cargo make install-build-tools + - script: cargo make -e BUILD_TARGET=$(TARGET) -- install-build-tools displayName: Install build tools - env: - BUILD_TARGET: $(TARGET) - script: cargo make install-pack-tools displayName: Install pack tools @@ -143,10 +141,9 @@ stages: # # Build # - - script: cargo make build --profile production + - script: cargo make --profile production -e BUILD_TARGET=$(TARGET) -- build displayName: Cargo make build env: - BUILD_TARGET: $(TARGET) BUILD_BRANCH: $(Build.BranchName) RNP_SIGNING_URL: $(RnpSigningURL) RNP_SIGNING_VAULT_URL: $(RnpSigningVaultURL) @@ -157,21 +154,19 @@ stages: # # Running all tests # - - bash: cargo make test --profile production + - bash: cargo make --profile production -e BUILD_TARGET=$(TARGET) -- test displayName: Cargo make test condition: and(succeeded(), eq(variables['is_cross_compile'], false)) env: - BUILD_TARGET: $(TARGET) RUST_LOG: rnp=debug RUST_BACKTRACE: full # # Pack # - - script: cargo make pack --profile production + - script: cargo make --profile production -e BUILD_TARGET=$(TARGET) -- pack displayName: Cargo make pack env: - BUILD_TARGET: $(TARGET) BUILD_BRANCH: $(Build.BranchName) RNP_SIGNING_URL: $(RnpSigningURL) RNP_SIGNING_VAULT_URL: $(RnpSigningVaultURL)