forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DEFS
99 lines (81 loc) · 3.12 KB
/
DEFS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Helpers for referring to React Native open source code.
#
# This lets us build React Native:
# - At Facebook by running buck from the root of the fb repo
# - Outside of Facebook by running buck in the root of the git repo
import os
# Example: react_native_target('java/com/facebook/react/common:common')
def react_native_target(path):
return '//ReactAndroid/src/main/' + path
# Example: react_native_tests_target('java/com/facebook/react/modules:modules')
def react_native_tests_target(path):
return '//ReactAndroid/src/test/' + path
# Example: react_native_integration_tests_target('java/com/facebook/react/testing:testing')
def react_native_integration_tests_target(path):
return '//ReactAndroid/src/androidTest/' + path
# Helper for referring to non-RN code from RN OSS code.
# Example: react_native_dep('java/com/facebook/systrace:systrace')
def react_native_dep(path):
return '//ReactAndroid/src/main/' + path
JSC_DEPS = [
'//native/third-party/jsc:jsc',
'//native/third-party/jsc:jsc_legacy_profiler',
]
JSC_INTERNAL_DEPS = [
'//native/third-party/jsc-internal:jsc',
'//native/third-party/jsc-internal:jsc_legacy_profiler',
]
INTERNAL_APP = 'PUBLIC'
# React property preprocessor
original_android_library=android_library
def android_library(
name,
deps=[],
annotation_processors=[],
annotation_processor_deps=[],
*args,
**kwargs):
common_processors = [
'com.facebook.react.processing.ReactPropertyProcessor',
]
common_processor_deps = [
react_native_target('java/com/facebook/react/processing:processing'),
]
if react_native_target('java/com/facebook/react/uimanager/annotations:annotations') in deps and name != 'processing':
annotation_processors = list(set(annotation_processors + common_processors))
annotation_processor_deps = list(set(annotation_processor_deps + common_processor_deps))
original_android_library(
name=name,
deps=deps,
annotation_processors=annotation_processors,
annotation_processor_deps=annotation_processor_deps,
*args,
**kwargs)
def robolectric3_test(name, deps, vm_args=None, *args, **kwargs):
vm_args = vm_args or []
# We may need to create buck-out/gen/ if we're running after buck clean.
tmp = 'buck-out/gen/' + get_base_path() + '/__java_test_' + name + '_output__'
extra_vm_args = [
'-XX:+UseConcMarkSweepGC', # required by -XX:+CMSClassUnloadingEnabled
'-XX:+CMSClassUnloadingEnabled',
'-XX:ReservedCodeCacheSize=150M',
'-Drobolectric.dependency.dir=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric3/robolectric',
'-Dlibraries=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric3/robolectric/*.jar',
'-Drobolectric.logging.enabled=true',
'-XX:MaxPermSize=620m',
'-Drobolectric.offline=true',
]
if os.path.isdir("/dev/shm"):
extra_vm_args.append('-Djava.io.tmpdir=/dev/shm')
else:
extra_vm_args.append(
'-Djava.io.tmpdir=%s' % os.path.join(os.path.abspath('.'),
'buck-out/bin'))
# defined in BUCK
robolectric_test(
name=name,
deps=deps,
vm_args=vm_args + extra_vm_args,
*args,
**kwargs
)