diff options
| author | Huan Nguyen <[email protected]> | 2025-05-15 08:31:33 -0600 |
|---|---|---|
| committer | Huan Nguyen <[email protected]> | 2025-05-15 08:31:33 -0600 |
| commit | ede5c3487ebd4cd5fbfa2309d80ceab92010d96c (patch) | |
| tree | 295320f48337a6c7bb1902d18bb656c656ee9ff4 | |
| parent | 7287ade62a51735b193bf3ec176be5db1fa23b4d (diff) | |
Try to help user if build script fails
A common error condition is that the user cloned the repo
without the --recursive option. We'll try to get the
submodules for them.
We remove the git clone command because the submodule update
should fix the issue.
| -rwxr-xr-x | scripts/build_azure_iot.sh | 5 | ||||
| -rwxr-xr-x | scripts/build_crypto.sh | 5 | ||||
| -rwxr-xr-x | scripts/build_mqtt.sh | 5 | ||||
| -rwxr-xr-x | scripts/build_mqtt_interoperability.sh | 5 | ||||
| -rwxr-xr-x | scripts/build_nxd.sh | 5 | ||||
| -rwxr-xr-x | scripts/build_nxd64.sh | 5 | ||||
| -rwxr-xr-x | scripts/build_nxd_fast.sh | 5 | ||||
| -rwxr-xr-x | scripts/build_ptp.sh | 5 | ||||
| -rwxr-xr-x | scripts/build_secure.sh | 5 | ||||
| -rwxr-xr-x | scripts/build_secure_interoperability.sh | 5 | ||||
| -rwxr-xr-x | scripts/build_web.sh | 5 | ||||
| -rw-r--r-- | scripts/func_build.sh | 15 | ||||
| -rwxr-xr-x | test/cmake/azure_iot/run.sh | 2 | ||||
| -rwxr-xr-x | test/cmake/crypto/run.sh | 2 | ||||
| -rwxr-xr-x | test/cmake/mqtt/run.sh | 3 | ||||
| -rwxr-xr-x | test/cmake/mqtt_interoperability/run.sh | 3 | ||||
| -rwxr-xr-x | test/cmake/netxduo/run.sh | 3 | ||||
| -rwxr-xr-x | test/cmake/netxduo64/run.sh | 3 | ||||
| -rwxr-xr-x | test/cmake/netxduo_fast/run.sh | 3 | ||||
| -rwxr-xr-x | test/cmake/nx_secure/run.sh | 2 | ||||
| -rwxr-xr-x | test/cmake/nx_secure_interoperability/run.sh | 2 | ||||
| -rwxr-xr-x | test/cmake/ptp/run.sh | 3 | ||||
| -rwxr-xr-x | test/cmake/web/run.sh | 3 |
23 files changed, 59 insertions, 40 deletions
diff --git a/scripts/build_azure_iot.sh b/scripts/build_azure_iot.sh index 3b7bec71..dd8ef71a 100755 --- a/scripts/build_azure_iot.sh +++ b/scripts/build_azure_iot.sh @@ -1,3 +1,6 @@ #! /bin/bash -$(dirname `realpath $0`)/../test/cmake/azure_iot/run.sh build all
\ No newline at end of file +SCRIPT_DIR=$(dirname "$(realpath "$0")") +RUN_SCRIPT="$SCRIPT_DIR/../test/cmake/azure_iot/run.sh" + +. ./func_build.sh
\ No newline at end of file diff --git a/scripts/build_crypto.sh b/scripts/build_crypto.sh index 451194ad..9e7329d5 100755 --- a/scripts/build_crypto.sh +++ b/scripts/build_crypto.sh @@ -1,3 +1,6 @@ #! /bin/bash -$(dirname `realpath $0`)/../test/cmake/crypto/run.sh build all +SCRIPT_DIR=$(dirname "$(realpath "$0")") +RUN_SCRIPT="$SCRIPT_DIR/../test/cmake/crypto/run.sh" + +. ./func_build.sh
\ No newline at end of file diff --git a/scripts/build_mqtt.sh b/scripts/build_mqtt.sh index 25014531..885b4e4c 100755 --- a/scripts/build_mqtt.sh +++ b/scripts/build_mqtt.sh @@ -1,3 +1,6 @@ #! /bin/bash -$(dirname `realpath $0`)/../test/cmake/mqtt/run.sh build all +SCRIPT_DIR=$(dirname "$(realpath "$0")") +RUN_SCRIPT="$SCRIPT_DIR/../test/cmake/mqtt/run.sh" + +. ./func_build.sh
\ No newline at end of file diff --git a/scripts/build_mqtt_interoperability.sh b/scripts/build_mqtt_interoperability.sh index 573c8e6d..a38c5d8c 100755 --- a/scripts/build_mqtt_interoperability.sh +++ b/scripts/build_mqtt_interoperability.sh @@ -1,3 +1,6 @@ #! /bin/bash -$(dirname `realpath $0`)/../test/cmake/mqtt_interoperability/run.sh build all +SCRIPT_DIR=$(dirname "$(realpath "$0")") +RUN_SCRIPT="$SCRIPT_DIR/../test/cmake/mqtt_interoperability/run.sh" + +. ./func_build.sh
\ No newline at end of file diff --git a/scripts/build_nxd.sh b/scripts/build_nxd.sh index 2512fb67..deebfa80 100755 --- a/scripts/build_nxd.sh +++ b/scripts/build_nxd.sh @@ -1,3 +1,6 @@ #! /bin/bash -$(dirname `realpath $0`)/../test/cmake/netxduo/run.sh build all +SCRIPT_DIR=$(dirname "$(realpath "$0")") +RUN_SCRIPT="$SCRIPT_DIR/../test/cmake/netxduo/run.sh" + +. ./func_build.sh
\ No newline at end of file diff --git a/scripts/build_nxd64.sh b/scripts/build_nxd64.sh index 93fc15c1..d0286ed1 100755 --- a/scripts/build_nxd64.sh +++ b/scripts/build_nxd64.sh @@ -1,3 +1,6 @@ #! /bin/bash -$(dirname `realpath $0`)/../test/cmake/netxduo64/run.sh build all +SCRIPT_DIR=$(dirname "$(realpath "$0")") +RUN_SCRIPT="$SCRIPT_DIR/../test/cmake/netxduo64/run.sh" + +. ./func_build.sh
\ No newline at end of file diff --git a/scripts/build_nxd_fast.sh b/scripts/build_nxd_fast.sh index cf9ba54d..f8dd186a 100755 --- a/scripts/build_nxd_fast.sh +++ b/scripts/build_nxd_fast.sh @@ -1,3 +1,6 @@ #! /bin/bash -$(dirname `realpath $0`)/../test/cmake/netxduo_fast/run.sh build all +SCRIPT_DIR=$(dirname "$(realpath "$0")") +RUN_SCRIPT="$SCRIPT_DIR/../test/cmake/netxduo_fast/run.sh" + +. ./func_build.sh
\ No newline at end of file diff --git a/scripts/build_ptp.sh b/scripts/build_ptp.sh index 6f715749..9471d592 100755 --- a/scripts/build_ptp.sh +++ b/scripts/build_ptp.sh @@ -1,3 +1,6 @@ #! /bin/bash -$(dirname `realpath $0`)/../test/cmake/ptp/run.sh build all +SCRIPT_DIR=$(dirname "$(realpath "$0")") +RUN_SCRIPT="$SCRIPT_DIR/../test/cmake/ptp/run.sh" + +. ./func_build.sh
\ No newline at end of file diff --git a/scripts/build_secure.sh b/scripts/build_secure.sh index d1c77c02..a969ab19 100755 --- a/scripts/build_secure.sh +++ b/scripts/build_secure.sh @@ -1,3 +1,6 @@ #! /bin/bash -$(dirname `realpath $0`)/../test/cmake/nx_secure/run.sh build all +SCRIPT_DIR=$(dirname "$(realpath "$0")") +RUN_SCRIPT="$SCRIPT_DIR/../test/cmake/nx_secure/run.sh" + +. ./func_build.sh
\ No newline at end of file diff --git a/scripts/build_secure_interoperability.sh b/scripts/build_secure_interoperability.sh index a1ada03b..d1c4f497 100755 --- a/scripts/build_secure_interoperability.sh +++ b/scripts/build_secure_interoperability.sh @@ -1,3 +1,6 @@ #! /bin/bash -$(dirname `realpath $0`)/../test/cmake/nx_secure_interoperability/run.sh build all +SCRIPT_DIR=$(dirname "$(realpath "$0")") +RUN_SCRIPT="$SCRIPT_DIR/../test/cmake/nx_secure_interoperability/run.sh" + +. ./func_build.sh
\ No newline at end of file diff --git a/scripts/build_web.sh b/scripts/build_web.sh index a8bee025..fb1ad44b 100755 --- a/scripts/build_web.sh +++ b/scripts/build_web.sh @@ -1,3 +1,6 @@ #! /bin/bash -$(dirname `realpath $0`)/../test/cmake/web/run.sh build all +SCRIPT_DIR=$(dirname "$(realpath "$0")") +RUN_SCRIPT="$SCRIPT_DIR/../test/cmake/web/run.sh" + +. ./func_build.sh
\ No newline at end of file diff --git a/scripts/func_build.sh b/scripts/func_build.sh new file mode 100644 index 00000000..d6f0d9ce --- /dev/null +++ b/scripts/func_build.sh @@ -0,0 +1,15 @@ +#! /bin/bash + +"$RUN_SCRIPT" build all + +# Common error condition is that a user clones the netxduo repo without --recursive option. +# This results in a 127 error code (run.sh file not found). +# Try to fix this under-the-hood and attempt the script again. +status=$? +if [[ $status -eq 127 ]]; then + # Get the submodules (not fetched if --recursive option was missed during clone) + (cd "$SCRIPT_DIR/.." && git submodule update --init --recursive) + # Try again to invoke the script + "$RUN_SCRIPT" build all +fi + diff --git a/test/cmake/azure_iot/run.sh b/test/cmake/azure_iot/run.sh index 266c4d13..76dac392 100755 --- a/test/cmake/azure_iot/run.sh +++ b/test/cmake/azure_iot/run.sh @@ -48,8 +48,6 @@ function test() { cd $(dirname $0) -# if threadx repo does not exist, clone it -[ -d ../threadx ] || git clone https://github.com/eclipse-threadx/threadx.git ../threadx --depth 1 result=$(sed -n "/(BUILD_CONFIGURATIONS/,/)/p" CMakeLists.txt|sed ':label;N;s/\n/ /;b label'|grep -Pzo "[a-zA-Z0-9_]*build[a-zA-Z0-9_]*\s*"| tr -d '\0') IFS=' ' diff --git a/test/cmake/crypto/run.sh b/test/cmake/crypto/run.sh index 4ce326b4..67a9d258 100755 --- a/test/cmake/crypto/run.sh +++ b/test/cmake/crypto/run.sh @@ -2,7 +2,5 @@ cd $(dirname $0) -# if threadx repo does not exist, clone it -[ -d ../threadx ] || git clone https://github.com/eclipse-threadx/threadx.git ../threadx --depth 1 [ -f .run.sh ] || ln -sf ../threadx/scripts/cmake_bootstrap.sh .run.sh ./.run.sh $* diff --git a/test/cmake/mqtt/run.sh b/test/cmake/mqtt/run.sh index 84a4eb24..3bb37f7c 100755 --- a/test/cmake/mqtt/run.sh +++ b/test/cmake/mqtt/run.sh @@ -2,8 +2,5 @@ cd $(dirname $0) -# if threadx repo does not exist, clone it -[ -d ../threadx ] || git clone https://github.com/eclipse-threadx/threadx.git ../threadx --depth 1 -[ -d ../filex ] || git clone https://github.com/eclipse-threadx/filex.git ../filex --depth 1 [ -f .run.sh ] || ln -sf ../threadx/scripts/cmake_bootstrap.sh .run.sh ./.run.sh $*
\ No newline at end of file diff --git a/test/cmake/mqtt_interoperability/run.sh b/test/cmake/mqtt_interoperability/run.sh index fa9d3829..827f8943 100755 --- a/test/cmake/mqtt_interoperability/run.sh +++ b/test/cmake/mqtt_interoperability/run.sh @@ -2,8 +2,5 @@ eclipse-threadx#!/bin/bash cd $(dirname $0) -# if threadx repo does not exist, clone it -[ -d ../threadx ] || git clone https://github.com/eclipse-threadx/threadx.git ../threadx --depth 1 -[ -d ../filex ] || git clone https://github.com/eclipse-threadx/filex.git ../filex --depth 1 [ -f .run.sh ] || ln -sf ../threadx/scripts/cmake_bootstrap.sh .run.sh CTEST_PARALLEL_LEVEL=1 ENABLE_IDLE=ON ./.run.sh $* diff --git a/test/cmake/netxduo/run.sh b/test/cmake/netxduo/run.sh index 84a4eb24..3bb37f7c 100755 --- a/test/cmake/netxduo/run.sh +++ b/test/cmake/netxduo/run.sh @@ -2,8 +2,5 @@ cd $(dirname $0) -# if threadx repo does not exist, clone it -[ -d ../threadx ] || git clone https://github.com/eclipse-threadx/threadx.git ../threadx --depth 1 -[ -d ../filex ] || git clone https://github.com/eclipse-threadx/filex.git ../filex --depth 1 [ -f .run.sh ] || ln -sf ../threadx/scripts/cmake_bootstrap.sh .run.sh ./.run.sh $*
\ No newline at end of file diff --git a/test/cmake/netxduo64/run.sh b/test/cmake/netxduo64/run.sh index ad59df07..36c1ad06 100755 --- a/test/cmake/netxduo64/run.sh +++ b/test/cmake/netxduo64/run.sh @@ -2,8 +2,5 @@ cd $(dirname $0) -# if threadx repo does not exist, clone it -[ -d ../threadx ] || git clone https://github.com/eclipse-threadx/threadx.git ../threadx --depth 1 -[ -d ../filex ] || git clone https://github.com/eclipse-threadx/filex.git ../filex --depth 1 [ -f .run.sh ] || ln -sf ../threadx/scripts/cmake_bootstrap.sh .run.sh ENABLE_64=ON ./.run.sh $* diff --git a/test/cmake/netxduo_fast/run.sh b/test/cmake/netxduo_fast/run.sh index 84a4eb24..3bb37f7c 100755 --- a/test/cmake/netxduo_fast/run.sh +++ b/test/cmake/netxduo_fast/run.sh @@ -2,8 +2,5 @@ cd $(dirname $0) -# if threadx repo does not exist, clone it -[ -d ../threadx ] || git clone https://github.com/eclipse-threadx/threadx.git ../threadx --depth 1 -[ -d ../filex ] || git clone https://github.com/eclipse-threadx/filex.git ../filex --depth 1 [ -f .run.sh ] || ln -sf ../threadx/scripts/cmake_bootstrap.sh .run.sh ./.run.sh $*
\ No newline at end of file diff --git a/test/cmake/nx_secure/run.sh b/test/cmake/nx_secure/run.sh index 5635c6ff..3bb37f7c 100755 --- a/test/cmake/nx_secure/run.sh +++ b/test/cmake/nx_secure/run.sh @@ -2,7 +2,5 @@ cd $(dirname $0) -# if threadx repo does not exist, clone it -[ -d ../threadx ] || git clone https://github.com/eclipse-threadx/threadx.git ../threadx --depth 1 [ -f .run.sh ] || ln -sf ../threadx/scripts/cmake_bootstrap.sh .run.sh ./.run.sh $*
\ No newline at end of file diff --git a/test/cmake/nx_secure_interoperability/run.sh b/test/cmake/nx_secure_interoperability/run.sh index 5635c6ff..3bb37f7c 100755 --- a/test/cmake/nx_secure_interoperability/run.sh +++ b/test/cmake/nx_secure_interoperability/run.sh @@ -2,7 +2,5 @@ cd $(dirname $0) -# if threadx repo does not exist, clone it -[ -d ../threadx ] || git clone https://github.com/eclipse-threadx/threadx.git ../threadx --depth 1 [ -f .run.sh ] || ln -sf ../threadx/scripts/cmake_bootstrap.sh .run.sh ./.run.sh $*
\ No newline at end of file diff --git a/test/cmake/ptp/run.sh b/test/cmake/ptp/run.sh index 234f43c8..1c5c4c70 100755 --- a/test/cmake/ptp/run.sh +++ b/test/cmake/ptp/run.sh @@ -2,8 +2,5 @@ cd $(dirname $0) -# if threadx repo does not exist, clone it -[ -d ../threadx ] || git clone https://github.com/eclipse-threadx/threadx.git ../threadx --depth 1 -[ -d ../filex ] || git clone https://github.com/eclipse-threadx/filex.git ../filex --depth 1 [ -f .run.sh ] || ln -sf ../threadx/scripts/cmake_bootstrap.sh .run.sh PTP_ONLY=ON ./.run.sh $* diff --git a/test/cmake/web/run.sh b/test/cmake/web/run.sh index 52d66e32..67a9d258 100755 --- a/test/cmake/web/run.sh +++ b/test/cmake/web/run.sh @@ -2,8 +2,5 @@ cd $(dirname $0) -# if threadx repo does not exist, clone it -[ -d ../threadx ] || git clone https://github.com/eclipse-threadx/threadx.git ../threadx --depth 1 -[ -d ../filex ] || git clone https://github.com/eclipse-threadx/filex.git ../filex --depth 1 [ -f .run.sh ] || ln -sf ../threadx/scripts/cmake_bootstrap.sh .run.sh ./.run.sh $* |
