Permalink
Browse files

upgrade to 0.22.0

  • Loading branch information...
1 parent 4f5cad5 commit 4e5e12cff6fbcdfcb55c32c0e3f1005172b5ee93 @soliury committed Apr 6, 2016
View
@@ -15,11 +15,8 @@
# 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
@@ -28,6 +25,11 @@
.*/node_modules/react/lib/React.js
.*/node_modules/react/lib/ReactDOM.js
+.*/__mocks__/.*
+.*/__tests__/.*
+
+.*/commoner/test/source/widget/share.js
+
# Ignore commoner tests
.*/node_modules/commoner/test/.*
@@ -48,18 +50,21 @@ node_modules/react-native/Libraries/react-native/react-native-interface.js
[options]
module.system=haste
+esproposal.class_static_fields=enable
+esproposal.class_instance_fields=enable
+
munge_underscores=true
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=$FlowFixMe
suppress_type=$FixMe
-suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
-suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
+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\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
[version]
-0.20.1
+0.21.0
View
@@ -32,4 +32,3 @@ local.properties
#
node_modules/
npm-debug.log
-mock.js
@@ -3,7 +3,8 @@ 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
* 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
@@ -23,6 +24,15 @@ import com.android.build.OutputFile
* // 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,
+ *
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
@@ -52,8 +62,7 @@ import com.android.build.OutputFile
apply from: "react.gradle"
/**
- * Set this to true to create three separate APKs instead of one:
- * - A universal APK that works on all devices
+ * 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.
@@ -83,9 +92,9 @@ android {
}
splits {
abi {
- enable enableSeparateBuildPerCPUArchitecture
- universalApk true
reset()
+ enable enableSeparateBuildPerCPUArchitecture
+ universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
@@ -111,11 +120,11 @@ android {
}
dependencies {
- compile project(':ReactNativeVibration')
- compile project(':ReactNativeBarcodescanner')
- compile project(':react-native-camera')
+ compile project(':react-native-vibration')
compile project(':react-native-vector-icons')
+ compile project(':react-native-camera')
+ compile project(':react-native-barcodescanner')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
- compile "com.facebook.react:react-native:0.20.+"
+ compile "com.facebook.react:react-native:+" // From node_modules
}
@@ -42,8 +42,8 @@
-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.ReactProp <methods>; }
--keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup <methods>; }
+-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
+-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
-dontwarn com.facebook.react.**
@@ -11,69 +11,8 @@ def elvisFile(thing) {
}
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 jsBundleFileDebug = file("$jsBundleDirDebug/$bundleAssetName")
-def jsBundleFileRelease = file("$jsBundleDirRelease/$bundleAssetName")
-
-task bundleDebugJsAndAssets(type: Exec) {
- // 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
-}
-
void runBefore(String dependentTaskName, Task task) {
Task dependentTask = tasks.findByPath(dependentTaskName);
if (dependentTask != null) {
@@ -82,25 +21,77 @@ void runBefore(String dependentTaskName, Task task) {
}
gradle.projectsEvaluated {
-
- // hook bundleDebugJsAndAssets into the android build process
-
- bundleDebugJsAndAssets.dependsOn mergeDebugResources
- bundleDebugJsAndAssets.dependsOn mergeDebugAssets
-
- runBefore('processArmeabi-v7aDebugResources', bundleDebugJsAndAssets)
- runBefore('processX86DebugResources', bundleDebugJsAndAssets)
- runBefore('processUniversalDebugResources', bundleDebugJsAndAssets)
- runBefore('processDebugResources', bundleDebugJsAndAssets)
-
- // hook bundleReleaseJsAndAssets into the android build process
-
- bundleReleaseJsAndAssets.dependsOn mergeReleaseResources
- bundleReleaseJsAndAssets.dependsOn mergeReleaseAssets
-
- runBefore('processArmeabi-v7aReleaseResources', bundleReleaseJsAndAssets)
- runBefore('processX86ReleaseResources', bundleReleaseJsAndAssets)
- runBefore('processUniversalReleaseResources', bundleReleaseJsAndAssets)
- runBefore('processReleaseResources', bundleReleaseJsAndAssets)
-
+ // Grab all build types and product flavors
+ def buildTypes = android.buildTypes.collect { type -> type.name }
+ def productFlavors = android.productFlavors.collect { flavor -> flavor.name }
+
+ // When no product flavors defined, use empty
+ if (!productFlavors) productFlavors.add('')
+
+ 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 = "resourcesDir${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)
+ }
+ }
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,12 +1,12 @@
package com.noder;
-import com.lwansbrough.RCTCamera.*;
import com.facebook.react.ReactActivity;
+import com.eguma.vibration.Vibration;
import com.oblador.vectoricons.VectorIconsPackage;
+import com.lwansbrough.RCTCamera.RCTCameraPackage;
+import com.eguma.barcodescanner.BarcodeScanner;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
-import com.eguma.barcodescanner.BarcodeScanner;
-import com.eguma.vibration.Vibration;
import java.util.Arrays;
import java.util.List;
@@ -31,17 +31,18 @@ protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
- /**
- * A list of packages used by the app. If the app uses additional views
- * or modules besides the default ones, add more packages here.
- */
+ /**
+ * A list of packages used by the app. If the app uses additional views
+ * or modules besides the default ones, add more packages here.
+ */
@Override
protected List<ReactPackage> getPackages() {
- return Arrays.<ReactPackage>asList(
- new RCTCameraPackage(),
- new MainReactPackage(),
- new Vibration(),
- new VectorIconsPackage(),
- new BarcodeScanner());
+ return Arrays.<ReactPackage>asList(
+ new MainReactPackage(),
+ new Vibration(),
+ new VectorIconsPackage(),
+ new RCTCameraPackage(),
+ new BarcodeScanner()
+ );
}
}
@@ -16,5 +16,9 @@ allprojects {
repositories {
mavenLocal()
jcenter()
+ maven {
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
+ url "$projectDir/../../node_modules/react-native/android"
+ }
}
}
@@ -1,12 +1,11 @@
rootProject.name = 'noder'
include ':app'
-include ':react-native-vector-icons'
-project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
+include ':react-native-barcodescanner'
+project(':react-native-barcodescanner').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-barcodescanner/android')
include ':react-native-camera'
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
-include ':ReactNativeBarcodescanner'
-project(':ReactNativeBarcodescanner').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-barcodescanner/android')
-include ':ReactNativeVibration'
-project(':ReactNativeVibration').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vibration/android')
-
+include ':react-native-vector-icons'
+project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
+include ':react-native-vibration'
+project(':react-native-vibration').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vibration/android')
Oops, something went wrong.

0 comments on commit 4e5e12c

Please sign in to comment.