diff --git a/.travis.yml b/.travis.yml index 0dcb188e..6abe1600 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ env: - SYS=22 - ABI="default;armeabi-v7a" - ADB_INSTALL_TIMEOUT=10 # minutes + - EMULATOR_VERSION=4969155 # ver 27.3.10. _integration_job_template: &integration_job_template stage: integration @@ -44,15 +45,19 @@ _android_job_template: &android_job_template # Accept licenses before installing components, no need to echo y for each component - yes | sdkmanager --licenses # Platform tools - - sdkmanager "emulator" "tools" "platform-tools" > /dev/null + - sdkmanager "tools" "platform-tools" > /dev/null - sdkmanager --list | head -15 + # Android emulator + - wget -q "https://dl.google.com/android/repository/emulator-linux-$EMULATOR_VERSION.zip" -O emulator.zip + - unzip -q emulator.zip -d ${ANDROID_HOME} + - rm emulator.zip # install older build tools (for emulator) - sdkmanager "build-tools;28.0.3" "build-tools;25.0.2" "platforms;android-28" "platforms;android-25" > /dev/null # Create and start emulator. - sdkmanager "system-images;android-$SYS;$ABI" > /dev/null - sdkmanager --list | head -15 - - echo no | avdmanager create avd -n test -k "system-images;android-$SYS;$ABI" - - $ANDROID_HOME/emulator/emulator -avd test -no-audio -no-window $EMU_ADDITIONAL_OPTIONS ${EMU_DEBUG} & + - echo no | avdmanager create avd --force -n test -k "system-images;android-$SYS;$ABI" + - $ANDROID_HOME/emulator/emulator -avd test -no-audio -no-window -no-boot-anim & # before_script will make project script: - integration-tests/scripts/wait-for-emulator @@ -65,7 +70,7 @@ _android_job_template: &android_job_template - cd android - npm start & - sleep 5 - - curl -s http://localhost:8081/index.bundle\?platform\=ios\&dev\=true\&minify\=false > /dev/null + - curl -s http://localhost:8081/index.bundle\?platform\=android\&dev\=true\&minify\=false > /dev/null - ./gradlew connectedAndroidTest _ios_job_template: &ios_job_template @@ -78,12 +83,7 @@ _ios_job_template: &ios_job_template xcode_destination: platform=iOS Simulator # before_script will make project script: - - cd integration-tests/Setup - - node_modules/.bin/flow check - - npm start & - - sleep 5 - - curl -s http://localhost:8081/index.bundle\?platform\=ios\&dev\=true\&minify\=false > /dev/null - - xcodebuild test -scheme Setup -project ios/Setup.xcodeproj -quiet -UseModernBuildSystem=NO -destination 'platform=iOS Simulator,name=iPhone XS Max,OS=12.1' + - integration-tests/scripts/build-ios-project integration-tests/Setup matrix: include: @@ -98,39 +98,25 @@ matrix: # Integration tests for different React Native versions - <<: *android_job_template - name: 'Integrate with RN 0.59.3 Android' - env: RN_VERSION=0.59.3 - - <<: *ios_job_template - name: 'Integrate with RN 0.59.3 iOS' - env: RN_VERSION=0.59.3 - - - <<: *android_job_template - name: 'Integrate with RN 0.59.1 Android' - env: RN_VERSION=0.59.1 - - <<: *ios_job_template - name: 'Integrate with RN 0.59.1 iOS' - env: RN_VERSION=0.59.1 - - - <<: *android_job_template - name: 'Integrate with RN 0.59.0 Android' - env: RN_VERSION=0.59.0 + name: 'Integrate with RN 0.60.5 Android' + env: RN_VERSION=0.60.5 - <<: *ios_job_template - name: 'Integrate with RN 0.59.0 iOS' - env: RN_VERSION=0.59.0 + name: 'Integrate with RN 0.60.5 iOS' + env: RN_VERSION=0.60.5 - <<: *android_job_template - name: 'Integrate with RN 0.58.3 Android' - env: RN_VERSION=0.58.3 + name: 'Integrate with RN 0.59.10 Android' + env: RN_VERSION=0.59.10 - <<: *ios_job_template - name: 'Integrate with RN 0.58.3 iOS' - env: RN_VERSION=0.58.3 + name: 'Integrate with RN 0.59.10 iOS' + env: RN_VERSION=0.59.10 - <<: *android_job_template - name: 'Integrate with RN 0.58.0 Android' - env: RN_VERSION=0.58.0 + name: 'Integrate with RN 0.58.6 Android' + env: RN_VERSION=0.58.6 - <<: *ios_job_template - name: 'Integrate with RN 0.58.0 iOS' - env: RN_VERSION=0.58.0 + name: 'Integrate with RN 0.58.6 iOS' + env: RN_VERSION=0.58.6 - <<: *android_job_template name: 'Integrate with RN 0.57.8 Android' @@ -138,37 +124,3 @@ matrix: - <<: *ios_job_template name: 'Integrate with RN 0.57.8 iOS' env: RN_VERSION=0.57.8 - - - <<: *android_job_template - name: 'Integrate with RN 0.57.5 Android' - env: RN_VERSION=0.57.5 - - <<: *ios_job_template - name: 'Integrate with RN 0.57.5 iOS' - env: RN_VERSION=0.57.5 - - - <<: *android_job_template - name: 'Integrate with RN 0.57.2 Android' - env: RN_VERSION=0.57.2 - - <<: *ios_job_template - name: 'Integrate with RN 0.57.2 iOS' - env: RN_VERSION=0.57.2 - - - <<: *android_job_template - name: 'Integrate with RN 0.56.1 Android' - env: RN_VERSION=0.56.1 - - <<: *ios_job_template - name: 'Integrate with RN 0.56.1 iOS' - env: RN_VERSION=0.56.1 - - - <<: *android_job_template - name: 'Integrate with RN 0.55.4 Android' - env: RN_VERSION=0.55.4 - - <<: *ios_job_template - name: 'Integrate with RN 0.55.4 iOS' - env: RN_VERSION=0.55.4 - - allow_failures: - - name: 'Integrate with RN 0.55.4 Android' - - name: 'Integrate with RN 0.55.4 iOS' - - name: 'Integrate with RN 0.56.1 Android' - - name: 'Integrate with RN 0.56.1 iOS' diff --git a/integration-tests/patches/rn-0.57.2/0001-minSdkVersion-bump.patch b/integration-tests/patches/rn-0.57.2/0001-minSdkVersion-bump.patch deleted file mode 100644 index df950e82..00000000 --- a/integration-tests/patches/rn-0.57.2/0001-minSdkVersion-bump.patch +++ /dev/null @@ -1,25 +0,0 @@ -From d57bb2e3a636130b2b09431f5ae3bcf057a6d4bc Mon Sep 17 00:00:00 2001 -From: Piotr Dubiel -Date: Tue, 5 Feb 2019 23:16:05 +0100 -Subject: [PATCH] minSdkVersion bump - ---- - integration-tests/Setup/android/build.gradle | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/integration-tests/Setup/android/build.gradle b/integration-tests/Setup/android/build.gradle -index 85d8f2f..27debd1 100644 ---- a/integration-tests/Setup/android/build.gradle -+++ b/integration-tests/Setup/android/build.gradle -@@ -3,7 +3,7 @@ - buildscript { - ext { - buildToolsVersion = "27.0.3" -- minSdkVersion = 16 -+ minSdkVersion = 18 - compileSdkVersion = 27 - targetSdkVersion = 26 - supportLibVersion = "27.1.1" --- -2.10.0 - diff --git a/integration-tests/patches/rn-0.57.2/0002-gradle-espresso-config.patch b/integration-tests/patches/rn-0.57.2/0002-gradle-espresso-config.patch deleted file mode 100644 index 8164cff7..00000000 --- a/integration-tests/patches/rn-0.57.2/0002-gradle-espresso-config.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/integration-tests/Setup/android/app/build.gradle b/integration-tests/Setup/android/app/build.gradle -index fe80c23..557d2c6 100644 ---- a/integration-tests/Setup/android/app/build.gradle -+++ b/integration-tests/Setup/android/app/build.gradle -@@ -103,6 +103,7 @@ android { - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" -+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - ndk { - abiFilters "armeabi-v7a", "x86" - } -@@ -140,6 +141,10 @@ dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" - implementation "com.facebook.react:react-native:+" // From node_modules -+ testImplementation 'junit:junit:4.12' -+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' -+ androidTestImplementation 'androidx.test:runner:1.1.0' -+ androidTestImplementation 'androidx.test:rules:1.1.0' - } - - // Run this once to be able to run the application with BUCK diff --git a/integration-tests/patches/rn-0.57.5/0001-minSdkVersion-bump.patch b/integration-tests/patches/rn-0.57.5/0001-minSdkVersion-bump.patch deleted file mode 100644 index df950e82..00000000 --- a/integration-tests/patches/rn-0.57.5/0001-minSdkVersion-bump.patch +++ /dev/null @@ -1,25 +0,0 @@ -From d57bb2e3a636130b2b09431f5ae3bcf057a6d4bc Mon Sep 17 00:00:00 2001 -From: Piotr Dubiel -Date: Tue, 5 Feb 2019 23:16:05 +0100 -Subject: [PATCH] minSdkVersion bump - ---- - integration-tests/Setup/android/build.gradle | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/integration-tests/Setup/android/build.gradle b/integration-tests/Setup/android/build.gradle -index 85d8f2f..27debd1 100644 ---- a/integration-tests/Setup/android/build.gradle -+++ b/integration-tests/Setup/android/build.gradle -@@ -3,7 +3,7 @@ - buildscript { - ext { - buildToolsVersion = "27.0.3" -- minSdkVersion = 16 -+ minSdkVersion = 18 - compileSdkVersion = 27 - targetSdkVersion = 26 - supportLibVersion = "27.1.1" --- -2.10.0 - diff --git a/integration-tests/patches/rn-0.57.5/0002-gradle-espresso-config.patch b/integration-tests/patches/rn-0.57.5/0002-gradle-espresso-config.patch deleted file mode 100644 index 8164cff7..00000000 --- a/integration-tests/patches/rn-0.57.5/0002-gradle-espresso-config.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/integration-tests/Setup/android/app/build.gradle b/integration-tests/Setup/android/app/build.gradle -index fe80c23..557d2c6 100644 ---- a/integration-tests/Setup/android/app/build.gradle -+++ b/integration-tests/Setup/android/app/build.gradle -@@ -103,6 +103,7 @@ android { - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" -+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - ndk { - abiFilters "armeabi-v7a", "x86" - } -@@ -140,6 +141,10 @@ dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" - implementation "com.facebook.react:react-native:+" // From node_modules -+ testImplementation 'junit:junit:4.12' -+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' -+ androidTestImplementation 'androidx.test:runner:1.1.0' -+ androidTestImplementation 'androidx.test:rules:1.1.0' - } - - // Run this once to be able to run the application with BUCK diff --git a/integration-tests/patches/rn-0.58.3/0001-minSdkVersion-bump.patch b/integration-tests/patches/rn-0.58.3/0001-minSdkVersion-bump.patch deleted file mode 100644 index 05073ac9..00000000 --- a/integration-tests/patches/rn-0.58.3/0001-minSdkVersion-bump.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 4e0eace898e0240e444bbced6a52c1c8170a9b6c Mon Sep 17 00:00:00 2001 -From: Piotr Dubiel -Date: Tue, 5 Feb 2019 21:04:33 +0100 -Subject: [PATCH] minSdkVersion bump - ---- - integration-tests/Setup/android/build.gradle | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/integration-tests/Setup/android/build.gradle b/integration-tests/Setup/android/build.gradle -index 3231b29..4c196b0 100644 ---- a/integration-tests/Setup/android/build.gradle -+++ b/integration-tests/Setup/android/build.gradle -@@ -3,7 +3,7 @@ - buildscript { - ext { - buildToolsVersion = "28.0.2" -- minSdkVersion = 16 -+ minSdkVersion = 18 - compileSdkVersion = 28 - targetSdkVersion = 27 - supportLibVersion = "28.0.0" --- -2.10.0 - diff --git a/integration-tests/patches/rn-0.58.0/0001-minSdkVersion-bump.patch b/integration-tests/patches/rn-0.58.6/0001-minSdkVersion-bump.patch similarity index 100% rename from integration-tests/patches/rn-0.58.0/0001-minSdkVersion-bump.patch rename to integration-tests/patches/rn-0.58.6/0001-minSdkVersion-bump.patch diff --git a/integration-tests/patches/rn-0.58.0/0002-gradle-espresso-config.patch b/integration-tests/patches/rn-0.58.6/0002-gradle-espresso-config.patch similarity index 100% rename from integration-tests/patches/rn-0.58.0/0002-gradle-espresso-config.patch rename to integration-tests/patches/rn-0.58.6/0002-gradle-espresso-config.patch diff --git a/integration-tests/patches/rn-0.59.1/0002-gradle-espresso-config.patch b/integration-tests/patches/rn-0.59.1/0002-gradle-espresso-config.patch deleted file mode 100644 index 2f991ea1..00000000 --- a/integration-tests/patches/rn-0.59.1/0002-gradle-espresso-config.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/integration-tests/Setup/android/app/build.gradle b/integration-tests/Setup/android/app/build.gradle -index 1f01fa3..207d72c 100644 ---- a/integration-tests/Setup/android/app/build.gradle -+++ b/integration-tests/Setup/android/app/build.gradle -@@ -103,6 +103,7 @@ android { - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" -+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - splits { - abi { -@@ -138,6 +139,10 @@ dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" - implementation "com.facebook.react:react-native:+" // From node_modules -+ testImplementation 'junit:junit:4.12' -+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' -+ androidTestImplementation 'androidx.test:runner:1.1.0' -+ androidTestImplementation 'androidx.test:rules:1.1.0' - } - - // Run this once to be able to run the application with BUCK diff --git a/integration-tests/patches/rn-0.59.0/0001-minSdkVersion-bump.patch b/integration-tests/patches/rn-0.59.10/0001-minSdkVersion-bump.patch similarity index 100% rename from integration-tests/patches/rn-0.59.0/0001-minSdkVersion-bump.patch rename to integration-tests/patches/rn-0.59.10/0001-minSdkVersion-bump.patch diff --git a/integration-tests/patches/rn-0.58.3/0002-gradle-espresso-config.patch b/integration-tests/patches/rn-0.59.10/0002-gradle-espresso-config.patch similarity index 100% rename from integration-tests/patches/rn-0.58.3/0002-gradle-espresso-config.patch rename to integration-tests/patches/rn-0.59.10/0002-gradle-espresso-config.patch diff --git a/integration-tests/patches/rn-0.59.3/0001-minSdkVersion-bump.patch b/integration-tests/patches/rn-0.59.3/0001-minSdkVersion-bump.patch deleted file mode 100644 index 909cabde..00000000 --- a/integration-tests/patches/rn-0.59.3/0001-minSdkVersion-bump.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/integration-tests/Setup/android/build.gradle b/integration-tests/Setup/android/build.gradle -index c6e7c7c..24b752a 100644 ---- a/integration-tests/Setup/android/build.gradle -+++ b/integration-tests/Setup/android/build.gradle -@@ -3,7 +3,7 @@ - buildscript { - ext { - buildToolsVersion = "28.0.3" -- minSdkVersion = 16 -+ minSdkVersion = 18 - compileSdkVersion = 28 - targetSdkVersion = 28 - supportLibVersion = "28.0.0" diff --git a/integration-tests/patches/rn-0.59.3/0002-gradle-espresso-config.patch b/integration-tests/patches/rn-0.59.3/0002-gradle-espresso-config.patch deleted file mode 100644 index 2f991ea1..00000000 --- a/integration-tests/patches/rn-0.59.3/0002-gradle-espresso-config.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/integration-tests/Setup/android/app/build.gradle b/integration-tests/Setup/android/app/build.gradle -index 1f01fa3..207d72c 100644 ---- a/integration-tests/Setup/android/app/build.gradle -+++ b/integration-tests/Setup/android/app/build.gradle -@@ -103,6 +103,7 @@ android { - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" -+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - splits { - abi { -@@ -138,6 +139,10 @@ dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" - implementation "com.facebook.react:react-native:+" // From node_modules -+ testImplementation 'junit:junit:4.12' -+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' -+ androidTestImplementation 'androidx.test:runner:1.1.0' -+ androidTestImplementation 'androidx.test:rules:1.1.0' - } - - // Run this once to be able to run the application with BUCK diff --git a/integration-tests/patches/rn-0.60.5/0000-npm-jetify.android.sh b/integration-tests/patches/rn-0.60.5/0000-npm-jetify.android.sh new file mode 100755 index 00000000..6d81f55a --- /dev/null +++ b/integration-tests/patches/rn-0.60.5/0000-npm-jetify.android.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -eo pipefail + +PROJECT_NAME=$1 + +pushd $PROJECT_NAME + npm install --save-dev jetifier + npx jetify +popd \ No newline at end of file diff --git a/integration-tests/patches/rn-0.59.1/0001-minSdkVersion-bump.patch b/integration-tests/patches/rn-0.60.5/0001-minSdkVersion-bump.patch similarity index 100% rename from integration-tests/patches/rn-0.59.1/0001-minSdkVersion-bump.patch rename to integration-tests/patches/rn-0.60.5/0001-minSdkVersion-bump.patch diff --git a/integration-tests/patches/rn-0.59.0/0002-gradle-espresso-config.patch b/integration-tests/patches/rn-0.60.5/0002-gradle-espresso-config.patch similarity index 76% rename from integration-tests/patches/rn-0.59.0/0002-gradle-espresso-config.patch rename to integration-tests/patches/rn-0.60.5/0002-gradle-espresso-config.patch index 2f991ea1..6b2d625a 100644 --- a/integration-tests/patches/rn-0.59.0/0002-gradle-espresso-config.patch +++ b/integration-tests/patches/rn-0.60.5/0002-gradle-espresso-config.patch @@ -1,8 +1,8 @@ diff --git a/integration-tests/Setup/android/app/build.gradle b/integration-tests/Setup/android/app/build.gradle -index 1f01fa3..207d72c 100644 +index a79b79d..ae47a12 100644 --- a/integration-tests/Setup/android/app/build.gradle +++ b/integration-tests/Setup/android/app/build.gradle -@@ -103,6 +103,7 @@ android { +@@ -133,6 +133,7 @@ android { targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" @@ -10,14 +10,14 @@ index 1f01fa3..207d72c 100644 } splits { abi { -@@ -138,6 +139,10 @@ dependencies { +@@ -191,6 +192,10 @@ dependencies { + implementation project(':react-native-ble-plx') implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation "com.facebook.react:react-native:+" // From node_modules + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' + androidTestImplementation 'androidx.test:runner:1.1.0' + androidTestImplementation 'androidx.test:rules:1.1.0' - } - // Run this once to be able to run the application with BUCK + if (enableHermes) { + def hermesPath = "../../node_modules/hermesvm/android/"; diff --git a/integration-tests/patches/rn-0.60.5/0003-podfile-update.patch b/integration-tests/patches/rn-0.60.5/0003-podfile-update.patch new file mode 100644 index 00000000..64404fda --- /dev/null +++ b/integration-tests/patches/rn-0.60.5/0003-podfile-update.patch @@ -0,0 +1,14 @@ +diff --git a/integration-tests/Setup/ios/Podfile b/integration-tests/Setup/ios/Podfile +index 0971cc5..f754ec2 100644 +--- a/integration-tests/Setup/ios/Podfile ++++ b/integration-tests/Setup/ios/Podfile +@@ -28,7 +28,8 @@ target 'Setup' do + pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' + + pod 'react-native-ble-plx', :path => '../node_modules/react-native-ble-plx' +- ++ pod 'react-native-ble-plx-swift', :path => '../node_modules/react-native-ble-plx' ++ + target 'SetupTests' do + inherit! :search_paths + # Pods for testing diff --git a/integration-tests/scripts/build-ios-project b/integration-tests/scripts/build-ios-project new file mode 100755 index 00000000..09da8486 --- /dev/null +++ b/integration-tests/scripts/build-ios-project @@ -0,0 +1,19 @@ +#!/bin/bash + +set -eo pipefail + +PROJECT_PATH=$1 + +pushd $PROJECT_PATH + npx flow check + npm start & + sleep 5 + curl -s http://localhost:8081/index.bundle\?platform\=ios\&dev\=true\&minify\=false > /dev/null + if [ -d ios/Setup.xcworkspace ]; then + echo "Building XCode workspace..." + xcodebuild test -scheme Setup -workspace ios/Setup.xcworkspace -quiet -UseModernBuildSystem=NO -destination 'platform=iOS Simulator,name=iPhone XS Max,OS=12.1' + else + echo "Building XCode project..." + xcodebuild test -scheme Setup -project ios/Setup.xcodeproj -quiet -UseModernBuildSystem=NO -destination 'platform=iOS Simulator,name=iPhone XS Max,OS=12.1' + fi +popd \ No newline at end of file diff --git a/integration-tests/scripts/make-project b/integration-tests/scripts/make-project index 58f032f2..ebe25c29 100755 --- a/integration-tests/scripts/make-project +++ b/integration-tests/scripts/make-project @@ -19,7 +19,10 @@ function generate-project { # install react-native-ble-plx using the github commit CURRENT_COMMIT=${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} echo "Installing react-native-ble-plx revision $CURRENT_COMMIT" - yarn add https://github.com/Polidea/react-native-ble-plx#$CURRENT_COMMIT + # Using npm here to be able to download submodules properly. + npm install --save https://github.com/Polidea/react-native-ble-plx#$CURRENT_COMMIT + # Sometimes yarn doesn't install packets locally. Be sure that everything is in place. + npm install react-native link react-native-ble-plx # and link it rm -rf ../../node_modules popd @@ -27,11 +30,13 @@ function generate-project { function patch-project { for filename in patches/common/*.patch; do + [ -e "$filename" ] || continue echo "Applying common patch - $filename" git apply "$filename" || echo Patch not applied. done for filename in patches/rn-$RN_VERSION/*.patch; do + [ -e "$filename" ] || continue echo "Applying patch specifically for $RN_VERSION - $filename" git apply "$filename" || echo Patch not applied. done @@ -61,6 +66,30 @@ function add-earl-grey { popd } +function update-pods { + PROJECT_PATH="$PROJECT_NAME/ios/" + if [ -f "$PROJECT_PATH/Podfile" ]; then + echo 'Updating Podfile dependencies...' + pushd $PROJECT_PATH + pod update + popd + fi +} + +function apply-before-scripts { + if [ "system-$TRAVIS_OS_NAME" == "system-osx" ]; then + BEFORE_SCRIPT_PATH=patches/rn-$RN_VERSION/*.ios.sh + else + BEFORE_SCRIPT_PATH=patches/rn-$RN_VERSION/*.android.sh + fi + + for filename in $BEFORE_SCRIPT_PATH; do + [ -e "$filename" ] || continue + echo "Executing $filename..." + $filename $PROJECT_NAME + done +} + pushd $DESTINATION generate-project patch-project @@ -69,7 +98,10 @@ pushd $DESTINATION if [ "system-$TRAVIS_OS_NAME" == "system-osx" ]; then add-earl-grey + update-pods else add-espresso fi + + apply-before-scripts popd