2015-01-14 12:12:47 +01:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
|
2015-12-12 20:18:13 +01:00
|
|
|
def getVersionName = { ->
|
|
|
|
def stdout = new ByteArrayOutputStream()
|
|
|
|
exec {
|
2017-06-26 11:45:15 +02:00
|
|
|
commandLine 'git', 'describe', '--tags', '--always'
|
2015-12-12 20:18:13 +01:00
|
|
|
standardOutput = stdout
|
|
|
|
}
|
|
|
|
return stdout.toString().trim()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-14 12:12:47 +01:00
|
|
|
android {
|
2017-11-11 16:26:18 +01:00
|
|
|
compileSdkVersion 26
|
|
|
|
buildToolsVersion "26.0.2"
|
2015-01-14 12:12:47 +01:00
|
|
|
|
|
|
|
defaultConfig {
|
2015-03-09 22:35:18 +01:00
|
|
|
applicationId "org.xbmc.kore"
|
2015-01-14 12:12:47 +01:00
|
|
|
minSdkVersion 15
|
2017-11-11 16:26:18 +01:00
|
|
|
targetSdkVersion 26
|
2017-09-15 18:01:43 +02:00
|
|
|
versionCode 18
|
2015-12-12 20:18:13 +01:00
|
|
|
versionName = getVersionName()
|
2015-01-14 12:12:47 +01:00
|
|
|
}
|
|
|
|
|
2015-03-04 20:01:58 +01:00
|
|
|
File keystoreFile = file('keystore.properties')
|
|
|
|
|
2015-01-14 12:12:47 +01:00
|
|
|
signingConfigs {
|
|
|
|
release {
|
2015-03-04 20:01:58 +01:00
|
|
|
if (keystoreFile.exists()) {
|
|
|
|
def Properties keyProps = new Properties()
|
|
|
|
keyProps.load(new FileInputStream(keystoreFile))
|
2015-01-14 12:12:47 +01:00
|
|
|
|
2015-03-04 20:01:58 +01:00
|
|
|
storeFile file(keyProps["store"])
|
|
|
|
keyAlias keyProps["alias"]
|
|
|
|
storePassword keyProps["storePass"]
|
|
|
|
keyPassword keyProps["pass"]
|
|
|
|
}
|
2015-01-14 12:12:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-08 12:43:10 +01:00
|
|
|
sourceSets {
|
|
|
|
fullDebug {
|
2017-01-03 17:14:22 +01:00
|
|
|
assets.srcDirs += 'src/testUtils/assets'
|
2016-11-08 12:43:10 +01:00
|
|
|
}
|
|
|
|
test {
|
2017-01-03 17:14:22 +01:00
|
|
|
java.srcDirs += 'src/testUtils/java'
|
|
|
|
}
|
|
|
|
androidTest {
|
|
|
|
java.srcDirs += 'src/testUtils/java'
|
2016-11-08 12:43:10 +01:00
|
|
|
}
|
|
|
|
instrumentationTest {
|
2017-01-03 17:14:22 +01:00
|
|
|
assets.srcDirs += 'src/testUtils/assets'
|
2016-11-08 12:43:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-15 14:42:53 +01:00
|
|
|
productFlavors {
|
2016-06-17 20:09:23 +02:00
|
|
|
full {
|
|
|
|
}
|
|
|
|
|
2016-03-15 14:42:53 +01:00
|
|
|
instrumentationTest {
|
|
|
|
applicationId "org.xbmc.kore.instrumentationtest"
|
|
|
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
2016-11-08 12:43:10 +01:00
|
|
|
proguardFiles 'proguardTest-rules.pro'
|
2016-03-15 14:42:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-14 12:12:47 +01:00
|
|
|
buildTypes {
|
|
|
|
// debug {
|
|
|
|
// minifyEnabled true
|
|
|
|
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
// }
|
|
|
|
|
|
|
|
release {
|
2015-03-04 20:01:58 +01:00
|
|
|
if (keystoreFile.exists()) {
|
|
|
|
signingConfig signingConfigs.release
|
|
|
|
}
|
2015-01-14 12:12:47 +01:00
|
|
|
minifyEnabled true
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-01 16:00:12 +01:00
|
|
|
lintOptions {
|
|
|
|
// Too much trouble keeping all translations in sync
|
|
|
|
disable 'MissingTranslation'
|
2015-04-18 12:42:11 +02:00
|
|
|
|
2017-12-22 19:20:41 +01:00
|
|
|
//The xml launcher icon introduced in API 26 causes lint to generate
|
|
|
|
//an error that the icon is not a PNG format
|
|
|
|
//This reduces the error to a warning
|
|
|
|
warning 'IconLauncherFormat'
|
2015-02-01 16:00:12 +01:00
|
|
|
}
|
|
|
|
|
2015-03-09 23:05:58 +01:00
|
|
|
// allprojects {
|
|
|
|
// gradle.projectsEvaluated {
|
|
|
|
// tasks.withType(JavaCompile) {
|
|
|
|
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
2015-01-14 12:12:47 +01:00
|
|
|
packagingOptions {
|
|
|
|
exclude 'META-INF/DEPENDENCIES'
|
|
|
|
exclude 'META-INF/NOTICE'
|
|
|
|
exclude 'META-INF/LICENSE'
|
|
|
|
exclude 'META-INF/LICENSE.txt'
|
|
|
|
exclude 'META-INF/NOTICE.txt'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-06 12:45:40 +01:00
|
|
|
ext {
|
2017-11-11 16:26:18 +01:00
|
|
|
supportLibVersion = '26.1.0'
|
2017-01-06 12:45:40 +01:00
|
|
|
}
|
|
|
|
|
2015-01-14 12:12:47 +01:00
|
|
|
dependencies {
|
2017-01-06 12:45:40 +01:00
|
|
|
compile "com.android.support:support-v4:${supportLibVersion}"
|
|
|
|
compile "com.android.support:appcompat-v7:${supportLibVersion}"
|
|
|
|
compile "com.android.support:cardview-v7:${supportLibVersion}"
|
|
|
|
compile "com.android.support:preference-v14:${supportLibVersion}"
|
|
|
|
compile "com.android.support:support-v13:${supportLibVersion}"
|
2015-01-14 12:12:47 +01:00
|
|
|
|
2015-04-18 12:42:11 +02:00
|
|
|
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.2'
|
|
|
|
compile 'com.jakewharton:butterknife:6.1.0'
|
2015-04-18 11:52:31 +02:00
|
|
|
compile 'com.squareup.okhttp:okhttp:2.3.0'
|
|
|
|
compile 'com.squareup.picasso:picasso:2.5.2'
|
2015-04-18 12:42:11 +02:00
|
|
|
compile 'de.greenrobot:eventbus:2.4.0'
|
2016-12-19 20:41:30 +01:00
|
|
|
compile 'org.jmdns:jmdns:3.5.1'
|
2015-01-14 12:12:47 +01:00
|
|
|
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
|
2015-04-18 12:42:11 +02:00
|
|
|
compile 'com.melnykov:floatingactionbutton:1.3.0'
|
2016-12-19 20:23:51 +01:00
|
|
|
compile 'at.blogc:expandabletextview:1.0.3'
|
2017-07-13 20:10:49 +02:00
|
|
|
compile 'com.sothree.slidinguppanel:library:3.3.1'
|
2015-01-14 12:12:47 +01:00
|
|
|
|
2016-03-15 14:42:53 +01:00
|
|
|
androidTestCompile 'com.android.support.test:runner:0.5'
|
|
|
|
androidTestCompile 'com.android.support.test:rules:0.5'
|
|
|
|
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
|
|
|
|
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
|
|
|
androidTestCompile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
|
2017-01-06 12:45:40 +01:00
|
|
|
androidTestCompile "com.android.support:support-v13:${supportLibVersion}"
|
2016-11-08 12:43:10 +01:00
|
|
|
instrumentationTestCompile 'junit:junit:4.12'
|
|
|
|
|
|
|
|
testCompile 'org.robolectric:robolectric:3.1.1'
|
|
|
|
testCompile 'junit:junit:4.12'
|
2016-03-15 14:42:53 +01:00
|
|
|
|
2015-01-14 12:12:47 +01:00
|
|
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
|
|
}
|
2016-03-15 14:42:53 +01:00
|
|
|
|
|
|
|
// Get the path to ADB. Required when running tests directly from Android Studio.
|
|
|
|
// Source: http://stackoverflow.com/a/26771087/112705
|
|
|
|
def adb = android.getAdbExe().toString()
|
|
|
|
|
|
|
|
// Source: http://stackoverflow.com/q/29908110/112705
|
|
|
|
afterEvaluate {
|
|
|
|
task grantAnimationPermissionDev(type: Exec, dependsOn: 'installInstrumentationTestDebug') {
|
2016-06-20 14:26:03 +02:00
|
|
|
doFirst {
|
|
|
|
println("Executing: $adb shell pm grant $android.productFlavors.instrumentationTest.applicationId android.permission.SET_ANIMATION_SCALE")
|
|
|
|
commandLine "$adb shell pm grant $android.productFlavors.instrumentationTest.applicationId android.permission.SET_ANIMATION_SCALE".split(' ')
|
|
|
|
}
|
2016-03-15 14:42:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// When launching individual tests from Android Studio, it seems that only the assemble tasks
|
|
|
|
// get called directly, not the install* versions
|
|
|
|
tasks.each { task ->
|
|
|
|
if (task.name.startsWith('assembleInstrumentationTestDebugAndroidTest')) {
|
|
|
|
task.dependsOn grantAnimationPermissionDev
|
|
|
|
}
|
|
|
|
}
|
2017-08-08 19:44:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Android gradle plugin 2.3.x contains a bug where the assets for fullDebug
|
|
|
|
* are not copied. The task assembleFullDebug does copy the required assets,
|
|
|
|
* so this dependency fixes the issue.
|
|
|
|
*/
|
|
|
|
tasks.whenTaskAdded { task ->
|
2017-10-01 13:34:45 +02:00
|
|
|
if (task.name.contains("compileFullDebugUnitTestSources")) {
|
2017-08-08 19:44:24 +02:00
|
|
|
task.dependsOn assembleFullDebug
|
|
|
|
}
|
2016-03-15 14:42:53 +01:00
|
|
|
}
|