Added BUCK to generated app with react-native-cli init

Summary:BUCK is faster than Gradle.
For example `gradle app:installDebug` vs `buck install app` is ~7 seconds vs ~2 seconds with warm caches.
This is just the beginning to allow people to become familiar with BUCK.
It is enough for running the app locally and testing on a device.

Gradle is still used for dependency resolution.
Closes https://github.com/facebook/react-native/pull/6733

Differential Revision: D3126328

Pulled By: bestander

fb-gh-sync-id: 56aad276036c029af7e0e23d60c46ba2f77b3d2c
fbshipit-source-id: 56aad276036c029af7e0e23d60c46ba2f77b3d2c
This commit is contained in:
Konstantin Raev
2016-04-01 08:53:28 -07:00
committed by Facebook Github Bot 1
parent 4133de04d7
commit ce1261a3dd
12 changed files with 162 additions and 35 deletions

View File

@@ -62,36 +62,46 @@ npm install -g $CLI_PACKAGE
react-native init EndToEndTest --version $PACKAGE
cd EndToEndTest
case $1 in
"--packager"*)
echo "Running a basic packager test"
# Check the packager produces a bundle (doesn't throw an error)
react-native bundle --platform android --dev true --entry-file index.android.js --bundle-output android-bundle.js
# TODO do flow check
;;
"--ios"*)
echo "Running an iOS app"
cd ios
# Make sure we installed local version of react-native
ls EndToEndTest/`basename $MARKER_IOS` > /dev/null
../node_modules/react-native/packager/packager.sh --nonPersistent &
SERVER_PID=$!
# Start the app on the simulator
xctool -scheme EndToEndTest -sdk iphonesimulator test
;;
"--android"*)
echo "Running an Android app"
cd android
# Make sure we installed local version of react-native
ls `basename $MARKER_ANDROID` > /dev/null
../node_modules/react-native/packager/packager.sh --nonPersistent &
SERVER_PID=$!
# TODO Start the app and check it renders "Welcome to React Native"
echo "The Android e2e test is not implemented yet" >&2
exit 1
;;
*)
echo "Please run the script with --ios, --android or --packager" >&2
exit 1
;;
esac
# Iterates through all arguments and runs e2e tests for all of them one by one
# e.g. ./scripts/e2e-test.sh --packager --ios --android will run all e2e tests but will install the test app once
while test $# -gt 0
do
case $1 in
"--packager"*)
echo "Running a basic packager test"
# Check the packager produces a bundle (doesn't throw an error)
react-native bundle --platform android --dev true --entry-file index.android.js --bundle-output android-bundle.js
# Check that flow passes
$ROOT/node_modules/.bin/flow check
;;
"--ios"*)
echo "Running an iOS app"
cd ios
# Make sure we installed local version of react-native
ls EndToEndTest/`basename $MARKER_IOS` > /dev/null
../node_modules/react-native/packager/packager.sh --nonPersistent &
SERVER_PID=$!
# Start the app on the simulator
xctool -scheme EndToEndTest -sdk iphonesimulator test
;;
"--android"*)
echo "Running an Android app"
cd android
# Make sure we installed local version of react-native
ls `basename $MARKER_ANDROID` > /dev/null
../node_modules/react-native/packager/packager.sh --nonPersistent &
SERVER_PID=$!
cp ~/.android/debug.keystore keystores/debug.keystore
./gradlew :app:copyDownloadableDepsToLibs
buck install -r android/app
# TODO t10114777 check it renders "Welcome to React Native"
;;
*)
echo "Please run the script with --ios, --android or --packager" >&2
exit 1
;;
esac
shift
done
exit 0