@@ -16,28 +16,42 @@ parameters:
1616- name : primaryBuild
1717 type : boolean
1818 default : false
19- - name : externalDeps
19+ - name : defaultFeatures
2020 type : boolean
21- default : false
21+ default : true
22+ - name : explicitFeatures
23+ type : string
24+ default : ' '
2225
2326steps :
27+ # We use two variables for feature flagging just because I'm worried about
28+ # quoting the `--features` argument, which will contain spaces.
2429- bash : |
25- if [[ $EXTERNAL_DEPS == True ]] ; then
26- features="external-harfbuzz"
30+ ffs=
31+ fts=
32+
33+ if [[ $DEFAULT_FEATURES_FLAG == False ]] ; then
34+ ffs="--no-default-features"
35+ fi
36+
37+ if [[ $EXPLICIT_FEATURES == _all_ ]] ; then
38+ ffs="--all-features"
2739 else
28- features=
40+ fts="$EXPLICIT_FEATURES"
2941 fi
3042
31- echo "Cargo features for this build: $features"
32- echo "##vso[task.setvariable variable=CARGO_FEATURES;]$features"
43+ echo "Cargo features for this build: $ffs --features=\"$fts\""
44+ echo "##vso[task.setvariable variable=CARGO_FEATURES_EXPLICIT;]$fts"
45+ echo "##vso[task.setvariable variable=CARGO_FEATURES_FLAGS;]$ffs"
3346 displayName : Set feature flags
3447 env :
35- EXTERNAL_DEPS : ${{ parameters.externalDeps }}
48+ DEFAULT_FEATURES_FLAG : ${{ parameters.defaultFeatures }}
49+ EXPLICIT_FEATURES : ${{ parameters.explicitFeatures }}
3650
37- - bash : cargo build --all --release --features="$CARGO_FEATURES " -v
51+ - bash : cargo build --all --release $CARGO_FEATURES_FLAGS --features="$CARGO_FEATURES_EXPLICIT " -v
3852 displayName : " cargo build"
3953
40- - bash : cargo test --all --release --features="$CARGO_FEATURES "
54+ - bash : cargo test --all --release $CARGO_FEATURES_FLAGS --features="$CARGO_FEATURES_EXPLICIT "
4155 displayName : " cargo test"
4256
4357# For non-canary builds, export artifacts.
0 commit comments