mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-17 03:05:04 +08:00
Migrate to Circle 2.0
Summary: Following the migration guide. Let's see what happens here. Closes https://github.com/facebook/react-native/pull/14955 Differential Revision: D5877682 Pulled By: hramos fbshipit-source-id: 2a40560120b5d8d28bc6c52cc5e5916fd1bba336
This commit is contained in:
committed by
Facebook Github Bot
parent
f01c73d84f
commit
8fa9984b11
@@ -1,25 +1,77 @@
|
||||
# inspired by https://github.com/Originate/guide/blob/master/android/guide/Continuous%20Integration.md
|
||||
|
||||
# SDK Built Tools revision, per http://facebook.github.io/react-native/docs/getting-started.html
|
||||
ANDROID_SDK_BUILD_TOOLS_REVISION=23.0.1
|
||||
# API Level we build with
|
||||
ANDROID_SDK_BUILD_API_LEVEL="23"
|
||||
# Minimum API Level we target, used for emulator image
|
||||
ANDROID_SDK_TARGET_API_LEVEL="19"
|
||||
# Emulator name
|
||||
AVD_NAME="testAVD"
|
||||
|
||||
function getAndroidSDK {
|
||||
export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH"
|
||||
|
||||
DEPS="$ANDROID_HOME/installed-dependencies"
|
||||
|
||||
if [ ! -e $DEPS ]; then
|
||||
echo y | android update sdk --no-ui --all --filter extra-android-m2repository
|
||||
echo no | android create avd -n testAVD -f -t android-19 --abi default/armeabi-v7a &&
|
||||
echo "Installing Android API level $ANDROID_SDK_TARGET_API_LEVEL, Google APIs, ARM EABI v7a system image..."
|
||||
sdkmanager "system-images;android-$ANDROID_SDK_TARGET_API_LEVEL;google_apis;armeabi-v7a"
|
||||
# x86 image requires hardware acceleration, which is not supported when running within the CircleCI Docker image
|
||||
# echo "Installing Android API level $ANDROID_SDK_TARGET_API_LEVEL, Google APIs, Intel x86 Atom system image..."
|
||||
# sdkmanager "system-images;android-$ANDROID_SDK_TARGET_API_LEVEL;google_apis;x86"
|
||||
echo "Installing build SDK for Android API level $ANDROID_SDK_BUILD_API_LEVEL..."
|
||||
sdkmanager "platforms;android-$ANDROID_SDK_BUILD_API_LEVEL"
|
||||
echo "Installing target SDK for Android API level $ANDROID_SDK_TARGET_API_LEVEL..."
|
||||
sdkmanager "platforms;android-$ANDROID_SDK_TARGET_API_LEVEL"
|
||||
echo "Installing SDK build tools, revision $ANDROID_SDK_BUILD_TOOLS_REVISION..."
|
||||
sdkmanager "build-tools;$ANDROID_SDK_BUILD_TOOLS_REVISION"
|
||||
echo "Installing Google APIs for Android API level $ANDROID_SDK_BUILD_API_LEVEL..."
|
||||
sdkmanager "add-ons;addon-google_apis-google-$ANDROID_SDK_BUILD_API_LEVEL"
|
||||
echo "Installing Android Support Repository"
|
||||
sdkmanager "extras;android;m2repository"
|
||||
touch $DEPS
|
||||
fi
|
||||
}
|
||||
|
||||
function getAndroidNDK {
|
||||
NDK_HOME="/opt/ndk"
|
||||
DEPS="$NDK_HOME/installed-dependencies"
|
||||
|
||||
if [ ! -e $DEPS ]; then
|
||||
cd $NDK_HOME
|
||||
echo "Downloading NDK..."
|
||||
curl -o ndk.zip https://dl.google.com/android/repository/android-ndk-r10e-linux-x86.zip
|
||||
curl -o ndk_64.zip https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip
|
||||
unzip -o -q ndk.zip
|
||||
unzip -o -q ndk_64.zip
|
||||
echo "Installed Android NDK at $NDK_HOME"
|
||||
touch $DEPS
|
||||
rm ndk.zip
|
||||
rm ndk_64.zip
|
||||
fi
|
||||
}
|
||||
|
||||
function createAVD {
|
||||
echo no | avdmanager create avd --name $AVD_NAME --force --package "system-images;android-$ANDROID_SDK_TARGET_API_LEVEL;google_apis;armeabi-v7a" --tag google_apis --abi armeabi-v7a
|
||||
}
|
||||
|
||||
function launchAVD {
|
||||
# The AVD name here should match the one created in createAVD
|
||||
# emulator64-arm -avd $AVD_NAME -no-audio -no-window -no-boot-anim -gpu off
|
||||
emulator -avd $AVD_NAME -no-audio -no-window
|
||||
}
|
||||
|
||||
function waitForAVD {
|
||||
echo "Waiting for Android Virtual Device to finish booting..."
|
||||
local bootanim=""
|
||||
export PATH=$(dirname $(dirname $(which android)))/platform-tools:$PATH
|
||||
until [[ "$bootanim" =~ "stopped" ]]; do
|
||||
sleep 5
|
||||
bootanim=$(adb -e shell getprop init.svc.bootanim 2>&1)
|
||||
echo "emulator status=$bootanim"
|
||||
echo "boot animation status=$bootanim"
|
||||
done
|
||||
echo "Android Virtual Device is ready."
|
||||
}
|
||||
|
||||
function retry3 {
|
||||
|
||||
@@ -48,11 +48,10 @@ try {
|
||||
const CLI_PACKAGE = path.join(ROOT, 'react-native-cli', 'react-native-cli-*.tgz');
|
||||
cd('..');
|
||||
|
||||
// can skip cli install for non sudo mode
|
||||
if (!argv['skip-cli-install']) {
|
||||
if (exec(`npm install -g ${CLI_PACKAGE}`).code) {
|
||||
echo('Could not install react-native-cli globally, please run in su mode');
|
||||
echo('Or with --skip-cli-install to skip this step');
|
||||
if (exec(`sudo npm install -g ${CLI_PACKAGE}`).code) {
|
||||
echo('Could not install react-native-cli globally.');
|
||||
echo('Run with --skip-cli-install to skip this step');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user