229 lines
7.7 KiB
Groovy
229 lines
7.7 KiB
Groovy
apply plugin: 'com.android.library'
|
|
|
|
apply plugin: 'de.undercouch.download'
|
|
|
|
import de.undercouch.gradle.tasks.download.Download
|
|
import org.apache.tools.ant.taskdefs.condition.Os
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
def downloadsDir = new File("$buildDir/downloads")
|
|
def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
|
|
|
|
task createNativeDepsDirectories {
|
|
downloadsDir.mkdirs()
|
|
thirdPartyNdkDir.mkdirs()
|
|
}
|
|
|
|
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')
|
|
}
|
|
|
|
task prepareGlog(dependsOn: [downloadGlog], type: Copy) {
|
|
from tarTree(downloadGlog.dest)
|
|
from './third-party/glog/'
|
|
include 'glog-0.3.5/src/**/*', 'Android.mk', 'config.h', 'build.gradle', 'CMakeLists.txt', 'ApplicationManifest.xml'
|
|
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 finalizeGlog(dependsOn: [prepareGlog], type: Copy) {
|
|
from './third-party/glog/'
|
|
include 'logging.cc'
|
|
includeEmptyDirs = false
|
|
into "$thirdPartyNdkDir/glog/glog-0.3.5/src/"
|
|
}
|
|
|
|
task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Download) {
|
|
src 'https://github.com/google/double-conversion/archive/v3.0.0.tar.gz'
|
|
onlyIfNewer true
|
|
overwrite false
|
|
dest new File(downloadsDir, 'double-conversion-3.0.0.tar.gz')
|
|
}
|
|
|
|
task prepareDoubleConversion(dependsOn: [downloadDoubleConversion], type: Copy) {
|
|
from tarTree(downloadDoubleConversion.dest)
|
|
from './third-party/DoubleConversion/'
|
|
include 'double-conversion-3.0.0/**/*', 'build.gradle', 'CMakeLists.txt', 'ApplicationManifest.xml'
|
|
includeEmptyDirs = false
|
|
into "$thirdPartyNdkDir/double-conversion"
|
|
}
|
|
|
|
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 true
|
|
dest new File(downloadsDir, 'boost_1_63_0.tar.gz')
|
|
}
|
|
|
|
task prepareBoost(dependsOn: [downloadBoost], type: Copy) {
|
|
from tarTree(resources.gzip(downloadBoost.dest))
|
|
include 'boost_1_63_0/boost/**/*.hpp', 'boost_1_63_0/boost/**/*.h', 'boost/boost/**/*.hpp', 'boost/boost/**/*.h'
|
|
includeEmptyDirs = false
|
|
into "$thirdPartyNdkDir/boost"
|
|
doLast {
|
|
file("$thirdPartyNdkDir/boost/boost").renameTo("$thirdPartyNdkDir/boost/boost_1_63_0")
|
|
}
|
|
}
|
|
|
|
task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
|
|
src 'https://github.com/facebook/folly/archive/v2018.05.21.00.tar.gz'
|
|
onlyIfNewer true
|
|
overwrite false
|
|
dest new File(downloadsDir, 'folly-2018.05.21.00.tar.gz');
|
|
}
|
|
|
|
task prepareFolly(dependsOn: [downloadFolly], type: Copy) {
|
|
from tarTree(downloadFolly.dest)
|
|
from './third-party/folly/'
|
|
include 'folly-2018.05.21.00/folly/**/*', 'build.gradle', 'CMakeLists.txt', 'ApplicationManifest.xml'
|
|
eachFile {fname -> fname.path = (fname.path - "folly-2018.05.21.00/")}
|
|
includeEmptyDirs = false
|
|
into "$thirdPartyNdkDir/folly"
|
|
}
|
|
|
|
task downloadLibEvent(dependsOn: [], type: Download) {
|
|
src 'https://github.com/libevent/libevent/archive/release-2.1.8-stable.tar.gz'
|
|
onlyIfNewer true
|
|
overwrite false
|
|
dest new File(downloadsDir, 'libevent-release-2.1.8-stable.tar.gz');
|
|
}
|
|
|
|
task prepareLibEvent(dependsOn: [downloadLibEvent], type: Copy) {
|
|
from tarTree(downloadLibEvent.dest)
|
|
from './third-party/LibEvent/'
|
|
include 'libevent-release-2.1.8-stable/**/*', 'build.gradle', 'CMakeLists.txt', 'ApplicationManifest.xml'
|
|
includeEmptyDirs = false
|
|
into "$thirdPartyNdkDir/LibEvent"
|
|
}
|
|
|
|
task finalizeEvent(dependsOn: [prepareLibEvent], type: Copy) {
|
|
from './third-party/LibEvent/'
|
|
include 'event-config.h'
|
|
includeEmptyDirs = false
|
|
into "$thirdPartyNdkDir/LibEvent/libevent-release-2.1.8-stable/include/event2/"
|
|
}
|
|
|
|
task finalizeEvent2(dependsOn: [finalizeEvent], type: Copy) {
|
|
from './third-party/LibEvent/'
|
|
include 'libs/**/*'
|
|
includeEmptyDirs = false
|
|
into "$thirdPartyNdkDir/LibEvent/"
|
|
}
|
|
|
|
task downloadOpenSSL(dependsOn: [], type: Download) {
|
|
src 'https://github.com/priteshrnandgaonkar/openssl-android/archive/1.0.0.tar.gz'
|
|
onlyIfNewer true
|
|
overwrite false
|
|
dest new File(downloadsDir, 'openssl-android-1.0.0.tar.gz');
|
|
}
|
|
|
|
task prepareOpenSSL(dependsOn: [downloadOpenSSL], type: Copy) {
|
|
from tarTree(downloadOpenSSL.dest)
|
|
from './third-party/OpenSSL/'
|
|
include 'openssl-android-1.0.0/**/*', 'libs/**/*'
|
|
includeEmptyDirs = false
|
|
into "$thirdPartyNdkDir/OpenSSL/"
|
|
}
|
|
|
|
task finalizeOpenSSL(dependsOn: [prepareOpenSSL], type: Copy) {
|
|
from './third-party/OpenSSL/'
|
|
include 'build.gradle', 'ApplicationManifest.xml'
|
|
includeEmptyDirs = false
|
|
into "$thirdPartyNdkDir/OpenSSL/openssl-android-1.0.0/"
|
|
}
|
|
|
|
task prepareAllLibs() {
|
|
dependsOn finalizeGlog
|
|
dependsOn prepareDoubleConversion
|
|
dependsOn prepareBoost
|
|
dependsOn prepareFolly
|
|
dependsOn finalizeEvent2
|
|
dependsOn finalizeOpenSSL
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion rootProject.compileSdkVersion
|
|
buildToolsVersion rootProject.buildToolsVersion
|
|
|
|
defaultConfig {
|
|
minSdkVersion rootProject.minSdkVersion
|
|
targetSdkVersion rootProject.targetSdkVersion
|
|
buildConfigField "boolean", "IS_INTERNAL_BUILD", 'true'
|
|
ndk {
|
|
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
|
}
|
|
|
|
externalNativeBuild {
|
|
cmake {
|
|
arguments '-DANDROID_TOOLCHAIN=clang'
|
|
}
|
|
}
|
|
}
|
|
lintOptions {
|
|
abortOnError false
|
|
}
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile './AndroidManifest.xml'
|
|
java {
|
|
srcDir 'android'
|
|
srcDir 'core'
|
|
srcDir 'plugins'
|
|
exclude 'console/ConsoleSonarPlugin.java'
|
|
exclude 'console/JavascriptEnvironment.java'
|
|
exclude 'console/JavascriptSession.java'
|
|
}
|
|
res {
|
|
srcDir 'res'
|
|
}
|
|
}
|
|
}
|
|
externalNativeBuild {
|
|
cmake {
|
|
path './CMakeLists.txt'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(':fbjni')
|
|
implementation deps.soloader
|
|
compileOnly deps.lithoAnnotations
|
|
implementation 'org.glassfish:javax.annotation:10.0-b28'
|
|
implementation deps.guava
|
|
implementation deps.jsr305
|
|
implementation deps.supportAppCompat
|
|
implementation deps.stetho
|
|
implementation deps.okhttp3
|
|
implementation 'com.facebook.litho:litho-core:0.15.0'
|
|
implementation 'com.facebook.litho:litho-widget:0.15.0'
|
|
implementation fileTree(dir: 'plugins/console/dependencies', include: ['*.jar'])
|
|
}
|
|
}
|
|
|
|
project.afterEvaluate {
|
|
preBuild.dependsOn prepareAllLibs
|
|
}
|