Skip to content

Commit fc767ed

Browse files
committed
make sure -unknown is added for cargo calls
1 parent 16c94d9 commit fc767ed

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

scripts/build.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ function run_std_build() {
9191
if [[ ! -z $target ]]; then
9292
for val in ${target//,/ }
9393
do
94+
# if the target ends with -linux-gnu but does not have unknown, add unknown
95+
if [[ $val == *"-linux-gnu" && $val != *"unknown-linux-gnu" ]]; then
96+
val="${val/-linux-gnu/-unknown-linux-gnu}"
97+
fi
9498
new_cmd="$cmd --target=$val"
9599
log "Running $new_cmd"
96100
eval "$new_cmd"
@@ -129,7 +133,7 @@ function run_doc() {
129133
log "Building book"
130134
log "Building preprocessor for the book"
131135
cargo build --release -p errorcode_book_generator
132-
cd book && mdbook build
136+
cd book && mdbook build
133137
# test is disabled because not all files in the book exist. The pre-processor for error codes adds new files
134138
# mdbook test
135139
}
@@ -163,7 +167,7 @@ function run_test() {
163167
rm -rf "$project_location/test_results"
164168
make_dir "$project_location/test_results"
165169
# JUnit test should run via cargo-nextest
166-
log "cargo-nextest nextest run $CARGO_OPTIONS --lib --profile ci \
170+
log "cargo-nextest nextest run $CARGO_OPTIONS --lib --profile ci \
167171
mv "$project_location"/target/nextest/ci/junit.xml "$project_location"/test_results/unit_tests.xml"
168172
cargo-nextest nextest run $CARGO_OPTIONS --lib --profile ci
169173
mv "$project_location"/target/nextest/ci/junit.xml "$project_location"/test_results/unit_tests.xml
@@ -176,11 +180,11 @@ function run_test() {
176180
mv "$project_location"/target/nextest/ci/junit.xml "$project_location"/test_results/integration_tests.xml
177181

178182
# Run the std integration
179-
log "cargo-nextest nextest run $CARGO_OPTIONS --profile ci -p iec61131std --test '*' \
183+
log "cargo-nextest nextest run $CARGO_OPTIONS --profile ci -p iec61131std --test '*' \
180184
mv "$project_location"/target/nextest/ci/junit.xml "$project_location"/test_results/std_integration_tests.xml"
181185
cargo-nextest nextest run $CARGO_OPTIONS --profile ci -p iec61131std --test '*'
182186
mv "$project_location"/target/nextest/ci/junit.xml "$project_location"/test_results/std_integration_tests.xml
183-
187+
184188
else
185189
cargo test $CARGO_OPTIONS --workspace
186190
fi
@@ -222,7 +226,12 @@ function run_package_std() {
222226
do
223227
lib_dir=$OUTPUT_DIR/$val/lib
224228
make_dir $lib_dir
225-
rel_dir="$target_dir/$val"
229+
230+
# if the target ends with -linux-gnu but does not have unknown, add unknown
231+
if [[ $val == *"-linux-gnu" && $val != *"unknown-linux-gnu" ]]; then
232+
rustc_target="${val/-linux-gnu/-unknown-linux-gnu}"
233+
fi
234+
rel_dir="$target_dir/$rustc_target"
226235
if [[ $release -ne 0 ]]; then
227236
rel_dir="$rel_dir/release"
228237
else

0 commit comments

Comments
 (0)