2014-05-12 16:54:26 +00:00
|
|
|
buildscript {
|
2014-08-18 09:30:03 +00:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2014-08-25 23:51:07 +00:00
|
|
|
jcenter()
|
2014-09-16 08:43:24 +00:00
|
|
|
|
2014-08-18 09:30:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2015-02-22 19:43:59 +00:00
|
|
|
classpath 'com.android.tools.build:gradle:1.1.0'
|
|
|
|
classpath 'com.github.ben-manes:gradle-versions-plugin:0.8'
|
2014-08-18 09:30:03 +00:00
|
|
|
}
|
2014-05-12 16:54:26 +00:00
|
|
|
}
|
|
|
|
|
2014-05-17 20:57:04 +00:00
|
|
|
import java.util.regex.Pattern
|
|
|
|
|
2014-07-27 20:00:07 +00:00
|
|
|
apply plugin: 'com.android.application'
|
2014-08-25 23:51:07 +00:00
|
|
|
apply plugin: 'com.github.ben-manes.versions'
|
2014-05-12 16:54:26 +00:00
|
|
|
|
2014-05-13 08:40:54 +00:00
|
|
|
repositories {
|
2014-08-18 09:30:03 +00:00
|
|
|
mavenCentral()
|
2014-09-16 08:43:24 +00:00
|
|
|
maven {
|
|
|
|
url {
|
|
|
|
'https://raw.github.com/kolavar/android-support-v4-preferencefragment/master/maven-repository/'
|
|
|
|
}
|
|
|
|
}
|
2014-05-13 08:40:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2015-01-21 15:53:48 +00:00
|
|
|
compile 'com.android.support:appcompat-v7:21.0.3'
|
2014-09-16 08:43:24 +00:00
|
|
|
compile 'com.android.support:support-v4-preferencefragment:1.0.0@aar'
|
2015-01-21 15:53:48 +00:00
|
|
|
androidTestCompile 'com.squareup.okhttp:mockwebserver:2.2.0'
|
2014-05-13 08:40:54 +00:00
|
|
|
}
|
|
|
|
|
2014-08-20 21:58:28 +00:00
|
|
|
preBuild {
|
2014-08-18 09:30:03 +00:00
|
|
|
dependsOn 'buildNative'
|
2014-08-20 21:58:28 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 16:54:26 +00:00
|
|
|
android {
|
2014-10-18 11:58:23 +00:00
|
|
|
compileSdkVersion 21
|
2015-02-22 19:43:59 +00:00
|
|
|
buildToolsVersion "21.1.2"
|
2014-08-18 09:30:03 +00:00
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
versionCode getVersionCodeFromManifest()
|
2014-08-22 12:38:11 +00:00
|
|
|
testApplicationId 'com.nutomic.syncthingandroid.test'
|
|
|
|
testInstrumentationRunner 'android.test.InstrumentationTestRunner'
|
|
|
|
testHandleProfiling true
|
|
|
|
testFunctionalTest true
|
2014-08-18 09:30:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
jniLibs.srcDir file("libs/")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
debug {
|
|
|
|
applicationIdSuffix ".debug"
|
|
|
|
debuggable true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
productFlavors {
|
|
|
|
x86 {
|
|
|
|
versionCode Integer.parseInt("4" + defaultConfig.versionCode)
|
|
|
|
ndk {
|
|
|
|
abiFilter "x86"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
armeabi {
|
2015-01-14 10:51:07 +00:00
|
|
|
versionCode Integer.parseInt("3" + defaultConfig.versionCode)
|
2014-08-18 09:30:03 +00:00
|
|
|
ndk {
|
|
|
|
abiFilter "armeabi"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fat {
|
|
|
|
versionCode Integer.parseInt("0" + defaultConfig.versionCode)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_7
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_7
|
|
|
|
}
|
2014-05-17 20:57:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def getVersionCodeFromManifest() {
|
2014-08-18 09:30:03 +00:00
|
|
|
def manifestFile = file(android.sourceSets.main.manifest.srcFile)
|
|
|
|
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
|
|
|
|
def matcher = pattern.matcher(manifestFile.getText())
|
|
|
|
matcher.find()
|
|
|
|
return Integer.parseInt(matcher.group(1))
|
2014-05-12 16:54:26 +00:00
|
|
|
}
|
2014-05-17 20:57:04 +00:00
|
|
|
|
2014-06-27 15:24:23 +00:00
|
|
|
task buildNative(type: Exec) {
|
2014-08-18 09:30:03 +00:00
|
|
|
outputs.upToDateWhen { false }
|
|
|
|
executable = './build-syncthing.sh'
|
2014-05-17 20:57:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
task copyNative(type: Copy) {
|
2014-08-18 09:30:03 +00:00
|
|
|
def lib_dir = "libs/"
|
|
|
|
new File(lib_dir).mkdirs()
|
|
|
|
def st_dir = "bin/";
|
2015-01-15 17:52:59 +00:00
|
|
|
from st_dir + 'syncthing-x86', st_dir + 'syncthing-armeabi';
|
2014-08-18 09:30:03 +00:00
|
|
|
into lib_dir
|
|
|
|
rename('syncthing-x86', 'x86/libsyncthing.so')
|
|
|
|
rename('syncthing-armeabi', 'armeabi/libsyncthing.so')
|
2014-05-17 20:57:04 +00:00
|
|
|
}
|
|
|
|
buildNative.finalizedBy copyNative
|
|
|
|
|
2014-08-20 21:58:28 +00:00
|
|
|
task cleanBin(type: Delete) {
|
2014-08-18 09:30:03 +00:00
|
|
|
delete 'bin/'
|
2014-08-20 21:58:28 +00:00
|
|
|
}
|
|
|
|
copyNative.finalizedBy cleanBin
|
|
|
|
|
2014-05-17 20:57:04 +00:00
|
|
|
task cleanNative(type: Delete) {
|
2014-08-18 09:30:03 +00:00
|
|
|
delete 'bin/'
|
|
|
|
delete 'build/'
|
|
|
|
delete 'libs/'
|
|
|
|
delete 'ext/syncthing/bin/'
|
|
|
|
delete 'ext/syncthing/pkg/'
|
2014-05-18 13:18:42 +00:00
|
|
|
}
|
2014-08-20 21:58:28 +00:00
|
|
|
clean.dependsOn cleanNative
|
|
|
|
|