diff --git a/package.json b/package.json index 13a6522b..e8c7fc6d 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,6 @@ ], "scripts": { "test": "scripts/test.sh", - "prepublish": "rm -rf android && cd react-native/android && ./gradlew publishAndroid" + "prepublish": "scripts/prepublish.sh" } } diff --git a/scripts/prepublish.sh b/scripts/prepublish.sh new file mode 100755 index 00000000..ab5c03ba --- /dev/null +++ b/scripts/prepublish.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e +set -o pipefail + +cd "$(dirname "$0")/.." + +if [ -n "$SKIP_ANDROID_BUILD" ]; then + echo 'Skipped building Android module' +else + rm -rf android + (cd react-native/android && ./gradlew publishAndroid) +fi diff --git a/scripts/test.sh b/scripts/test.sh index 2591088a..d25df2d9 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -20,7 +20,11 @@ if [[ $TARGET != *-android ]]; then # CoreSimulatorService doesn't exit when sent SIGTERM pkill -9 Simulator 2>/dev/null || true done + DESTINATION="-destination id=$(xcrun simctl list devices | grep -v unavailable | grep -m 1 -o '[0-9A-F\-]\{36\}')" + + # Inform the prepublish script to skip building Android modules. + export SKIP_ANDROID_BUILD=1 fi PACKAGER_OUT="$SRCROOT/packager_out.txt"