151 lines
4.9 KiB
Groovy
151 lines
4.9 KiB
Groovy
apply plugin: 'com.android.application'
|
|
|
|
def getVersionName = { ->
|
|
def stdout = new ByteArrayOutputStream()
|
|
exec {
|
|
commandLine 'git', 'describe', '--tags', '--always'
|
|
standardOutput = stdout
|
|
}
|
|
return stdout.toString().trim()
|
|
}
|
|
|
|
|
|
android {
|
|
compileSdkVersion 26
|
|
buildToolsVersion "27.0.3"
|
|
|
|
defaultConfig {
|
|
applicationId "org.xbmc.kore"
|
|
minSdkVersion 15
|
|
targetSdkVersion 26
|
|
versionCode 22
|
|
versionName = getVersionName()
|
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
File keystoreFile = file('keystore.properties')
|
|
|
|
signingConfigs {
|
|
release {
|
|
if (keystoreFile.exists()) {
|
|
def Properties keyProps = new Properties()
|
|
keyProps.load(new FileInputStream(keystoreFile))
|
|
|
|
storeFile file(keyProps["store"])
|
|
keyAlias keyProps["alias"]
|
|
storePassword keyProps["storePass"]
|
|
keyPassword keyProps["pass"]
|
|
}
|
|
}
|
|
}
|
|
|
|
// sourceSets {
|
|
// test {
|
|
// java.srcDirs += 'src/testUtils/java'
|
|
// assets.srcDirs += 'src/testUtils/assets'
|
|
// }
|
|
// androidTest {
|
|
// java.srcDirs += 'src/testUtils/java'
|
|
// assets.srcDirs += 'src/testUtils/assets'
|
|
// }
|
|
// }
|
|
|
|
testOptions {
|
|
execution 'ANDROID_TEST_ORCHESTRATOR'
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
if (keystoreFile.exists()) {
|
|
signingConfig signingConfigs.release
|
|
}
|
|
minifyEnabled true
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
}
|
|
|
|
lintOptions {
|
|
// Too much trouble keeping all translations in sync
|
|
disable 'MissingTranslation'
|
|
|
|
//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'
|
|
}
|
|
|
|
// allprojects {
|
|
// gradle.projectsEvaluated {
|
|
// tasks.withType(JavaCompile) {
|
|
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
packagingOptions {
|
|
exclude 'META-INF/DEPENDENCIES'
|
|
exclude 'META-INF/NOTICE'
|
|
exclude 'META-INF/LICENSE'
|
|
exclude 'META-INF/LICENSE.txt'
|
|
exclude 'META-INF/NOTICE.txt'
|
|
}
|
|
}
|
|
|
|
ext {
|
|
supportLibVersion = '26.1.0'
|
|
}
|
|
|
|
dependencies {
|
|
implementation "com.android.support:support-v4:${supportLibVersion}"
|
|
implementation "com.android.support:appcompat-v7:${supportLibVersion}"
|
|
implementation "com.android.support:cardview-v7:${supportLibVersion}"
|
|
implementation "com.android.support:preference-v14:${supportLibVersion}"
|
|
implementation "com.android.support:support-v13:${supportLibVersion}"
|
|
implementation "com.android.support:design:${supportLibVersion}"
|
|
|
|
implementation 'com.fasterxml.jackson.core:jackson-databind:2.5.2'
|
|
implementation 'com.jakewharton:butterknife:8.8.1'
|
|
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
|
|
implementation 'com.squareup.okhttp:okhttp:2.3.0'
|
|
implementation 'com.squareup.picasso:picasso:2.5.2'
|
|
implementation 'de.greenrobot:eventbus:2.4.0'
|
|
implementation 'org.jmdns:jmdns:3.5.1'
|
|
implementation 'at.blogc:expandabletextview:1.0.3'
|
|
implementation 'com.sothree.slidinguppanel:library:3.3.1'
|
|
|
|
androidTestImplementation 'com.android.support.test:runner:1.0.1'
|
|
androidTestImplementation 'com.android.support.test:rules:1.0.1'
|
|
androidTestUtil 'com.android.support.test:orchestrator:1.0.1'
|
|
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
|
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
|
|
androidTestImplementation "com.android.support:support-v13:${supportLibVersion}"
|
|
androidTestImplementation 'junit:junit:4.12'
|
|
|
|
testImplementation 'org.robolectric:robolectric:3.1.1'
|
|
debugImplementation 'junit:junit:4.12'
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
}
|
|
|
|
def adb = android.getAdbExecutable().toString()
|
|
afterEvaluate {
|
|
task grantAnimationPermissionDev(type: Exec, dependsOn: installDebug) {
|
|
doFirst {
|
|
println("Executing: $adb shell pm grant $android.defaultConfig.applicationId android.permission.SET_ANIMATION_SCALE")
|
|
commandLine "$adb shell pm grant $android.defaultConfig.applicationId android.permission.SET_ANIMATION_SCALE".split(' ')
|
|
}
|
|
}
|
|
tasks.each { task ->
|
|
if (task.name.startsWith('connectedDebugAndroidTest')) {
|
|
task.dependsOn grantAnimationPermissionDev
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Makes sure assets are copied before running the unit tests
|
|
*/
|
|
tasks.whenTaskAdded { task ->
|
|
if (task.name.contains("testDebugUnitTest")) {
|
|
task.dependsOn assembleDebug
|
|
}
|
|
} |