From c596f8d0ef800ca45dd5f6cc5156d69e2ba1a32b Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Tue, 12 Apr 2016 13:03:54 -0700 Subject: [PATCH] Allow building UIExplorer with Buck Summary:This adds a BUCK file to UIExplorer to allow building it with buck. It is based on the one in the movies app but I removed the extra deps that were not needed in both files. Also add build version number and target sdk version in the Android manifest so Buck can use it since it was only specified in the gradle build and caused the app to run on a super old target sdk. bestander mkonicek Would it be simple to also build the ndk part with Buck? Right now it is built with gradle and packaged after. I suppose it is already being done internally at facebook. The BUCK files for building the cpp code are already there but I couldn't figure out what was missing to make it work :( That is pretty much the only missing part to have first class support for building RN apps with Buck in OSS. We could eventually include BUCK files with the generated project. **Test plan (required)** Build and run UIExplorer and Movies examples using Buck. Edited: ``` ./gradlew ReactAndroid:packageReactNdkLibsForBuck Closes https://github.com/facebook/react-native/pull/6399 Reviewed By: mkonicek Differential Revision: D3042355 Pulled By: bestander fb-gh-sync-id: 74760c7ba12d35b1853d2e3706c2ba130f9eef1c fbshipit-source-id: 74760c7ba12d35b1853d2e3706c2ba130f9eef1c --- .buckconfig | 1 + Examples/Movies/README.md | 15 +++++++++ Examples/Movies/android/app/BUCK | 20 +++--------- .../android/app/src/main/AndroidManifest.xml | 8 ++++- Examples/UIExplorer/README.md | 15 +++++++++ Examples/UIExplorer/android/app/BUCK | 31 +++++++++++++++++++ .../android/app/src/main/AndroidManifest.xml | 11 +++++-- .../android/support/v7/appcompat-orig/BUCK | 4 +-- 8 files changed, 84 insertions(+), 21 deletions(-) create mode 100644 Examples/UIExplorer/android/app/BUCK diff --git a/.buckconfig b/.buckconfig index 9f6c686b2..8e9e59e24 100644 --- a/.buckconfig +++ b/.buckconfig @@ -7,3 +7,4 @@ [alias] movies = //Examples/Movies/android/app:app + uiexplorer = //Examples/UIExplorer/android/app:app diff --git a/Examples/Movies/README.md b/Examples/Movies/README.md index e80a81fee..ed7046c74 100644 --- a/Examples/Movies/README.md +++ b/Examples/Movies/README.md @@ -35,6 +35,21 @@ Open the Movies app in your emulator. See [Running on Device](https://facebook.github.io/react-native/docs/running-on-device-android.html) in case you want to use a physical device. +### Running with Buck + +Follow the same setup as running with gradle. + +Install Buck from [here](https://buckbuild.com/setup/install.html). + +Run the following commands from the react-native folder: + + ./gradlew :ReactAndroid:packageReactNdkLibsForBuck + buck fetch movies + buck install -r movies + ./packager/packager.sh + +_Note: The native libs are still built using gradle. Full build with buck is coming soon(tm)._ + ## Built from source Building the app on both iOS and Android means building the React Native framework from source. This way you're running the latest native and JS code the way you see it in your clone of the github repo. diff --git a/Examples/Movies/android/app/BUCK b/Examples/Movies/android/app/BUCK index 25c73fd54..0d7740439 100644 --- a/Examples/Movies/android/app/BUCK +++ b/Examples/Movies/android/app/BUCK @@ -13,29 +13,17 @@ android_library( name = 'movies-lib', srcs = glob(['src/main/java/**/*.java']), deps = [ - react_native_target('java/com/facebook/csslayout:csslayout'), - react_native_target('java/com/facebook/react:react'), - react_native_target('java/com/facebook/react/devsupport:devsupport'), + ':res', + react_native_dep('third-party/java/jsr-305:jsr-305'), react_native_target('java/com/facebook/react/modules/core:core'), react_native_target('java/com/facebook/react/shell:shell'), - react_native_target('java/com/facebook/react/touch:touch'), - react_native_target('java/com/facebook/react/uimanager:uimanager'), - react_native_target('java/com/facebook/react/uimanager/annotations:annotations'), - react_native_target('java/com/facebook/react/views/image:image'), - react_native_target('java/com/facebook/react/views/recyclerview:recyclerview'), - react_native_target('java/com/facebook/react/views/scroll:scroll'), - react_native_target('java/com/facebook/react/views/text:text'), - react_native_target('java/com/facebook/react/views/view:view'), + react_native_target('java/com/facebook/react:react'), + react_native_target('jni/prebuilt:android-jsc'), # .so files are prebuilt by Gradle with `./gradlew :ReactAndroid:packageReactNdkLibsForBuck` react_native_target('jni/prebuilt:reactnative-libs'), - react_native_target('jni/prebuilt:android-jsc'), - react_native_dep('libraries/soloader/java/com/facebook/soloader:soloader'), - react_native_dep('third-party/java/jsr-305:jsr-305'), - ':res', ], ) - android_resource( name = 'res', res = 'src/main/res', diff --git a/Examples/Movies/android/app/src/main/AndroidManifest.xml b/Examples/Movies/android/app/src/main/AndroidManifest.xml index 8aaec6081..9c5b43e36 100644 --- a/Examples/Movies/android/app/src/main/AndroidManifest.xml +++ b/Examples/Movies/android/app/src/main/AndroidManifest.xml @@ -1,10 +1,16 @@ + package="com.facebook.react.movies" + android:versionCode="1" + android:versionName="1.0"> + + - + @@ -8,6 +11,10 @@ + +