react-native/local-cli
Martin Konicek 702f999b05 Consume Android artifacts from npm
Summary:
This lets us say goodbye to Maven Central. This will greatly simplify
and speed up the release process as releasing Android artifacts to
Maven Central adds a lot of [complexity](https://github.com/facebook/react-native/blob/master/Releases-publish.md)
and delays the whole release by several hours when we have to wait
for the artifacts to propagate.

This diff assumes there's a local Maven repo at
`node_modules/react-native/android`.

The second part once this lands is to change our `release.sh` script to
output the artifacts under `react-native/android` before publishing to
npm.

This adds 3.7MB to the size of `node_modules` of any app. However,
we just download eagerly what we'd normally download later via Gradle.

**Test plan**

Released RN including a local Maven repo into Sinopia:

    $ cd react-native
    # Updated version in gradle.properties to 0.21.0
    $ ./gradlew ReactAndroid:installArchives
    # Moved everything in .m2/repository/com/facebook/react to react-native/android
    $ ls react-native/android
    com/facebook/react/react-native/0.21.0/react-native-0.21.0.aar
    com/facebook/react/react-native/0.21.0/react-native-0.21.0.pom
    com/facebook/react/react-native/maven-metadata.xml
    ...

    # Set version in package.json to 0.21.0
    $ npm set registry http://localhost:4873/
    $ npm publish

Created and ran an app:

   $ cd /tmp
   $ react-native init AndroidNpm
   $ cd AndroidNpm
   $ react-native run-android

It worked.

Checked that we're using the artifacts from node_modules/react-native/android:

    $ cd android
    $ ./gradlew app:dependencies
    compile - Classpath for compiling the main sources.
    +--- com.android.support:appcompat-v7:23.0.1
    |    \--- com.android.support:support-v4:23.0.1
    |         \--- com.android.support:support-annotations:23.0.1
    \--- com.facebook.react:react-native:+ -> 0.21.0
         +--- com.google.code.findbugs:jsr305:3.0.0
         +--- com.facebook.stetho:stetho-okhttp:1.2.0
    ...

Checked that Android Studio can find the source jars (you can navigate to RN sources in Android Studio). Opened the new project as described in the [docs](https://facebook.github.io/react-native/docs/android-setup.html#editing-your-app-s-java-code-in-android-studio).

public

Reviewed By: bestander

Differential Revision: D2912557

fb-gh-sync-id: 251c180518a3fb9bb8e80963b236e982d65533be
shipit-source-id: 251c180518a3fb9bb8e80963b236e982d65533be
2016-02-09 06:37:34 -08:00
..
__mocks__ Fix more tests 2015-09-16 13:05:30 -07:00
__tests__ Temporarily disable cli tests 2015-11-12 07:05:01 -08:00
bundle Add ability to load “unbundles” to android 2016-01-21 14:13:50 -08:00
dependencies Use same options on dependencies and bundle commands 2016-01-11 15:31:33 -08:00
generate Revert "Add folders to attempt to unblock sync" 2015-10-26 22:48:10 +00:00
generator Update templates to ES2015 2015-12-25 02:17:30 -08:00
generator-android Consume Android artifacts from npm 2016-02-09 06:37:34 -08:00
generator-ios Improve react-native-xcode.sh integration 2016-01-25 12:36:33 -08:00
library Introduce react-native link 2015-10-27 11:22:28 -07:00
runAndroid fix run-android looking for packager in wrong place 2015-11-06 12:05:28 -08:00
runIOS Added `react-native run-ios` 2016-01-05 17:18:49 -08:00
server Clean up Bundler 2016-02-08 11:19:31 -08:00
upgrade Add warnings while upgrading RN with `react-native upgrade` 2016-01-05 09:58:28 -08:00
util Revert "Add folders to attempt to unblock sync" 2015-10-26 22:48:10 +00:00
cli.js chore: remove extra require 2016-01-17 18:17:39 -08:00
default.config.js More descriptive comment in default.config.js 2015-11-12 07:43:25 -08:00
generate-android.js Add license headers to local-cli 2015-10-20 09:55:21 -07:00
generator-utils.js Add license headers to local-cli 2015-10-20 09:55:21 -07:00
setup_env.bat Fix comments on .bat file 2015-10-28 21:36:07 -04:00
setup_env.sh Change ulimit to 2048 for non root Mac users 2016-02-06 11:45:37 -08:00
wrong-react-native.js Return non-zero exit code from wrong-react-native 2016-01-05 15:22:59 -08:00