From f7582fabb28873bad9d923420b8d5701c935b832 Mon Sep 17 00:00:00 2001 From: John Smith Date: Tue, 29 Nov 2022 12:32:05 -0500 Subject: [PATCH] refactor --- scripts/{ => deprecated}/debug_main_node.sh | 0 scripts/{ => deprecated}/debug_subnode_1.sh | 0 scripts/{ => deprecated}/local-test.yml | 0 scripts/{ => deprecated}/run_2.sh | 0 scripts/{ => deprecated}/run_20.sh | 0 scripts/{ => deprecated}/run_3.sh | 0 scripts/{ => deprecated}/run_4.sh | 0 scripts/{ => deprecated}/run_8.sh | 0 scripts/{ => deprecated}/run_local_test.py | 0 {veilid-tools => scripts}/ios_build.sh | 19 +++++--- {veilid-tools => scripts}/new_android_sim.sh | 0 {veilid-tools => scripts}/new_ios_sim.sh | 0 veilid-core/ios_build.sh | 44 ------------------- .../project.pbxproj | 2 +- 14 files changed, 14 insertions(+), 51 deletions(-) rename scripts/{ => deprecated}/debug_main_node.sh (100%) rename scripts/{ => deprecated}/debug_subnode_1.sh (100%) rename scripts/{ => deprecated}/local-test.yml (100%) rename scripts/{ => deprecated}/run_2.sh (100%) rename scripts/{ => deprecated}/run_20.sh (100%) rename scripts/{ => deprecated}/run_3.sh (100%) rename scripts/{ => deprecated}/run_4.sh (100%) rename scripts/{ => deprecated}/run_8.sh (100%) rename scripts/{ => deprecated}/run_local_test.py (100%) rename {veilid-tools => scripts}/ios_build.sh (85%) rename {veilid-tools => scripts}/new_android_sim.sh (100%) rename {veilid-tools => scripts}/new_ios_sim.sh (100%) delete mode 100755 veilid-core/ios_build.sh diff --git a/scripts/debug_main_node.sh b/scripts/deprecated/debug_main_node.sh similarity index 100% rename from scripts/debug_main_node.sh rename to scripts/deprecated/debug_main_node.sh diff --git a/scripts/debug_subnode_1.sh b/scripts/deprecated/debug_subnode_1.sh similarity index 100% rename from scripts/debug_subnode_1.sh rename to scripts/deprecated/debug_subnode_1.sh diff --git a/scripts/local-test.yml b/scripts/deprecated/local-test.yml similarity index 100% rename from scripts/local-test.yml rename to scripts/deprecated/local-test.yml diff --git a/scripts/run_2.sh b/scripts/deprecated/run_2.sh similarity index 100% rename from scripts/run_2.sh rename to scripts/deprecated/run_2.sh diff --git a/scripts/run_20.sh b/scripts/deprecated/run_20.sh similarity index 100% rename from scripts/run_20.sh rename to scripts/deprecated/run_20.sh diff --git a/scripts/run_3.sh b/scripts/deprecated/run_3.sh similarity index 100% rename from scripts/run_3.sh rename to scripts/deprecated/run_3.sh diff --git a/scripts/run_4.sh b/scripts/deprecated/run_4.sh similarity index 100% rename from scripts/run_4.sh rename to scripts/deprecated/run_4.sh diff --git a/scripts/run_8.sh b/scripts/deprecated/run_8.sh similarity index 100% rename from scripts/run_8.sh rename to scripts/deprecated/run_8.sh diff --git a/scripts/run_local_test.py b/scripts/deprecated/run_local_test.py similarity index 100% rename from scripts/run_local_test.py rename to scripts/deprecated/run_local_test.py diff --git a/veilid-tools/ios_build.sh b/scripts/ios_build.sh similarity index 85% rename from veilid-tools/ios_build.sh rename to scripts/ios_build.sh index 2b1014dc..4062014b 100755 --- a/veilid-tools/ios_build.sh +++ b/scripts/ios_build.sh @@ -1,8 +1,17 @@ #!/bin/bash -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -CARGO_MANIFEST_PATH=$(python3 -c "import os; import json; print(json.loads(os.popen('cargo locate-project').read())['root'])") -CARGO_WORKSPACE_PATH=$(python3 -c "import os; import json; print(json.loads(os.popen('cargo locate-project --workspace').read())['root'])") +CARGO=`which cargo` +CARGO=${CARGO:=~/.cargo/bin/cargo} +CARGO_DIR=$(dirname $CARGO) + +WORKING_DIR=$1 +shift +echo $WORKING_DIR +pushd $WORKING_DIR >/dev/null +echo PWD: `pwd` + +CARGO_MANIFEST_PATH=$(python3 -c "import os; import json; print(json.loads(os.popen('$CARGO locate-project').read())['root'])") +CARGO_WORKSPACE_PATH=$(python3 -c "import os; import json; print(json.loads(os.popen('$CARGO locate-project --workspace').read())['root'])") TARGET_PATH=$(python3 -c "import os; print(os.path.realpath(\"$CARGO_WORKSPACE_PATH/../target\"))") PACKAGE_NAME=$1 shift @@ -42,9 +51,7 @@ do continue fi - CARGO=`which cargo` - CARGO=${CARGO:=~/.cargo/bin/cargo} - CARGO_DIR=$(dirname $CARGO) + # Choose arm64 brew for unit tests by default if we are on M1 if [ -f /opt/homebrew/bin/brew ]; then diff --git a/veilid-tools/new_android_sim.sh b/scripts/new_android_sim.sh similarity index 100% rename from veilid-tools/new_android_sim.sh rename to scripts/new_android_sim.sh diff --git a/veilid-tools/new_ios_sim.sh b/scripts/new_ios_sim.sh similarity index 100% rename from veilid-tools/new_ios_sim.sh rename to scripts/new_ios_sim.sh diff --git a/veilid-core/ios_build.sh b/veilid-core/ios_build.sh deleted file mode 100755 index 4eb08eca..00000000 --- a/veilid-core/ios_build.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -CARGO_MANIFEST_PATH=$(python -c "import os; print(os.path.realpath(\"$SCRIPTDIR/Cargo.toml\"))") -# echo CARGO_MANIFEST_PATH: $CARGO_MANIFEST_PATH - -if [ "$CONFIGURATION" == "Debug" ]; then - EXTRA_CARGO_OPTIONS="$@" -else - EXTRA_CARGO_OPTIONS="$@ --release" -fi -ARCHS=${ARCHS:=arm64} -for arch in $ARCHS -do - if [ "$arch" == "arm64" ]; then - echo arm64 - CARGO_TARGET=aarch64-apple-ios - #CARGO_TOOLCHAIN=+ios-arm64-1.57.0 - CARGO_TOOLCHAIN= - elif [ "$arch" == "x86_64" ]; then - echo x86_64 - CARGO_TARGET=x86_64-apple-ios - CARGO_TOOLCHAIN= - else - echo Unsupported ARCH: $arch - continue - fi - - CARGO=`which cargo` - CARGO=${CARGO:=~/.cargo/bin/cargo} - CARGO_DIR=$(dirname $CARGO) - - # Choose arm64 brew for unit tests by default if we are on M1 - if [ -f /opt/homebrew/bin/brew ]; then - HOMEBREW_DIR=/opt/homebrew/bin - elif [ -f /usr/local/bin/brew ]; then - HOMEBREW_DIR=/usr/local/bin - else - HOMEBREW_DIR=$(dirname `which brew`) - fi - - env -i PATH=/usr/bin:/bin:$HOMEBREW_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH -done - diff --git a/veilid-tools/src/tests/ios/veilidtools-tests/veilidtools-tests.xcodeproj/project.pbxproj b/veilid-tools/src/tests/ios/veilidtools-tests/veilidtools-tests.xcodeproj/project.pbxproj index d840dc66..17193b37 100644 --- a/veilid-tools/src/tests/ios/veilidtools-tests/veilidtools-tests.xcodeproj/project.pbxproj +++ b/veilid-tools/src/tests/ios/veilidtools-tests/veilidtools-tests.xcodeproj/project.pbxproj @@ -167,7 +167,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "../../../../ios_build.sh veilid_tools --features ios_tests,rt-tokio\n"; + shellScript = "../../../../../scripts/ios_build.sh ../../../../ veilid_tools --features ios_tests,rt-tokio\n"; }; /* End PBXShellScriptBuildPhase section */