mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Added ability to run Movies app with BUCK
Reviewed By: mkonicek Differential Revision: D2874873 fb-gh-sync-id: 9feface8d9a18742e68206dbafb804de25f53ed8 shipit-source-id: 9feface8d9a18742e68206dbafb804de25f53ed8
This commit is contained in:
committed by
facebook-github-bot-7
parent
9d3d9dfbce
commit
5112a63953
@@ -1,30 +1,10 @@
|
||||
# Unpack resources from the appcompat aar and merge their ids into the
|
||||
# generated com.facebook.react.R class.
|
||||
#
|
||||
# We do this for compatibility with Gradle: we build the open source
|
||||
# version React Native with both Buck and Gradle. See for example
|
||||
# ReactToolbarManager.java where we access the appcompat resources
|
||||
# via com.facebook.react.R.
|
||||
include_defs('//ReactAndroid/DEFS')
|
||||
|
||||
# used by ReactToolbarManager because of Gradle
|
||||
# TODO t10182713 will be replaced with res-for-appcompat when we stop using Gradle
|
||||
android_resource(
|
||||
name = 'res-for-react-native',
|
||||
res = ':res-unpacker-cmd',
|
||||
package = 'com.facebook.react',
|
||||
visibility = ['//ReactAndroid/...',],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = 'res-unpacker-cmd',
|
||||
cmd = '$(exe :res-unpacker) $(location :appcompat-binary-aar) $OUT',
|
||||
out = 'res',
|
||||
)
|
||||
|
||||
python_binary(
|
||||
name = 'res-unpacker',
|
||||
main = 'res-unpacker.py',
|
||||
)
|
||||
|
||||
remote_file(
|
||||
name = 'appcompat-binary-aar',
|
||||
url = 'mvn:com.android.support:appcompat-v7:aar:23.0.1',
|
||||
sha1 = '7d659f671541394a8bc2b9f909950aa2a5ec87ff',
|
||||
name = 'res-for-react-native',
|
||||
res = react_native_dep('third-party/android/support/v7/appcompat-orig:res-unpacker-cmd'),
|
||||
package = 'com.facebook.react',
|
||||
visibility = ['//ReactAndroid/...',],
|
||||
)
|
||||
|
||||
@@ -9,7 +9,6 @@ android_library(
|
||||
react_native_target('java/com/facebook/csslayout:csslayout'),
|
||||
react_native_target('java/com/facebook/react/uimanager:uimanager'),
|
||||
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
|
||||
react_native_dep('android_res/android/support/v7/appcompat-orig:res-for-react-native'),
|
||||
react_native_dep('third-party/android/support/v7/appcompat-orig:appcompat'),
|
||||
react_native_dep('third-party/java/jsr-305:jsr-305'),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.toolbar;
|
||||
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.toolbar;
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
android_prebuilt_aar(
|
||||
include_defs('//ReactAndroid/DEFS')
|
||||
|
||||
android_library(
|
||||
name = 'logging',
|
||||
aar = ':fbcore-binary-aar',
|
||||
visibility = ['//ReactAndroid/...'],
|
||||
exported_deps = [
|
||||
react_native_dep('libraries/fresco/fresco-react-native:fbcore'),
|
||||
],
|
||||
visibility = ['//ReactAndroid/...',],
|
||||
)
|
||||
|
||||
remote_file(
|
||||
name = 'fbcore-binary-aar',
|
||||
url = 'mvn:com.facebook.fresco:fbcore:aar:0.8.1',
|
||||
sha1 = 'cc46b3d564139bf63bb41534c7a723ee8119ae5f',
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
android_prebuilt_aar(
|
||||
name = 'lib-support-v4',
|
||||
aar = ':lib-support-v4-binary-aar',
|
||||
visibility = ['//ReactAndroid/...',],
|
||||
visibility = ['PUBLIC',],
|
||||
)
|
||||
|
||||
remote_file(
|
||||
|
||||
@@ -1,9 +1,59 @@
|
||||
android_prebuilt_aar(
|
||||
name = 'appcompat-23.1',
|
||||
aar = ':appcompat-binary-aar',
|
||||
include_defs('//ReactAndroid/DEFS')
|
||||
|
||||
# This is a bit messy and hopefully a temporary thing
|
||||
# The problem is that Gradle extracts appcompat resources into app namespace, com.facebook.react
|
||||
# While BUCK behaves properly and extracts them into android.support.v7.appcompat package.
|
||||
# We want to support both Gradle and BUCK builds so we hack a bit how BUCK extracts resources.
|
||||
# Besides that we still need JAVA classes from appcompat-v7.aar, that is why android_library
|
||||
# extracts classes.jar but the trick is that we can't take full appcompat.aar because resources
|
||||
# extracted from it by BUCK would conflict with resources we use under Gradelified package
|
||||
# All this mumbo jumbo will go away after t10182713
|
||||
|
||||
android_library(
|
||||
name = 'appcompat',
|
||||
deps = [
|
||||
':res-for-appcompat',
|
||||
],
|
||||
visibility = [
|
||||
'PUBLIC',
|
||||
],
|
||||
exported_deps = [
|
||||
':classes-for-react-native',
|
||||
],
|
||||
)
|
||||
|
||||
# still used by appcompat library internally, so we need both during the build
|
||||
android_resource(
|
||||
name = 'res-for-appcompat',
|
||||
res = ':res-unpacker-cmd',
|
||||
package = 'android.support.v7.appcompat',
|
||||
visibility = ['//ReactAndroid/...',],
|
||||
)
|
||||
|
||||
prebuilt_jar(
|
||||
name = 'classes-for-react-native',
|
||||
binary_jar = ':classes-unpacker-cmd',
|
||||
visibility = ['//ReactAndroid/...',],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = 'classes-unpacker-cmd',
|
||||
cmd = '$(exe :aar-unpacker) $(location :appcompat-binary-aar) "classes.jar" $OUT',
|
||||
out = 'classes.jar',
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = 'res-unpacker-cmd',
|
||||
cmd = '$(exe :aar-unpacker) $(location :appcompat-binary-aar) "res/" $OUT',
|
||||
out = 'res',
|
||||
visibility = ['//ReactAndroid/...',],
|
||||
)
|
||||
|
||||
python_binary(
|
||||
name = 'aar-unpacker',
|
||||
main = 'aar-unpacker.py',
|
||||
)
|
||||
|
||||
remote_file(
|
||||
name = 'appcompat-binary-aar',
|
||||
url = 'mvn:com.android.support:appcompat-v7:aar:23.0.1',
|
||||
|
||||
@@ -5,7 +5,7 @@ import sys
|
||||
import tempfile
|
||||
import zipfile
|
||||
|
||||
# Helper that unpacks the contents of the res folder of an .aar file
|
||||
# Helper that unpacks the contents of an .aar file
|
||||
# into given destination.
|
||||
|
||||
@contextlib.contextmanager
|
||||
@@ -16,5 +16,5 @@ def cleanup(path):
|
||||
if __name__ == '__main__':
|
||||
with zipfile.ZipFile(sys.argv[1], 'r') as z:
|
||||
with cleanup(tempfile.mkdtemp()) as temp_path:
|
||||
z.extractall(temp_path, filter(lambda n: n.startswith('res/'), z.namelist()))
|
||||
shutil.move(os.path.join(temp_path, 'res'), sys.argv[2])
|
||||
z.extractall(temp_path, filter(lambda n: n.startswith(sys.argv[2]), z.namelist()))
|
||||
shutil.move(os.path.join(temp_path, sys.argv[2]), sys.argv[3])
|
||||
@@ -1,7 +1,7 @@
|
||||
prebuilt_jar(
|
||||
name = 'jsr-305',
|
||||
binary_jar = ':jsr305-binary-jar',
|
||||
visibility = ['//ReactAndroid/...',],
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
remote_file(
|
||||
|
||||
Reference in New Issue
Block a user