From 2d50d45167fbc994842fc731b8a67d09a82e3f7d Mon Sep 17 00:00:00 2001 From: Aakash N S Date: Fri, 19 Feb 2016 04:20:45 +0530 Subject: [PATCH] ignore examples --- examples/ExampleApp2/.flowconfig | 8 +- examples/ExampleApp2/android/app/build.gradle | 20 +-- .../android/app/proguard-rules.pro | 4 +- examples/ExampleApp2/android/app/react.gradle | 140 ++++++++---------- .../java/com/exampleapp2/MainActivity.java | 3 +- examples/ExampleApp2/android/settings.gradle | 3 +- .../ios/ExampleApp2.xcodeproj/project.pbxproj | 2 +- examples/ExampleApp2/package.json | 4 +- 8 files changed, 89 insertions(+), 95 deletions(-) diff --git a/examples/ExampleApp2/.flowconfig b/examples/ExampleApp2/.flowconfig index 245c23a..c3edaf9 100644 --- a/examples/ExampleApp2/.flowconfig +++ b/examples/ExampleApp2/.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/ExampleApp2/android/app/build.gradle b/examples/ExampleApp2/android/app/build.gradle index f0109d7..ba0a674 100644 --- a/examples/ExampleApp2/android/app/build.gradle +++ b/examples/ExampleApp2/android/app/build.gradle @@ -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,13 @@ 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 is in the format 'bundleIn${productFlavor}${buildType}' + * // bundleInFreeDebug: true, + * // bundleInPaidRelease: true, + * // bundleInBeta: true, + * * // the root of your project, i.e. where "package.json" lives * root: "../../", * @@ -84,7 +92,7 @@ android { splits { abi { enable enableSeparateBuildPerCPUArchitecture - universalApk true + universalApk false reset() include "armeabi-v7a", "x86" } @@ -110,14 +118,8 @@ android { } } -repositories { - maven { url "https://jitpack.io" } -} - - dependencies { compile fileTree(dir: "libs", include: ["*.jar"]) compile "com.android.support:appcompat-v7:23.0.1" - compile "com.facebook.react:react-native:0.18.+" - compile project(':react-native-dialogs') + compile "com.facebook.react:react-native:0.20.+" } diff --git a/examples/ExampleApp2/android/app/proguard-rules.pro b/examples/ExampleApp2/android/app/proguard-rules.pro index 3584026..7d72e46 100644 --- a/examples/ExampleApp2/android/app/proguard-rules.pro +++ b/examples/ExampleApp2/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/ExampleApp2/android/app/react.gradle b/examples/ExampleApp2/android/app/react.gradle index f2152d1..4b43bf9 100644 --- a/examples/ExampleApp2/android/app/react.gradle +++ b/examples/ExampleApp2/android/app/react.gradle @@ -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,76 @@ void runBefore(String dependentTaskName, Task task) { } gradle.projectsEvaluated { + // Grab all build types and product flavors + def buildTypes = android.buildTypes.collect { type -> type.name } + def productFlavors = android.productFlavors.collect { flavor -> flavor.name } - // hook bundleDebugJsAndAssets into the android build process + // When no product flavors defined, use empty + if (!productFlavors) productFlavors.add('') - bundleDebugJsAndAssets.dependsOn mergeDebugResources - bundleDebugJsAndAssets.dependsOn mergeDebugAssets + productFlavors.each { productFlavorName -> + buildTypes.each { buildTypeName -> + // Create variant and source names + def sourceName = "${buildTypeName}" + def targetName = "${sourceName.capitalize()}" + if (productFlavorName) { + sourceName = "${productFlavorName}${targetName}" + } - runBefore('processArmeabi-v7aDebugResources', bundleDebugJsAndAssets) - runBefore('processX86DebugResources', bundleDebugJsAndAssets) - runBefore('processUniversalDebugResources', bundleDebugJsAndAssets) - runBefore('processDebugResources', bundleDebugJsAndAssets) + // React js bundle directories + def jsBundleDirConfigName = "jsBundleDir${targetName}" + def jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ?: + file("$buildDir/intermediates/assets/${sourceName}") - // hook bundleReleaseJsAndAssets into the android build process + def resourcesDirConfigName = "jsBundleDir${targetName}" + def resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?: + file("$buildDir/intermediates/res/merged/${sourceName}") + def jsBundleFile = file("$jsBundleDir/$bundleAssetName") - bundleReleaseJsAndAssets.dependsOn mergeReleaseResources - bundleReleaseJsAndAssets.dependsOn mergeReleaseAssets + // Bundle task name for variant + def bundleJsAndAssetsTaskName = "bundle${targetName}JsAndAssets" - runBefore('processArmeabi-v7aReleaseResources', bundleReleaseJsAndAssets) - runBefore('processX86ReleaseResources', bundleReleaseJsAndAssets) - runBefore('processUniversalReleaseResources', bundleReleaseJsAndAssets) - runBefore('processReleaseResources', bundleReleaseJsAndAssets) + 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}" ?: 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) + } + } } diff --git a/examples/ExampleApp2/android/app/src/main/java/com/exampleapp2/MainActivity.java b/examples/ExampleApp2/android/app/src/main/java/com/exampleapp2/MainActivity.java index 0564be9..c6b4204 100644 --- a/examples/ExampleApp2/android/app/src/main/java/com/exampleapp2/MainActivity.java +++ b/examples/ExampleApp2/android/app/src/main/java/com/exampleapp2/MainActivity.java @@ -34,6 +34,7 @@ public class MainActivity extends ReactActivity { @Override protected List getPackages() { return Arrays.asList( - new MainReactPackage()); + new MainReactPackage() + ); } } diff --git a/examples/ExampleApp2/android/settings.gradle b/examples/ExampleApp2/android/settings.gradle index 0b35def..7775be5 100644 --- a/examples/ExampleApp2/android/settings.gradle +++ b/examples/ExampleApp2/android/settings.gradle @@ -1,4 +1,3 @@ rootProject.name = 'ExampleApp2' -include ':app', ':react-native-dialogs' -project(':react-native-dialogs').projectDir = file('../node_modules/react-native-dialogs/android') +include ':app' diff --git a/examples/ExampleApp2/ios/ExampleApp2.xcodeproj/project.pbxproj b/examples/ExampleApp2/ios/ExampleApp2.xcodeproj/project.pbxproj index ad11ff9..366579d 100644 --- a/examples/ExampleApp2/ios/ExampleApp2.xcodeproj/project.pbxproj +++ b/examples/ExampleApp2/ios/ExampleApp2.xcodeproj/project.pbxproj @@ -525,7 +525,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "../node_modules/react-native/packager/react-native-xcode.sh"; + shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; showEnvVarsInLog = 1; }; /* End PBXShellScriptBuildPhase section */ diff --git a/examples/ExampleApp2/package.json b/examples/ExampleApp2/package.json index e02be1d..18e494b 100644 --- a/examples/ExampleApp2/package.json +++ b/examples/ExampleApp2/package.json @@ -6,6 +6,8 @@ "start": "node node_modules/react-native/local-cli/cli.js start" }, "dependencies": { - + "react-native": "^0.20.0", + "react-native-dialogs": "0.0.12", + "react-native-material-kit": "^0.3.0" } }