From a43683bb6ab8d4853789dbd89e5edc523d4f2341 Mon Sep 17 00:00:00 2001 From: Connor McEwen Date: Mon, 13 Jun 2016 16:40:35 -0400 Subject: [PATCH] Update to use latest React Native --- examples/Basic/.buckconfig | 6 ++ examples/Basic/.flowconfig | 20 +++-- examples/Basic/.gitignore | 6 ++ examples/Basic/android/app/BUCK | 66 ++++++++++++++ examples/Basic/android/app/build.gradle | 13 ++- examples/Basic/android/app/proguard-rules.pro | 10 +-- .../gradle/wrapper/gradle-wrapper.properties | 3 +- examples/Basic/index.android.js | 4 +- .../Basic/ios/Basic.xcodeproj/project.pbxproj | 90 +++++-------------- examples/Basic/ios/Basic/AppDelegate.m | 1 + examples/Basic/ios/BasicTests/BasicTests.m | 2 +- examples/Basic/package.json | 4 +- 12 files changed, 136 insertions(+), 89 deletions(-) create mode 100644 examples/Basic/.buckconfig create mode 100644 examples/Basic/android/app/BUCK diff --git a/examples/Basic/.buckconfig b/examples/Basic/.buckconfig new file mode 100644 index 0000000..934256c --- /dev/null +++ b/examples/Basic/.buckconfig @@ -0,0 +1,6 @@ + +[android] + target = Google Inc.:Google APIs:23 + +[maven_repositories] + central = https://repo1.maven.org/maven2 diff --git a/examples/Basic/.flowconfig b/examples/Basic/.flowconfig index 66b57e0..45fd3cc 100644 --- a/examples/Basic/.flowconfig +++ b/examples/Basic/.flowconfig @@ -15,8 +15,6 @@ # 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/fetch.js -.*/node_modules/fbjs/lib/ExecutionEnvironment.js .*/node_modules/fbjs/lib/ErrorUtils.js # Flow has a built-in definition for the 'react' module which we prefer to use @@ -42,6 +40,15 @@ # Ignore Website .*/website/.* +# Ignore generators +.*/local-cli/generator.* + +# Ignore BUCK generated folders +.*\.buckd/ + +# Ignore RNPM +.*/local-cli/rnpm/.* + .*/node_modules/is-my-json-valid/test/.*\.json .*/node_modules/iconv-lite/encodings/tables/.*\.json .*/node_modules/y18n/test/.*\.json @@ -59,6 +66,7 @@ .*/node_modules/isemail/.*\.json .*/node_modules/tr46/.*\.json + [include] [libs] @@ -75,15 +83,15 @@ esproposal.class_instance_fields=enable munge_underscores=true module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' -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' +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\|pdf\)$' -> 'RelativeImageStub' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-2]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-2]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy [version] -0.22.0 +^0.25.0 diff --git a/examples/Basic/.gitignore b/examples/Basic/.gitignore index 94fc867..42c9490 100644 --- a/examples/Basic/.gitignore +++ b/examples/Basic/.gitignore @@ -32,3 +32,9 @@ local.properties # node_modules/ npm-debug.log + +# BUCK +buck-out/ +\.buckd/ +android/app/libs +android/keystores/debug.keystore diff --git a/examples/Basic/android/app/BUCK b/examples/Basic/android/app/BUCK new file mode 100644 index 0000000..e0453dc --- /dev/null +++ b/examples/Basic/android/app/BUCK @@ -0,0 +1,66 @@ +import re + +# To learn about Buck see [Docs](https://buckbuild.com/). +# To run your application with Buck: +# - install Buck +# - `npm start` - to start the packager +# - `cd android` +# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US` +# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck +# - `buck install -r android/app` - compile, install and run application +# + +lib_deps = [] +for jarfile in glob(['libs/*.jar']): + name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) + lib_deps.append(':' + name) + prebuilt_jar( + name = name, + binary_jar = jarfile, + ) + +for aarfile in glob(['libs/*.aar']): + name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) + lib_deps.append(':' + name) + android_prebuilt_aar( + name = name, + aar = aarfile, + ) + +android_library( + name = 'all-libs', + exported_deps = lib_deps +) + +android_library( + name = 'app-code', + srcs = glob([ + 'src/main/java/**/*.java', + ]), + deps = [ + ':all-libs', + ':build_config', + ':res', + ], +) + +android_build_config( + name = 'build_config', + package = 'com.basic', +) + +android_resource( + name = 'res', + res = 'src/main/res', + package = 'com.basic', +) + +android_binary( + name = 'app', + package_type = 'debug', + manifest = 'src/main/AndroidManifest.xml', + keystore = '//android/keystores:debug', + deps = [ + ':app-code', + ], +) diff --git a/examples/Basic/android/app/build.gradle b/examples/Basic/android/app/build.gradle index b13a0a7..d24c041 100644 --- a/examples/Basic/android/app/build.gradle +++ b/examples/Basic/android/app/build.gradle @@ -9,7 +9,7 @@ import com.android.build.OutputFile * 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: "react.gradle"` line. + * `apply from: "../../node_modules/react-native/react.gradle"` line. * * project.ext.react = [ * // the name of the generated asset file containing your JS bundle @@ -59,7 +59,7 @@ import com.android.build.OutputFile * ] */ -apply from: "react.gradle" +apply from: "../../node_modules/react-native/react.gradle" /** * Set this to true to create two separate APKs instead of one: @@ -127,7 +127,7 @@ repositories { dependencies { compile fileTree(dir: "libs", include: ["*.jar"]) - compile "com.android.support:appcompat-v7:23.0.1" + compile "com.android.support:appcompat-v7:23.4.0" compile "com.facebook.react:react-native:+" // From node_modules compile project(':react-native-blur') } @@ -140,3 +140,10 @@ buildscript { classpath 'com.fivehundredpx:blurringview:1.0.0' } } + +// 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) { + from configurations.compile + into 'libs' +} diff --git a/examples/Basic/android/app/proguard-rules.pro b/examples/Basic/android/app/proguard-rules.pro index 7d72e46..9852871 100644 --- a/examples/Basic/android/app/proguard-rules.pro +++ b/examples/Basic/android/app/proguard-rules.pro @@ -51,9 +51,9 @@ -keepattributes Signature -keepattributes *Annotation* --keep class com.squareup.okhttp.** { *; } --keep interface com.squareup.okhttp.** { *; } --dontwarn com.squareup.okhttp.** +-keep class okhttp3.** { *; } +-keep interface okhttp3.** { *; } +-dontwarn okhttp3.** # okio @@ -61,7 +61,3 @@ -dontwarn java.nio.file.* -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement -dontwarn okio.** - -# stetho - --dontwarn com.facebook.stetho.** diff --git a/examples/Basic/android/gradle/wrapper/gradle-wrapper.properties b/examples/Basic/android/gradle/wrapper/gradle-wrapper.properties index 7d05de3..2d74a82 100644 --- a/examples/Basic/android/gradle/wrapper/gradle-wrapper.properties +++ b/examples/Basic/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Mon Jun 13 16:36:53 EDT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip diff --git a/examples/Basic/index.android.js b/examples/Basic/index.android.js index 27bcff8..6de5e34 100644 --- a/examples/Basic/index.android.js +++ b/examples/Basic/index.android.js @@ -52,10 +52,10 @@ class Basic extends React.Component { render() { return (