2016-02-10 02:03:33 +00:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
|
|
|
}
|
|
|
|
dependencies {
|
2018-07-12 07:26:49 +00:00
|
|
|
classpath 'com.android.tools.build:gradle:2.3.3'
|
2016-02-10 02:03:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
allprojects {
|
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
|
|
|
jcenter()
|
2016-03-10 23:16:31 +00:00
|
|
|
maven {
|
|
|
|
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
|
|
url "$projectDir/../../react-native/android"
|
|
|
|
}
|
2016-02-10 02:03:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
apply plugin: 'com.android.library'
|
|
|
|
|
2016-02-22 00:57:05 +00:00
|
|
|
task forwardDebugPort(type: Exec) {
|
2016-03-29 17:56:51 +00:00
|
|
|
def adb = android.getAdbExe()?.toString() ?: 'false'
|
2017-09-20 04:54:45 +00:00
|
|
|
commandLine adb, 'forward', 'tcp:8083', 'tcp:8083'
|
2016-02-22 00:57:05 +00:00
|
|
|
ignoreExitValue true
|
|
|
|
doLast {
|
|
|
|
if (execResult.getExitValue() != 0) {
|
|
|
|
logger.error(
|
|
|
|
'===========================================================================\n' +
|
2017-09-20 04:54:45 +00:00
|
|
|
'WARNING: Failed to automatically forward port 8083.\n' +
|
|
|
|
'In order to use Realm in Chrome debugging mode, port 8083 must be forwarded\n' +
|
2016-02-22 00:57:05 +00:00
|
|
|
'from localhost to the device or emulator being used to run the application.\n' +
|
|
|
|
'You may need to add the appropriate flags to the command that failed:\n' +
|
2017-09-20 04:54:45 +00:00
|
|
|
' adb forward tcp:8083 tcp:8083\n' +
|
2016-02-22 00:57:05 +00:00
|
|
|
'===========================================================================\n'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-10 02:03:33 +00:00
|
|
|
android {
|
2018-07-12 07:26:49 +00:00
|
|
|
compileSdkVersion rootProject.hasProperty("compileSdkVersion") ? rootProject.compileSdkVersion : 26
|
|
|
|
buildToolsVersion rootProject.hasProperty("buildToolsVersion") ? rootProject.buildToolsVersion : "26.0.2"
|
2016-02-10 02:03:33 +00:00
|
|
|
|
|
|
|
defaultConfig {
|
2018-07-12 07:26:49 +00:00
|
|
|
minSdkVersion rootProject.hasProperty("minSdkVersion") ? rootProject.minSdkVersion : 16
|
|
|
|
targetSdkVersion rootProject.hasProperty("targetSdkVersion") ? rootProject.targetSdkVersion : 26
|
2016-02-10 02:03:33 +00:00
|
|
|
}
|
2016-02-22 00:57:05 +00:00
|
|
|
|
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
compileTask -> compileTask.dependsOn forwardDebugPort
|
|
|
|
}
|
2016-02-10 02:03:33 +00:00
|
|
|
}
|
|
|
|
|
2016-06-30 12:26:36 +00:00
|
|
|
String getAppId () {
|
|
|
|
String myappId;
|
|
|
|
try {
|
|
|
|
String build = new File("$projectDir/../../../android/app/build.gradle").text
|
|
|
|
def matcher = build =~ 'applicationId.*"'
|
|
|
|
def appId = matcher.size() > 0 ? matcher[0].trim() - 'applicationId' - ~/\s/ : '';
|
|
|
|
myappId = appId.replaceAll('"', '')
|
|
|
|
} catch(all) {}
|
|
|
|
return myappId
|
|
|
|
}
|
|
|
|
|
|
|
|
apply from: 'analytics.gradle'
|
|
|
|
|
2017-02-15 11:35:20 +00:00
|
|
|
import groovy.json.JsonSlurper
|
|
|
|
|
|
|
|
def getNpmVersion() {
|
|
|
|
def inputFile = new File(buildscript.sourceFile.getParent() + "/../package.json")
|
|
|
|
def packageJson = new JsonSlurper().parseText(inputFile.text)
|
|
|
|
return packageJson["version"]
|
|
|
|
}
|
|
|
|
|
2017-02-15 12:56:21 +00:00
|
|
|
task send(type: SendAnalyticsTask) << {
|
2016-06-30 12:26:36 +00:00
|
|
|
applicationId = getAppId()
|
2017-02-15 11:35:20 +00:00
|
|
|
version = getNpmVersion().trim()
|
2016-06-30 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
preBuild.dependsOn send
|
|
|
|
|
2018-08-14 11:12:06 +00:00
|
|
|
def dependencyType = "implementation"
|
|
|
|
try {
|
|
|
|
project.getConfigurations().getByName("implementation")
|
|
|
|
} catch (UnknownConfigurationException e) {
|
|
|
|
dependencyType = "compile" // Pre 3.0 Android Gradle Plugin
|
|
|
|
}
|
|
|
|
|
|
|
|
project.dependencies {
|
|
|
|
add(dependencyType, fileTree(dir: 'libs', include: ['*.jar']))
|
|
|
|
add(dependencyType, 'org.nanohttpd:nanohttpd:2.2.0')
|
|
|
|
add(dependencyType, 'com.facebook.react:react-native:+')
|
2016-02-10 02:03:33 +00:00
|
|
|
}
|