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-04-05 22:24:12 +00:00
|
|
|
compile 'com.android.support:appcompat-v7:22.0.0'
|
2014-09-16 08:43:24 +00:00
|
|
|
compile 'com.android.support:support-v4-preferencefragment:1.0.0@aar'
|
2015-03-24 21:25:03 +00:00
|
|
|
androidTestCompile 'com.squareup.okhttp:mockwebserver:2.3.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
|
|
|
}
|
|
|
|
|
2015-03-21 00:32:49 +00:00
|
|
|
project.archivesBaseName = 'syncthing'
|
|
|
|
|
2014-05-12 16:54:26 +00:00
|
|
|
android {
|
2015-04-05 22:24:12 +00:00
|
|
|
compileSdkVersion 22
|
|
|
|
buildToolsVersion "22.0.1"
|
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/")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-20 23:56:59 +00:00
|
|
|
signingConfigs {
|
|
|
|
release {
|
2015-03-21 00:32:49 +00:00
|
|
|
if (System.getenv("key_alias")) {
|
|
|
|
storeFile = file(System.getenv("key_store"))
|
|
|
|
storePassword = System.getenv("key_store_password")
|
|
|
|
keyAlias = System.getenv("key_alias")
|
|
|
|
keyPassword = System.getenv("key_alias_password")
|
|
|
|
}
|
|
|
|
}
|
2015-03-20 23:56:59 +00:00
|
|
|
}
|
|
|
|
|
2014-08-18 09:30:03 +00:00
|
|
|
buildTypes {
|
|
|
|
debug {
|
|
|
|
applicationIdSuffix ".debug"
|
|
|
|
debuggable true
|
|
|
|
}
|
2015-03-20 23:56:59 +00:00
|
|
|
release {
|
2015-03-25 19:13:29 +00:00
|
|
|
minifyEnabled true
|
|
|
|
proguardFile getDefaultProguardFile('proguard-android.txt')
|
2015-03-21 00:32:49 +00:00
|
|
|
if (System.getenv("key_alias")) {
|
|
|
|
signingConfig signingConfigs.release
|
|
|
|
}
|
2015-03-20 23:56:59 +00:00
|
|
|
}
|
2014-08-18 09:30:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|