From 21b74e8e383c0e4c8877a7cf72726471599a068c Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Fri, 4 Mar 2016 13:04:04 -0800 Subject: [PATCH] Update ReactNativeBenchmarks to React Native 0.21 --- examples/ReactNativeBenchmarks/.flowconfig | 8 ++++---- .../android/app/build.gradle | 19 +++++++++---------- .../android/app/proguard-rules.pro | 4 ++-- .../android/app/react.gradle | 19 ++++++++++--------- .../android/app/src/main/AndroidManifest.xml | 2 +- .../realm/react/benchmarks}/MainActivity.java | 2 +- .../android/build.gradle | 4 ++++ .../project.pbxproj | 12 ++++-------- examples/ReactNativeBenchmarks/package.json | 2 +- 9 files changed, 36 insertions(+), 36 deletions(-) rename examples/ReactNativeBenchmarks/android/app/src/main/java/{com/reactnativebenchmarks => io/realm/react/benchmarks}/MainActivity.java (97%) diff --git a/examples/ReactNativeBenchmarks/.flowconfig b/examples/ReactNativeBenchmarks/.flowconfig index 245c23a0..c3edaf94 100644 --- a/examples/ReactNativeBenchmarks/.flowconfig +++ b/examples/ReactNativeBenchmarks/.flowconfig @@ -51,15 +51,15 @@ module.system=haste 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 diff --git a/examples/ReactNativeBenchmarks/android/app/build.gradle b/examples/ReactNativeBenchmarks/android/app/build.gradle index 75b748c0..c8ca3f59 100644 --- a/examples/ReactNativeBenchmarks/android/app/build.gradle +++ b/examples/ReactNativeBenchmarks/android/app/build.gradle @@ -26,7 +26,9 @@ import com.android.build.OutputFile * * // 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 is in the format 'bundleIn${productFlavor}${buildType}' + * // The configuration property can be in the following formats + * // 'bundleIn${productFlavor}${buildType}' + * // 'bundleIn${buildType}' * // bundleInFreeDebug: true, * // bundleInPaidRelease: true, * // bundleInBeta: true, @@ -72,14 +74,14 @@ def enableSeparateBuildPerCPUArchitecture = false /** * Run Proguard to shrink the Java bytecode in release builds. */ -def enableProguardInReleaseBuilds = true +def enableProguardInReleaseBuilds = false android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { - applicationId "com.reactnativebenchmarks" + applicationId "io.realm.react.benchmarks" minSdkVersion 16 targetSdkVersion 22 versionCode 1 @@ -90,9 +92,9 @@ android { } splits { abi { - enable enableSeparateBuildPerCPUArchitecture - universalApk false // Also generate an universal APK reset() + enable enableSeparateBuildPerCPUArchitecture + universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86" } } @@ -120,10 +122,7 @@ android { dependencies { 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 compile project(":realm") - compile project(':react-native-sqlite-storage') - - compile fileTree(dir: "node_modules/realm/android/libs", include: ["*.jar"]) + compile project(":react-native-sqlite-storage") } diff --git a/examples/ReactNativeBenchmarks/android/app/proguard-rules.pro b/examples/ReactNativeBenchmarks/android/app/proguard-rules.pro index 35840261..7d72e469 100644 --- a/examples/ReactNativeBenchmarks/android/app/proguard-rules.pro +++ b/examples/ReactNativeBenchmarks/android/app/proguard-rules.pro @@ -42,8 +42,8 @@ -keep class * extends com.facebook.react.bridge.NativeModule { *; } -keepclassmembers,includedescriptorclasses class * { native ; } -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } --keepclassmembers class * { @com.facebook.react.uimanager.ReactProp ; } --keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup ; } +-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } +-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } -dontwarn com.facebook.react.** diff --git a/examples/ReactNativeBenchmarks/android/app/react.gradle b/examples/ReactNativeBenchmarks/android/app/react.gradle index 4b43bf91..11a4f8b8 100644 --- a/examples/ReactNativeBenchmarks/android/app/react.gradle +++ b/examples/ReactNativeBenchmarks/android/app/react.gradle @@ -30,21 +30,20 @@ gradle.projectsEvaluated { productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> - // Create variant and source names - def sourceName = "${buildTypeName}" - def targetName = "${sourceName.capitalize()}" - if (productFlavorName) { - sourceName = "${productFlavorName}${targetName}" - } + // 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/${sourceName}") + file("$buildDir/intermediates/assets/${targetPath}") def resourcesDirConfigName = "jsBundleDir${targetName}" def resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?: - file("$buildDir/intermediates/res/merged/${sourceName}") + file("$buildDir/intermediates/res/merged/${targetPath}") def jsBundleFile = file("$jsBundleDir/$bundleAssetName") // Bundle task name for variant @@ -80,7 +79,9 @@ gradle.projectsEvaluated { "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir } - enabled config."bundleIn${targetName}" ?: targetName.toLowerCase().contains("release") + enabled config."bundleIn${targetName}" || + config."bundleIn${buildTypeName.capitalize()}" ?: + targetName.toLowerCase().contains("release") } // Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process diff --git a/examples/ReactNativeBenchmarks/android/app/src/main/AndroidManifest.xml b/examples/ReactNativeBenchmarks/android/app/src/main/AndroidManifest.xml index c047f7e9..c606b301 100644 --- a/examples/ReactNativeBenchmarks/android/app/src/main/AndroidManifest.xml +++ b/examples/ReactNativeBenchmarks/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="io.realm.react.benchmarks"> diff --git a/examples/ReactNativeBenchmarks/android/app/src/main/java/com/reactnativebenchmarks/MainActivity.java b/examples/ReactNativeBenchmarks/android/app/src/main/java/io/realm/react/benchmarks/MainActivity.java similarity index 97% rename from examples/ReactNativeBenchmarks/android/app/src/main/java/com/reactnativebenchmarks/MainActivity.java rename to examples/ReactNativeBenchmarks/android/app/src/main/java/io/realm/react/benchmarks/MainActivity.java index fd1563d7..ad1272e0 100644 --- a/examples/ReactNativeBenchmarks/android/app/src/main/java/com/reactnativebenchmarks/MainActivity.java +++ b/examples/ReactNativeBenchmarks/android/app/src/main/java/io/realm/react/benchmarks/MainActivity.java @@ -1,4 +1,4 @@ -package com.reactnativebenchmarks; +package io.realm.react.benchmarks; import com.facebook.react.ReactActivity; import com.facebook.react.ReactPackage; diff --git a/examples/ReactNativeBenchmarks/android/build.gradle b/examples/ReactNativeBenchmarks/android/build.gradle index ccdfc4e3..403a0075 100644 --- a/examples/ReactNativeBenchmarks/android/build.gradle +++ b/examples/ReactNativeBenchmarks/android/build.gradle @@ -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" + } } } diff --git a/examples/ReactNativeBenchmarks/ios/ReactNativeBenchmarks.xcodeproj/project.pbxproj b/examples/ReactNativeBenchmarks/ios/ReactNativeBenchmarks.xcodeproj/project.pbxproj index 77c2a960..13a1092a 100644 --- a/examples/ReactNativeBenchmarks/ios/ReactNativeBenchmarks.xcodeproj/project.pbxproj +++ b/examples/ReactNativeBenchmarks/ios/ReactNativeBenchmarks.xcodeproj/project.pbxproj @@ -164,7 +164,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; @@ -290,7 +289,6 @@ 13B07FAE1A68108700A75B9A /* ReactNativeBenchmarks */ = { isa = PBXGroup; children = ( - 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 13B07FB01A68108700A75B9A /* AppDelegate.m */, 13B07FB51A68108700A75B9A /* Images.xcassets */, @@ -651,10 +649,8 @@ "$(SRCROOT)/../node_modules/react-native/React/**", ); INFOPLIST_FILE = ReactNativeBenchmarks/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = "-ObjC"; - PRODUCT_BUNDLE_IDENTIFIER = io.realm.ReactNativeBenchmarks; PRODUCT_NAME = ReactNativeBenchmarks; }; name = Debug; @@ -669,10 +665,8 @@ "$(SRCROOT)/../node_modules/react-native/React/**", ); INFOPLIST_FILE = ReactNativeBenchmarks/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = "-ObjC"; - PRODUCT_BUNDLE_IDENTIFIER = io.realm.ReactNativeBenchmarks; PRODUCT_NAME = ReactNativeBenchmarks; }; name = Release; @@ -716,9 +710,10 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", ); - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "io.realm.$(PRODUCT_NAME:rfc1034identifier)"; SDKROOT = iphoneos; }; name = Debug; @@ -756,8 +751,9 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", ); - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "io.realm.$(PRODUCT_NAME:rfc1034identifier)"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; diff --git a/examples/ReactNativeBenchmarks/package.json b/examples/ReactNativeBenchmarks/package.json index ef1b8947..db0a88e1 100644 --- a/examples/ReactNativeBenchmarks/package.json +++ b/examples/ReactNativeBenchmarks/package.json @@ -6,7 +6,7 @@ "start": "react-native start" }, "dependencies": { - "react-native": "^0.20.0", + "react-native": "^0.21.0", "react-native-sqlite-storage": "^2.1.3", "react-native-store": "^0.4.1", "realm": "file:../.."