2016-02-10 02:03:33 +00:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
classpath 'com.android.tools.build:gradle:1.3.1'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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'
|
|
|
|
commandLine adb, 'forward', 'tcp:8082', 'tcp:8082'
|
2016-02-22 00:57:05 +00:00
|
|
|
ignoreExitValue true
|
|
|
|
doLast {
|
|
|
|
if (execResult.getExitValue() != 0) {
|
|
|
|
logger.error(
|
|
|
|
'===========================================================================\n' +
|
|
|
|
'WARNING: Failed to automatically forward port 8082.\n' +
|
|
|
|
'In order to use Realm in Chrome debugging mode, port 8082 must be forwarded\n' +
|
|
|
|
'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' +
|
|
|
|
' adb forward tcp:8082 tcp:8082\n' +
|
|
|
|
'===========================================================================\n'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-10 02:03:33 +00:00
|
|
|
android {
|
|
|
|
compileSdkVersion 23
|
|
|
|
buildToolsVersion "23.0.1"
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
minSdkVersion 16
|
|
|
|
targetSdkVersion 22
|
|
|
|
}
|
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"]
|
|
|
|
}
|
|
|
|
|
2016-06-30 12:26:36 +00:00
|
|
|
task send(type: SendAnalyticsTask) {
|
|
|
|
applicationId = getAppId()
|
2017-02-15 11:35:20 +00:00
|
|
|
version = getNpmVersion().trim()
|
2016-06-30 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
preBuild.dependsOn send
|
|
|
|
|
2016-02-10 02:03:33 +00:00
|
|
|
dependencies {
|
|
|
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
|
|
compile 'org.nanohttpd:nanohttpd:2.2.0'
|
2016-03-10 23:16:31 +00:00
|
|
|
compile 'com.facebook.react:react-native:+' // From node_modules
|
2016-02-10 02:03:33 +00:00
|
|
|
}
|