Update ReactTests to React Native 0.21
This commit is contained in:
parent
21b74e8e38
commit
cb4002e25c
|
@ -7,12 +7,26 @@
|
||||||
# Some modules have their own node_modules with overlap
|
# Some modules have their own node_modules with overlap
|
||||||
.*/node_modules/node-haste/.*
|
.*/node_modules/node-haste/.*
|
||||||
|
|
||||||
# Ignore react-tools where there are overlaps, but don't ignore anything that
|
# Ugh
|
||||||
# react-native relies on
|
.*/node_modules/babel.*
|
||||||
.*/node_modules/react-tools/src/React.js
|
.*/node_modules/babylon.*
|
||||||
.*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js
|
.*/node_modules/invariant.*
|
||||||
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
|
|
||||||
.*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js
|
# Ignore react and fbjs where there are overlaps, but don't ignore
|
||||||
|
# anything that react-native relies on
|
||||||
|
.*/node_modules/fbjs/lib/Map.js
|
||||||
|
.*/node_modules/fbjs/lib/Promise.js
|
||||||
|
.*/node_modules/fbjs/lib/fetch.js
|
||||||
|
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
|
||||||
|
.*/node_modules/fbjs/lib/isEmpty.js
|
||||||
|
.*/node_modules/fbjs/lib/crc32.js
|
||||||
|
.*/node_modules/fbjs/lib/ErrorUtils.js
|
||||||
|
|
||||||
|
# Flow has a built-in definition for the 'react' module which we prefer to use
|
||||||
|
# over the currently-untyped source
|
||||||
|
.*/node_modules/react/react.js
|
||||||
|
.*/node_modules/react/lib/React.js
|
||||||
|
.*/node_modules/react/lib/ReactDOM.js
|
||||||
|
|
||||||
# Ignore commoner tests
|
# Ignore commoner tests
|
||||||
.*/node_modules/commoner/test/.*
|
.*/node_modules/commoner/test/.*
|
||||||
|
@ -37,15 +51,15 @@ module.system=haste
|
||||||
munge_underscores=true
|
munge_underscores=true
|
||||||
|
|
||||||
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
|
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
|
||||||
module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub'
|
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\)$' -> 'RelativeImageStub'
|
||||||
|
|
||||||
suppress_type=$FlowIssue
|
suppress_type=$FlowIssue
|
||||||
suppress_type=$FlowFixMe
|
suppress_type=$FlowFixMe
|
||||||
suppress_type=$FixMe
|
suppress_type=$FixMe
|
||||||
|
|
||||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-7]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
|
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
|
||||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-7]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+
|
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
|
||||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
|
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
|
||||||
|
|
||||||
[version]
|
[version]
|
||||||
0.17.0
|
0.21.0
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
apply plugin: 'android-sdk-manager'
|
|
||||||
apply plugin: "com.android.application"
|
apply plugin: "com.android.application"
|
||||||
|
|
||||||
|
import com.android.build.OutputFile
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The react.gradle file registers two tasks: bundleDebugJsAndAssets and bundleReleaseJsAndAssets.
|
* 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
|
* 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
|
* 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
|
* bundle directly from the development server. Below you can see all the possible configurations
|
||||||
|
@ -22,6 +24,15 @@ apply plugin: "com.android.application"
|
||||||
* // whether to bundle JS and assets in release mode
|
* // whether to bundle JS and assets in release mode
|
||||||
* bundleInRelease: true,
|
* 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,
|
||||||
|
*
|
||||||
* // the root of your project, i.e. where "package.json" lives
|
* // the root of your project, i.e. where "package.json" lives
|
||||||
* root: "../../",
|
* root: "../../",
|
||||||
*
|
*
|
||||||
|
@ -50,6 +61,21 @@ apply plugin: "com.android.application"
|
||||||
|
|
||||||
apply from: "react.gradle"
|
apply from: "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 {
|
android {
|
||||||
compileSdkVersion 23
|
compileSdkVersion 23
|
||||||
buildToolsVersion "23.0.1"
|
buildToolsVersion "23.0.1"
|
||||||
|
@ -64,17 +90,39 @@ android {
|
||||||
abiFilters "armeabi-v7a", "x86"
|
abiFilters "armeabi-v7a", "x86"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
splits {
|
||||||
|
abi {
|
||||||
|
reset()
|
||||||
|
enable enableSeparateBuildPerCPUArchitecture
|
||||||
|
universalApk false // If true, also generate a universal APK
|
||||||
|
include "armeabi-v7a", "x86"
|
||||||
|
}
|
||||||
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false // Set this to true to enable Proguard
|
minifyEnabled enableProguardInReleaseBuilds
|
||||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// applicationVariants are e.g. debug, release
|
||||||
|
applicationVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
// For each separate APK per architecture, set a unique version code as described here:
|
||||||
|
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
|
||||||
|
def versionCodes = ["armeabi-v7a":1, "x86":2]
|
||||||
|
def abi = output.getFilter(OutputFile.ABI)
|
||||||
|
if (abi != null) { // null for the universal-debug, universal-release variants
|
||||||
|
output.versionCodeOverride =
|
||||||
|
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.android.support:appcompat-v7:23.0.1'
|
compile fileTree(dir: "libs", include: ["*.jar"])
|
||||||
compile 'com.facebook.react:react-native:0.20.+'
|
compile "com.android.support:appcompat-v7:23.0.1"
|
||||||
compile project(':realm')
|
compile "com.facebook.react:react-native:+" // From node_modules
|
||||||
compile project(':react-native-fs')
|
compile project(":realm")
|
||||||
|
compile project(":react-native-fs")
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,12 @@
|
||||||
|
|
||||||
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
|
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
|
||||||
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
|
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
|
||||||
|
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
|
||||||
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
|
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
|
||||||
-keepclassmembers class * { @com.facebook.react.uimanager.ReactProp <methods>; }
|
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
|
||||||
-keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup <methods>; }
|
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
|
||||||
|
|
||||||
|
-dontwarn com.facebook.react.**
|
||||||
|
|
||||||
# okhttp
|
# okhttp
|
||||||
|
|
||||||
|
@ -58,3 +61,7 @@
|
||||||
-dontwarn java.nio.file.*
|
-dontwarn java.nio.file.*
|
||||||
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
|
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
|
||||||
-dontwarn okio.**
|
-dontwarn okio.**
|
||||||
|
|
||||||
|
# stetho
|
||||||
|
|
||||||
|
-dontwarn com.facebook.stetho.**
|
||||||
|
|
|
@ -11,77 +11,87 @@ def elvisFile(thing) {
|
||||||
}
|
}
|
||||||
|
|
||||||
def reactRoot = elvisFile(config.root) ?: file("../../")
|
def reactRoot = elvisFile(config.root) ?: file("../../")
|
||||||
def jsBundleDirDebug = elvisFile(config.jsBundleDirDebug) ?:
|
|
||||||
file("$buildDir/intermediates/assets/debug")
|
|
||||||
def jsBundleDirRelease = elvisFile(config.jsBundleDirRelease) ?:
|
|
||||||
file("$buildDir/intermediates/assets/release")
|
|
||||||
def resourcesDirDebug = elvisFile(config.resourcesDirDebug) ?:
|
|
||||||
file("$buildDir/intermediates/res/merged/debug")
|
|
||||||
def resourcesDirRelease = elvisFile(config.resourcesDirRelease) ?:
|
|
||||||
file("$buildDir/intermediates/res/merged/release")
|
|
||||||
def inputExcludes = config.inputExcludes ?: ["android/**", "ios/**"]
|
def inputExcludes = config.inputExcludes ?: ["android/**", "ios/**"]
|
||||||
|
|
||||||
def jsBundleFileDebug = file("$jsBundleDirDebug/$bundleAssetName")
|
void runBefore(String dependentTaskName, Task task) {
|
||||||
def jsBundleFileRelease = file("$jsBundleDirRelease/$bundleAssetName")
|
Task dependentTask = tasks.findByPath(dependentTaskName);
|
||||||
|
if (dependentTask != null) {
|
||||||
task bundleDebugJsAndAssets(type: Exec) {
|
dependentTask.dependsOn task
|
||||||
// create dirs if they are not there (e.g. the "clean" task just ran)
|
|
||||||
doFirst {
|
|
||||||
jsBundleDirDebug.mkdirs()
|
|
||||||
resourcesDirDebug.mkdirs()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up inputs and outputs so gradle can cache the result
|
|
||||||
inputs.files fileTree(dir: reactRoot, excludes: inputExcludes)
|
|
||||||
outputs.dir jsBundleDirDebug
|
|
||||||
outputs.dir resourcesDirDebug
|
|
||||||
|
|
||||||
// set up the call to the react-native cli
|
|
||||||
workingDir reactRoot
|
|
||||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
||||||
commandLine "cmd", "/c", "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file",
|
|
||||||
entryFile, "--bundle-output", jsBundleFileDebug, "--assets-dest", resourcesDirDebug
|
|
||||||
} else {
|
|
||||||
commandLine "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file",
|
|
||||||
entryFile, "--bundle-output", jsBundleFileDebug, "--assets-dest", resourcesDirDebug
|
|
||||||
}
|
|
||||||
|
|
||||||
enabled config.bundleInDebug ?: false
|
|
||||||
}
|
|
||||||
|
|
||||||
task bundleReleaseJsAndAssets(type: Exec) {
|
|
||||||
// create dirs if they are not there (e.g. the "clean" task just ran)
|
|
||||||
doFirst {
|
|
||||||
jsBundleDirRelease.mkdirs()
|
|
||||||
resourcesDirRelease.mkdirs()
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up inputs and outputs so gradle can cache the result
|
|
||||||
inputs.files fileTree(dir: reactRoot, excludes: inputExcludes)
|
|
||||||
outputs.dir jsBundleDirRelease
|
|
||||||
outputs.dir resourcesDirRelease
|
|
||||||
|
|
||||||
// set up the call to the react-native cli
|
|
||||||
workingDir reactRoot
|
|
||||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
||||||
commandLine "cmd","/c", "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file",
|
|
||||||
entryFile, "--bundle-output", jsBundleFileRelease, "--assets-dest", resourcesDirRelease
|
|
||||||
} else {
|
|
||||||
commandLine "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file",
|
|
||||||
entryFile, "--bundle-output", jsBundleFileRelease, "--assets-dest", resourcesDirRelease
|
|
||||||
}
|
|
||||||
|
|
||||||
enabled config.bundleInRelease ?: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gradle.projectsEvaluated {
|
gradle.projectsEvaluated {
|
||||||
// hook bundleDebugJsAndAssets into the android build process
|
// Grab all build types and product flavors
|
||||||
bundleDebugJsAndAssets.dependsOn mergeDebugResources
|
def buildTypes = android.buildTypes.collect { type -> type.name }
|
||||||
bundleDebugJsAndAssets.dependsOn mergeDebugAssets
|
def productFlavors = android.productFlavors.collect { flavor -> flavor.name }
|
||||||
processDebugResources.dependsOn bundleDebugJsAndAssets
|
|
||||||
|
|
||||||
// hook bundleReleaseJsAndAssets into the android build process
|
// When no product flavors defined, use empty
|
||||||
bundleReleaseJsAndAssets.dependsOn mergeReleaseResources
|
if (!productFlavors) productFlavors.add('')
|
||||||
bundleReleaseJsAndAssets.dependsOn mergeReleaseAssets
|
|
||||||
processReleaseResources.dependsOn bundleReleaseJsAndAssets
|
productFlavors.each { productFlavorName ->
|
||||||
|
buildTypes.each { buildTypeName ->
|
||||||
|
// Create variant and target names
|
||||||
|
def targetName = "${productFlavorName.capitalize()}${buildTypeName.capitalize()}"
|
||||||
|
def targetPath = productFlavorName ?
|
||||||
|
"${productFlavorName}/${buildTypeName}" :
|
||||||
|
"${buildTypeName}"
|
||||||
|
|
||||||
|
// React js bundle directories
|
||||||
|
def jsBundleDirConfigName = "jsBundleDir${targetName}"
|
||||||
|
def jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ?:
|
||||||
|
file("$buildDir/intermediates/assets/${targetPath}")
|
||||||
|
|
||||||
|
def resourcesDirConfigName = "jsBundleDir${targetName}"
|
||||||
|
def resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?:
|
||||||
|
file("$buildDir/intermediates/res/merged/${targetPath}")
|
||||||
|
def jsBundleFile = file("$jsBundleDir/$bundleAssetName")
|
||||||
|
|
||||||
|
// Bundle task name for variant
|
||||||
|
def bundleJsAndAssetsTaskName = "bundle${targetName}JsAndAssets"
|
||||||
|
|
||||||
|
def currentBundleTask = tasks.create(
|
||||||
|
name: bundleJsAndAssetsTaskName,
|
||||||
|
type: Exec) {
|
||||||
|
group = "react"
|
||||||
|
description = "bundle JS and assets for ${targetName}."
|
||||||
|
|
||||||
|
// Create dirs if they are not there (e.g. the "clean" task just ran)
|
||||||
|
doFirst {
|
||||||
|
jsBundleDir.mkdirs()
|
||||||
|
resourcesDir.mkdirs()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up inputs and outputs so gradle can cache the result
|
||||||
|
inputs.files fileTree(dir: reactRoot, excludes: inputExcludes)
|
||||||
|
outputs.dir jsBundleDir
|
||||||
|
outputs.dir resourcesDir
|
||||||
|
|
||||||
|
// Set up the call to the react-native cli
|
||||||
|
workingDir reactRoot
|
||||||
|
|
||||||
|
// Set up dev mode
|
||||||
|
def devEnabled = !targetName.toLowerCase().contains("release")
|
||||||
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
|
commandLine "cmd", "/c", "react-native", "bundle", "--platform", "android", "--dev", "${devEnabled}",
|
||||||
|
"--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir
|
||||||
|
} else {
|
||||||
|
commandLine "react-native", "bundle", "--platform", "android", "--dev", "${devEnabled}",
|
||||||
|
"--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir
|
||||||
|
}
|
||||||
|
|
||||||
|
enabled config."bundleIn${targetName}" ||
|
||||||
|
config."bundleIn${buildTypeName.capitalize()}" ?:
|
||||||
|
targetName.toLowerCase().contains("release")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process
|
||||||
|
currentBundleTask.dependsOn("merge${targetName}Resources")
|
||||||
|
currentBundleTask.dependsOn("merge${targetName}Assets")
|
||||||
|
|
||||||
|
runBefore("processArmeabi-v7a${targetName}Resources", currentBundleTask)
|
||||||
|
runBefore("processX86${targetName}Resources", currentBundleTask)
|
||||||
|
runBefore("processUniversal${targetName}Resources", currentBundleTask)
|
||||||
|
runBefore("process${targetName}Resources", currentBundleTask)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"start": "react-native start"
|
"start": "react-native start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react-native": "^0.20.0",
|
"react-native": "^0.21.0",
|
||||||
"react-native-fs": "^1.1.0",
|
"react-native-fs": "^1.1.0",
|
||||||
"xmlbuilder": "^4.2.1",
|
"xmlbuilder": "^4.2.1",
|
||||||
"realm": "file:../..",
|
"realm": "file:../..",
|
||||||
|
|
Loading…
Reference in New Issue