Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for multiple RN version in test project + updated example projects #591

Merged
merged 8 commits into from
Mar 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ matrix:
os: osx
osx_image: xcode9
env:
- REACT_NATIVE_VERSION=0.44.2
- REACT_NATIVE_VERSION=0.53.3
install:
- ./scripts/install.ios.sh
script:
Expand Down
130 changes: 65 additions & 65 deletions detox/test/package.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
{
"name": "detox-test",
"version": "0.0.1",
"private": true,
"scripts": {
"test": ":",
"packager": "react-native start",
"detox-server": "detox run-server",
"e2e:ios": "detox test --configuration ios.sim.release --debug-synchronization 10000 --platform ios",
"e2e:android": "detox test --configuration android.emu.release --loglevel verbose --platform android",
"build:ios": "detox build --configuration ios.sim.release",
"build:android": "detox build --configuration android.emu.release"
},
"dependencies": {
"react": "^16.0.0-beta.5",
"react-native": "^0.49.3"
},
"devDependencies": {
"detox": "^7.0.0",
"express": "^4.15.3",
"lodash": "^4.14.1",
"mocha": "^4.0.0"
},
"detox": {
"specs": "e2e",
"__session": {
"server": "ws://localhost:8099",
"sessionId": "test"
},
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
"build": "set -o pipefail && xcodebuild -project ios/example.xcodeproj -scheme example_ci -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build | xcpretty",
"type": "ios.simulator",
"name": "iPhone 8 Plus"
},
"ios.sim.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/example.app",
"build": "set -o pipefail && export CODE_SIGNING_REQUIRED=NO && export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -project ios/example.xcodeproj -scheme example_ci -configuration Release -sdk iphonesimulator -derivedDataPath ios/build | xcpretty",
"type": "ios.simulator",
"name": "iPhone 8 Plus"
},
"ios.none": {
"binaryPath": "ios",
"type": "ios.none",
"name": "iPhone 8 Plus",
"session": {
"server": "ws://localhost:8099",
"sessionId": "test"
}
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_26"
},
"android.emu.release": {
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
"build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_26"
}
}
}
}
"name": "detox-test",
"version": "0.0.1",
"private": true,
"scripts": {
"test": ":",
"packager": "react-native start",
"detox-server": "detox run-server",
"e2e:ios": "detox test --configuration ios.sim.release --debug-synchronization 10000 --platform ios",
"e2e:android": "detox test --configuration android.emu.release --loglevel verbose --platform android",
"build:ios": "detox build --configuration ios.sim.release",
"build:android": "detox build --configuration android.emu.release"
},
"dependencies": {
"react": "16.2.0",
"react-native": "0.53.3"
},
"devDependencies": {
"detox": "^7.0.0",
"express": "^4.15.3",
"lodash": "^4.14.1",
"mocha": "^4.0.0"
},
"detox": {
"specs": "e2e",
"__session": {
"server": "ws://localhost:8099",
"sessionId": "test"
},
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
"build": "set -o pipefail && xcodebuild -project ios/example.xcodeproj -scheme example_ci -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build | xcpretty",
"type": "ios.simulator",
"name": "iPhone 8 Plus"
},
"ios.sim.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/example.app",
"build": "set -o pipefail && export CODE_SIGNING_REQUIRED=NO && export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -project ios/example.xcodeproj -scheme example_ci -configuration Release -sdk iphonesimulator -derivedDataPath ios/build | xcpretty",
"type": "ios.simulator",
"name": "iPhone 8 Plus"
},
"ios.none": {
"binaryPath": "ios",
"type": "ios.none",
"name": "iPhone 8 Plus",
"session": {
"server": "ws://localhost:8099",
"sessionId": "test"
}
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_26"
},
"android.emu.release": {
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
"build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_26"
}
}
}
}
122 changes: 27 additions & 95 deletions examples/demo-react-native-jest/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,125 +2,52 @@ apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/

project.ext.react = [
entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false

/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion 27
buildToolsVersion "27.0.2"

defaultConfig {
applicationId "com.demoreactnativejest"
minSdkVersion 18
targetSdkVersion 22
targetSdkVersion 26
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}

testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
missingDimensionStrategy "minReactNative", "minReactNative46"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
enable false
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
storeFile file("keystore.jks")
storePassword "12345678"
keyAlias "key0"
keyPassword "12345678"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
minifyEnabled false
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
Expand All @@ -137,20 +64,25 @@ android {
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}

dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
implementation "com.android.support:appcompat-v7:27.0.2"
implementation "com.facebook.react:react-native:+" // From node_modules

androidTestCompile(project(path: ":detox", configuration: "newOkhttpDebug"), {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation(project(path: ":detox"))
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
}


// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
Expand Down
Binary file not shown.
12 changes: 3 additions & 9 deletions examples/demo-react-native-jest/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,21 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

classpath 'com.palantir:jacoco-coverage:0.4.0'
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url "https://maven.google.com"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Sun Mar 04 12:18:22 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
8 changes: 4 additions & 4 deletions examples/demo-react-native-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"test-android": "detox build --configuration android.emu.debug && detox test --configuration android.emu.debug -l verbose"
},
"dependencies": {
"react": "16.0.0-beta.5",
"react-native": "0.49.3"
"react": "16.2.0",
"react-native": "0.53.3"
},
"devDependencies": {
"babel-jest": "21.2.0",
Expand All @@ -35,13 +35,13 @@
"name": "iPhone 7 Plus"
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/app-debug.apk",
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "pushd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && popd",
"type": "android.emulator",
"name": "Nexus_5X_API_26"
},
"android.emu.release": {
"binaryPath": "android/app/build/outputs/apk/app-release.apk",
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
"build": "pushd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && popd",
"type": "android.emulator",
"name": "Nexus_5X_API_26"
Expand Down
2 changes: 1 addition & 1 deletion examples/demo-react-native-jest/rn-cli.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const metroBundler = require('metro-bundler');
const metroBundler = require('metro');

module.exports = {
getBlacklistRE: function() {
Expand Down
Loading