Skip to content

Commit

Permalink
Fix debug flavor in official build, due to cargo-make command line ch…
Browse files Browse the repository at this point in the history
…ange. (#155)
  • Loading branch information
r12f authored Nov 14, 2021
1 parent dee7746 commit 89f6222
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
19 changes: 17 additions & 2 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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]
Expand Down
13 changes: 4 additions & 9 deletions build/azure-pipeline/workflow-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 89f6222

Please sign in to comment.