-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
243 lines (213 loc) · 9.94 KB
/
build.gradle
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
apply plugin: 'com.android.library'
apply plugin: 'de.undercouch.download'
import org.apache.tools.ant.filters.ReplaceTokens
def MOCKITO_CORE_VERSION="1.10.19"
def POWERMOCK_VERSION="1.6.2"
def ROBOLECTRIC_VERSION="3.0"
def FEST_ASSERT_CORE_VERSION="2.0M10"
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 56
versionName "0.56.0006"
ndk {
moduleName "reactnativesurface"
}
buildConfigField 'boolean', 'IS_INTERNAL_BUILD', 'false'
buildConfigField 'int', 'EXOPACKAGE_FLAGS', '0'
testApplicationId "com.facebook.react.tests.gradle"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-fexceptions"
abiFilters "x86", "armeabi-v7a", "x86_64", "arm64-v8a"
arguments "-DANDROID_CPP_FEATURES=rtti exceptions"
}
}
sourceSets.main {
jni.srcDirs = []
jniLibs.srcDir "$buildDir/react-ndk/exported"
res.srcDirs += ['src/../../deps/react-native-0.56.0/ReactAndroid/src/main/res/devsupport',
'src/../../deps/react-native-0.56.0/ReactAndroid/src/main/res/shell',
'src/../../deps/react-native-0.56.0/ReactAndroid/src/main/res/views/modal',
'src/../../deps/react-native-0.56.0/ReactAndroid/src/main/res/views/uimanager']
java {
srcDirs += ['src/../../deps/react-native-0.56.0/ReactAndroid/src/main/java',
'src/../../deps/react-native-0.56.0/ReactAndroid/src/main/libraries/soloader/java',
'src/../../deps/react-native-0.56.0/ReactAndroid/src/main/jni/first-party/fb/jni/java']
exclude 'com/facebook/react/processing'
exclude 'com/facebook/react/module/processing'
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn prepareNdkBuildDependencies
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
// We download various C++ open-source dependencies into downloads.
// We then copy both the downloaded code and our custom makefiles and headers into third-party-ndk.
// After that we build native code from src/main/jni with module path pointing at third-party-ndk.
def customDownloadsDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR")
def downloadsDir = customDownloadsDir ? new File(customDownloadsDir) : new File("$buildDir/downloads")
def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
// You need to have following folders in this directory:
// - boost_1_63_0
// - double-conversion-1.1.1
// - folly-deprecate-dynamic-initializer
// - glog-0.3.5
// - jsc-headers
def dependenciesPath = System.getenv("REACT_NATIVE_DEPENDENCIES")
task createNativeDepsDirectories {
downloadsDir.mkdirs()
thirdPartyNdkDir.mkdirs()
}
// The Boost library is a very large download (>100MB).
// If Boost is already present on your system, define the REACT_NATIVE_BOOST_PATH env variable
// and the build will use that.
def boostPath = dependenciesPath ?: System.getenv("REACT_NATIVE_BOOST_PATH")
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
src 'https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz'
onlyIfNewer true
overwrite false
dest new File(downloadsDir, 'boost_1_63_0.tar.gz')
}
task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
from boostPath ?: tarTree(resources.gzip(downloadBoost.dest))
from 'src/main/jni/third-party/boost/Android.mk'
include 'Android.mk', 'boost_1_63_0/boost/**/*.hpp', 'boost/boost/**/*.hpp'
includeEmptyDirs = false
into "$thirdPartyNdkDir/boost"
doLast {
file("$thirdPartyNdkDir/boost/boost").renameTo("$thirdPartyNdkDir/boost/boost_1_63_0")
}
}
task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Download) {
src 'https://github.com/google/double-conversion/archive/v1.1.8.tar.gz'
onlyIfNewer true
overwrite false
dest new File(downloadsDir, 'double-conversion-1.1.8.tar.gz')
}
task prepareDoubleConversion(dependsOn: dependenciesPath ? [] : [downloadDoubleConversion], type: Copy) {
from dependenciesPath ?: tarTree(downloadDoubleConversion.dest)
from '../deps/react-native-0.56.0/ReactAndroid/src/main/jni/third-party/double-conversion/Android.mk'
include 'double-conversion-1.1.8/src/**/*', 'Android.mk'
filesMatching('*/src/**/*', {fname -> fname.path = "double-conversion/${fname.name}"})
includeEmptyDirs = false
into "$thirdPartyNdkDir/double-conversion"
}
task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
src 'https://github.com/facebook/folly/archive/v2016.10.31.00.tar.gz'
onlyIfNewer true
overwrite false
dest new File(downloadsDir, 'folly-2016.10.31.00.tar.gz')
}
task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy) {
from dependenciesPath ?: tarTree(downloadFolly.dest)
from '../deps/react-native-0.56.0/ReactAndroid/src/main/jni/third-party/folly/Android.mk'
include 'folly-2016.10.31.00/folly/**/*', 'Android.mk'
eachFile {fname -> fname.path = (fname.path - "folly-2016.10.31.00/")}
includeEmptyDirs = false
into "$thirdPartyNdkDir/folly"
}
task downloadGlog(dependsOn: createNativeDepsDirectories, type: Download) {
src 'https://github.com/google/glog/archive/v0.3.5.tar.gz'
onlyIfNewer true
overwrite false
dest new File(downloadsDir, 'glog-0.3.5.tar.gz')
}
// Prepare glog sources to be compiled, this task will perform steps that normally should've been
// executed by automake. This way we can avoid dependencies on make/automake
task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy) {
from dependenciesPath ?: tarTree(downloadGlog.dest)
from '../deps/react-native-0.56.0/ReactAndroid/src/main/jni/third-party/glog/'
include 'glog-0.3.5/src/**/*', 'Android.mk', 'config.h'
includeEmptyDirs = false
filesMatching('**/*.h.in') {
filter(ReplaceTokens, tokens: [
ac_cv_have_unistd_h: '1',
ac_cv_have_stdint_h: '1',
ac_cv_have_systypes_h: '1',
ac_cv_have_inttypes_h: '1',
ac_cv_have_libgflags: '0',
ac_google_start_namespace: 'namespace google {',
ac_cv_have_uint16_t: '1',
ac_cv_have_u_int16_t: '1',
ac_cv_have___uint16: '0',
ac_google_end_namespace: '}',
ac_cv_have___builtin_expect: '1',
ac_google_namespace: 'google',
ac_cv___attribute___noinline: '__attribute__ ((noinline))',
ac_cv___attribute___noreturn: '__attribute__ ((noreturn))',
ac_cv___attribute___printf_4_5: '__attribute__((__format__ (__printf__, 4, 5)))'
])
it.path = (it.name - '.in')
}
into "$thirdPartyNdkDir/glog"
}
task prepareNdkBuildDependencies {
dependsOn prepareBoost
dependsOn prepareDoubleConversion
dependsOn prepareFolly
dependsOn prepareGlog
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
implementation fileTree(dir: 'src/../../deps/react-native-0.56.0/ReactAndroid/src/main/third-party/java/infer-annotations/', include: ['*.jar'])
implementation 'javax.inject:javax.inject:1'
implementation 'com.facebook.fbui.textlayoutbuilder:textlayoutbuilder:1.5.0'
implementation 'com.facebook.fresco:fresco:1.9.0'
implementation 'com.facebook.fresco:imagepipeline-okhttp3:1.9.0'
implementation 'com.facebook.soloader:soloader:0.3.0'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
implementation 'com.squareup.okio:okio:1.14.0'
testImplementation "org.powermock:powermock-api-mockito:${POWERMOCK_VERSION}"
testImplementation "org.powermock:powermock-module-junit4-rule:${POWERMOCK_VERSION}"
testImplementation "org.powermock:powermock-classloading-xstream:${POWERMOCK_VERSION}"
testImplementation "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}"
testImplementation "org.easytesting:fest-assert-core:${FEST_ASSERT_CORE_VERSION}"
testImplementation "org.robolectric:robolectric:${ROBOLECTRIC_VERSION}"
androidTestImplementation fileTree(dir: 'src/../../deps/react-native-0.56.0/ReactAndroid/src/main/third-party/java/buck-android-support/', include: ['*.jar'])
androidTestImplementation "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}"
}
try {
apply from: new File(rootProject.projectDir, 'node_modules/liquidcore/addon.gradle')
} catch (Exception e) {
apply from: new File(buildscript.getSourceFile(), '../node_modules/liquidcore/addon.gradle')
}
try {
apply from: new File(rootProject.projectDir, 'node_modules/@liquidcore/caraml-core/include.gradle')
} catch (Exception e) {
apply from: new File(buildscript.getSourceFile(), '../node_modules/@liquidcore/caraml-core/include.gradle')
}