0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 12:02:16 +02:00
Anki-Android/AnkiDroid/build.gradle

215 lines
7.8 KiB
Groovy
Raw Normal View History

2019-02-17 16:53:25 +01:00
plugins {
// Gradle plugin portal
id 'com.github.triplet.play' version '2.3.0'
2019-02-17 16:53:25 +01:00
}
apply plugin: 'com.android.application'
apply plugin: 'jacoco'
jacoco {
toolVersion = "$rootProject.ext.jacocoVersion"
}
repositories {
google()
jcenter()
}
def homePath = System.properties['user.home']
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.ichi2.anki"
2018-04-01 20:50:50 +02:00
minSdkVersion 15
targetSdkVersion 28
2014-11-10 13:10:07 +01:00
testApplicationId "com.ichi2.anki.tests"
vectorDrawables.useSupportLibrary = true
2018-09-25 00:08:02 +02:00
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
// This enables long timeouts required on slow ARM emulators, e.g. Travis
adbOptions {
//logLevel verbose // let's try to see what is happening
timeOutInMs 20 * 60 * 1000 // 20 minutes
com.android.ddmlib.DdmPreferences.setTimeOut(120000) // apparently if not multidex you do this
}
}
lintOptions {
abortOnError false
disable 'TypographyEllipsis'
}
signingConfigs {
release {
storeFile file("${homePath}/src/android-keystore")
keyAlias "nrkeystorealias"
storePassword System.getenv("KSTOREPWD")
keyPassword System.getenv("KEYPWD")
}
}
buildTypes {
2018-08-28 17:21:35 +02:00
debug {
debuggable true
// Check Crash Reports page on developer wiki for info on ACRA testing
buildConfigField "String", "ACRA_URL", '"https://918f7f55-f238-436c-b34f-c8b5f1331fe5-bluemix.cloudant.com/acra-ankidroid/_design/acra-storage/_update/report"'
testCoverageEnabled true
2018-08-28 17:21:35 +02:00
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
2018-08-28 17:21:35 +02:00
buildConfigField "String", "ACRA_URL", '"https://ankidroid.org/acra/report"'
}
}
2015-11-04 11:48:13 +01:00
useLibrary 'org.apache.http.legacy'
2016-03-11 23:45:45 +01:00
testOptions {
animationsDisabled true
unitTests {
includeAndroidResources = true
}
}
jacoco {
version = "$rootProject.ext.jacocoVersion"
}
2016-03-11 23:45:45 +01:00
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
}
2018-08-28 17:21:35 +02:00
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
2018-10-09 06:25:08 +02:00
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
testOptions.unitTests.all {
testLogging {
events "failed", "skipped"
showStackTraces = true
exceptionFormat = "full"
}
maxParallelForks = gradleTestMaxParallelForks
systemProperties['junit.jupiter.execution.parallel.enabled'] = true
systemProperties['junit.jupiter.execution.parallel.mode.default'] = "concurrent"
}
sourceSets {
debug {
manifest.srcFile 'src/test/AndroidManifest.xml'
}
}
}
play {
serviceAccountEmail = '294046724212-r3bef6kl46pb9gk0h1pl5rcjmpfrdpjl@developer.gserviceaccount.com'
2019-02-17 16:53:25 +01:00
serviceAccountCredentials = file("${homePath}/src/583631bdd16d.p12")
track = 'alpha'
}
// Deprecation is an error. Use @SuppressWarnings("deprecation") and justify in the PR if you must
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation" << "-Xmaxwarns" << "1000" << "-Werror"
// https://guides.gradle.org/performance/#compiling_java
// 1- fork improves things over time with repeated builds, doesn't harm CI single builds
options.fork = true
// 2- incremental will be the default in the future and can help now
options.incremental = true
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
// Our merge report task
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
reports {
xml.enabled = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/compileDebugJavaWithJavac/classes", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
sourceDirectories.from = files([mainSrc])
classDirectories.from = files([debugTree])
executionData.from = fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec',
'outputs/code-coverage/connected/**/*.ec'
])
}
// A unit-test only report task
task jacocoUnitTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {
reports {
xml.enabled = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/compileDebugJavaWithJavac/classes", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
sourceDirectories.from = files([mainSrc])
classDirectories.from = files([debugTree])
executionData.from = fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec'
])
}
dependencies {
compileOnly "com.google.auto.service:auto-service-annotations:1.0-rc6"
annotationProcessor "com.google.auto.service:auto-service:1.0-rc6"
2018-10-09 06:25:08 +02:00
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
// Note: the design support library can be quite buggy, so test everything thoroughly before updating it
2018-09-25 00:08:02 +02:00
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
2018-09-25 00:08:02 +02:00
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'io.requery:sqlite-android:3.29.0'
implementation 'android.arch.persistence:db-framework:1.1.1'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'org.bitbucket.cowwoc:diff-match-patch:1.2'
2018-10-05 19:41:05 +02:00
// May need a resolution strategy for support libs to our versions
implementation'ch.acra:acra-http:5.2.1'
implementation'ch.acra:acra-dialog:5.2.1'
implementation'ch.acra:acra-toast:5.2.1'
implementation'ch.acra:acra-limiter:5.2.1'
2018-10-05 19:41:05 +02:00
implementation 'net.mikehardy:google-analytics-java7:2.0.10'
implementation 'com.squareup.okhttp3:okhttp:3.12.4'
Dependency updates (SLF4J-Timber, Powermock, Appcompat) (#5108) * Bump powermock-module-junit4 from 2.0.0-RC.1 to 2.0.0-RC.3 Bumps [powermock-module-junit4](https://github.com/powermock/powermock) from 2.0.0-RC.1 to 2.0.0-RC.3. - [Release notes](https://github.com/powermock/powermock/releases) - [Changelog](https://github.com/powermock/powermock/blob/release/2.x/docs/changelog.txt) - [Commits](https://github.com/powermock/powermock/compare/powermock-2.0.0-RC.1...powermock-2.0.0-RC.3) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump powermock-api-mockito2 from 2.0.0-RC.1 to 2.0.0-RC.3 Bumps [powermock-api-mockito2](https://github.com/powermock/powermock) from 2.0.0-RC.1 to 2.0.0-RC.3. - [Release notes](https://github.com/powermock/powermock/releases) - [Changelog](https://github.com/powermock/powermock/blob/release/2.x/docs/changelog.txt) - [Commits](https://github.com/powermock/powermock/compare/powermock-2.0.0-RC.1...powermock-2.0.0-RC.3) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump powermock-core from 2.0.0-RC.1 to 2.0.0-RC.3 Bumps [powermock-core](https://github.com/powermock/powermock) from 2.0.0-RC.1 to 2.0.0-RC.3. - [Release notes](https://github.com/powermock/powermock/releases) - [Changelog](https://github.com/powermock/powermock/blob/release/2.x/docs/changelog.txt) - [Commits](https://github.com/powermock/powermock/compare/powermock-2.0.0-RC.1...powermock-2.0.0-RC.3) Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump appcompat from 1.0.1 to 1.0.2 Bumps appcompat from 1.0.1 to 1.0.2. Signed-off-by: dependabot[bot] <support@dependabot.com> * Bump slf4j-timber from 3.0 to 3.1 Bumps [slf4j-timber](https://github.com/arcao/slf4j-timber) from 3.0 to 3.1. - [Release notes](https://github.com/arcao/slf4j-timber/releases) - [Changelog](https://github.com/arcao/slf4j-timber/blob/master/CHANGELOG.md) - [Commits](https://github.com/arcao/slf4j-timber/compare/3.0...3.1) Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-08 14:53:48 +01:00
implementation 'com.arcao:slf4j-timber:3.1'
2018-10-09 06:25:08 +02:00
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'org.jsoup:jsoup:1.12.1'
api project(":api")
testImplementation 'org.junit.vintage:junit-vintage-engine:5.5.1'
testImplementation 'org.mockito:mockito-core:3.0.0'
testImplementation 'org.powermock:powermock-core:2.0.2'
testImplementation 'org.powermock:powermock-module-junit4:2.0.2'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.2'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'net.lachlanmckee:timber-junit-rule:1.0.1'
testImplementation "org.robolectric:robolectric:4.2.1"
testImplementation 'androidx.test:core:1.2.0'
testImplementation 'androidx.test.ext:junit:1.1.1'
2018-10-05 19:41:05 +02:00
// May need a resolution strategy for support libs to our versions
androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:rules:1.2.0'
}