2019-02-17 16:53:25 +01:00
|
|
|
plugins {
|
|
|
|
// Gradle plugin portal
|
2019-05-10 12:15:03 +02:00
|
|
|
id 'com.github.triplet.play' version '2.2.1'
|
2019-02-17 16:53:25 +01:00
|
|
|
}
|
|
|
|
|
2014-11-09 18:02:29 +01:00
|
|
|
apply plugin: 'com.android.application'
|
2018-09-03 10:02:27 +02:00
|
|
|
apply plugin: 'jacoco'
|
|
|
|
|
2019-01-26 21:41:41 +01:00
|
|
|
jacoco {
|
|
|
|
toolVersion = "$rootProject.ext.jacocoVersion"
|
|
|
|
|
|
|
|
}
|
2018-11-24 21:11:48 +01:00
|
|
|
repositories {
|
|
|
|
google()
|
|
|
|
jcenter()
|
|
|
|
}
|
2014-11-09 18:02:29 +01:00
|
|
|
def homePath = System.properties['user.home']
|
|
|
|
android {
|
2018-09-24 20:56:32 +02:00
|
|
|
compileSdkVersion 28
|
2014-11-09 18:02:29 +01:00
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
applicationId "com.ichi2.anki"
|
2018-04-01 20:50:50 +02:00
|
|
|
minSdkVersion 15
|
2018-09-24 20:56:32 +02:00
|
|
|
targetSdkVersion 28
|
2014-11-10 13:10:07 +01:00
|
|
|
testApplicationId "com.ichi2.anki.tests"
|
2016-05-27 09:25:12 +02:00
|
|
|
vectorDrawables.useSupportLibrary = true
|
2018-09-25 00:08:02 +02:00
|
|
|
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
2018-09-14 04:43:40 +02:00
|
|
|
|
2018-09-14 04:44:01 +02:00
|
|
|
// This enables long timeouts required on slow ARM emulators, e.g. Travis
|
|
|
|
adbOptions {
|
2019-04-09 00:34:38 +02:00
|
|
|
//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
|
2018-09-14 04:44:01 +02:00
|
|
|
}
|
2014-11-09 18:02:29 +01:00
|
|
|
}
|
2015-10-27 03:23:05 +01:00
|
|
|
lintOptions {
|
|
|
|
abortOnError false
|
|
|
|
disable 'TypographyEllipsis'
|
|
|
|
}
|
2014-11-09 18:02:29 +01:00
|
|
|
signingConfigs {
|
2015-10-27 03:23:05 +01:00
|
|
|
release {
|
|
|
|
storeFile file("${homePath}/src/android-keystore")
|
|
|
|
keyAlias "nrkeystorealias"
|
|
|
|
storePassword System.getenv("KSTOREPWD")
|
|
|
|
keyPassword System.getenv("KEYPWD")
|
|
|
|
}
|
2014-11-09 18:02:29 +01:00
|
|
|
}
|
|
|
|
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"'
|
2018-09-03 10:02:27 +02:00
|
|
|
testCoverageEnabled true
|
2018-08-28 17:21:35 +02:00
|
|
|
}
|
2014-11-09 18:02:29 +01:00
|
|
|
release {
|
2015-12-03 18:16:05 +01:00
|
|
|
minifyEnabled true
|
2014-11-09 18:02:29 +01:00
|
|
|
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"'
|
2014-11-09 18:02:29 +01:00
|
|
|
}
|
|
|
|
}
|
2015-11-04 11:48:13 +01:00
|
|
|
useLibrary 'org.apache.http.legacy'
|
2016-03-11 23:45:45 +01:00
|
|
|
|
2018-09-03 10:02:27 +02:00
|
|
|
testOptions {
|
|
|
|
animationsDisabled true
|
|
|
|
|
|
|
|
unitTests {
|
|
|
|
includeAndroidResources = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-26 21:41:41 +01:00
|
|
|
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'
|
|
|
|
}
|
2018-11-24 21:11:48 +01:00
|
|
|
testOptions.unitTests.all {
|
|
|
|
testLogging {
|
|
|
|
events "failed", "skipped"
|
|
|
|
showStackTraces = true
|
|
|
|
exceptionFormat = "full"
|
|
|
|
}
|
2015-10-27 03:23:05 +01:00
|
|
|
|
2018-11-24 21:11:48 +01:00
|
|
|
maxParallelForks = gradleTestMaxParallelForks
|
2019-02-09 22:03:03 +01:00
|
|
|
systemProperties['junit.jupiter.execution.parallel.enabled'] = true
|
|
|
|
systemProperties['junit.jupiter.execution.parallel.mode.default'] = "concurrent"
|
2018-11-24 21:11:48 +01:00
|
|
|
}
|
2019-02-19 19:07:12 +01:00
|
|
|
sourceSets {
|
|
|
|
debug {
|
|
|
|
manifest.srcFile 'src/test/AndroidManifest.xml'
|
|
|
|
}
|
|
|
|
}
|
2018-11-24 21:11:48 +01:00
|
|
|
}
|
2015-10-27 03:23:05 +01:00
|
|
|
|
|
|
|
play {
|
|
|
|
serviceAccountEmail = '294046724212-r3bef6kl46pb9gk0h1pl5rcjmpfrdpjl@developer.gserviceaccount.com'
|
2019-02-17 16:53:25 +01:00
|
|
|
serviceAccountCredentials = file("${homePath}/src/583631bdd16d.p12")
|
2017-01-05 00:05:18 +01:00
|
|
|
track = 'alpha'
|
2015-10-27 03:23:05 +01:00
|
|
|
}
|
2014-11-09 18:02:29 +01:00
|
|
|
|
2018-10-07 08:12:44 +02:00
|
|
|
// 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"
|
2018-11-24 21:11:48 +01:00
|
|
|
|
|
|
|
// 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
|
2019-01-27 02:21:25 +01:00
|
|
|
jacoco.excludes = ['jdk.internal.*']
|
2018-10-07 08:12:44 +02:00
|
|
|
}
|
|
|
|
|
2018-09-03 10:02:27 +02:00
|
|
|
// 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"
|
|
|
|
|
2019-04-01 19:16:34 +02:00
|
|
|
sourceDirectories.from = files([mainSrc])
|
|
|
|
classDirectories.from = files([debugTree])
|
|
|
|
executionData.from = fileTree(dir: project.buildDir, includes: [
|
2018-09-03 10:02:27 +02:00
|
|
|
'jacoco/testDebugUnitTest.exec',
|
|
|
|
'outputs/code-coverage/connected/**/*.ec'
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
2018-11-24 22:15:16 +01:00
|
|
|
// 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"
|
|
|
|
|
2019-04-01 19:16:34 +02:00
|
|
|
sourceDirectories.from = files([mainSrc])
|
|
|
|
classDirectories.from = files([debugTree])
|
|
|
|
executionData.from = fileTree(dir: project.buildDir, includes: [
|
2018-11-24 22:15:16 +01:00
|
|
|
'jacoco/testDebugUnitTest.exec'
|
|
|
|
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
2014-11-09 18:02:29 +01:00
|
|
|
dependencies {
|
2019-03-27 22:27:35 +01:00
|
|
|
compileOnly "com.google.auto.service:auto-service-annotations:1.0-rc5"
|
2019-04-09 00:34:38 +02:00
|
|
|
annotationProcessor "com.google.auto.service:auto-service:1.0-rc5"
|
2018-10-09 06:25:08 +02:00
|
|
|
|
2018-05-19 04:55:10 +02:00
|
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
2018-11-08 14:53:48 +01:00
|
|
|
implementation 'androidx.appcompat:appcompat:1.0.2'
|
2015-09-27 06:18:52 +02:00
|
|
|
// 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'
|
2018-11-24 04:02:24 +01:00
|
|
|
implementation 'androidx.exifinterface:exifinterface:1.0.0'
|
2018-09-25 00:08:02 +02:00
|
|
|
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
2019-04-29 18:23:37 +02:00
|
|
|
implementation 'io.requery:sqlite-android:3.28.0'
|
2018-11-12 06:05:37 +01:00
|
|
|
implementation 'android.arch.persistence:db-framework:1.1.1'
|
2018-09-09 06:29:52 +02:00
|
|
|
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
|
2018-05-19 04:55:10 +02:00
|
|
|
implementation 'com.getbase:floatingactionbutton:1.10.1'
|
2019-03-22 04:31:58 +01:00
|
|
|
implementation 'androidx.annotation:annotation:1.0.2'
|
2018-11-26 17:59:42 +01:00
|
|
|
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
|
2018-10-16 23:40:05 +02:00
|
|
|
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
|
|
|
|
2019-03-22 04:31:58 +01:00
|
|
|
implementation 'net.mikehardy:google-analytics-java7:2.0.7'
|
2019-05-13 12:16:44 +02:00
|
|
|
implementation 'com.squareup.okhttp3:okhttp:3.12.3'
|
2018-11-08 14:53:48 +01:00
|
|
|
implementation 'com.arcao:slf4j-timber:3.1'
|
2018-10-09 06:25:08 +02:00
|
|
|
|
2018-08-18 03:00:58 +02:00
|
|
|
implementation 'com.jakewharton.timber:timber:4.7.1'
|
|
|
|
implementation 'com.google.code.gson:gson:2.8.5'
|
2019-05-13 12:16:02 +02:00
|
|
|
implementation 'org.jsoup:jsoup:1.12.1'
|
2018-05-19 04:55:10 +02:00
|
|
|
api project(":api")
|
2016-10-22 15:32:58 +02:00
|
|
|
|
2019-04-09 00:34:38 +02:00
|
|
|
testImplementation 'org.junit.vintage:junit-vintage-engine:5.4.2'
|
2019-04-11 12:14:36 +02:00
|
|
|
testImplementation 'org.mockito:mockito-core:2.27.0'
|
2019-04-22 12:15:47 +02:00
|
|
|
testImplementation 'org.powermock:powermock-core:2.0.2'
|
2019-04-22 16:08:59 +02:00
|
|
|
testImplementation 'org.powermock:powermock-module-junit4:2.0.2'
|
2019-04-22 16:11:44 +02:00
|
|
|
testImplementation 'org.powermock:powermock-api-mockito2:2.0.2'
|
2018-05-19 04:55:10 +02:00
|
|
|
testImplementation 'org.hamcrest:hamcrest-all:1.3'
|
2018-06-17 23:04:21 +02:00
|
|
|
testImplementation 'net.lachlanmckee:timber-junit-rule:1.0.1'
|
2019-03-22 04:31:58 +01:00
|
|
|
testImplementation "org.robolectric:robolectric:4.2.1"
|
2019-02-19 19:07:12 +01:00
|
|
|
testImplementation 'androidx.test:core:1.1.0'
|
|
|
|
testImplementation 'androidx.test.ext:junit:1.1.0'
|
2018-07-01 20:52:28 +02:00
|
|
|
|
2018-10-05 19:41:05 +02:00
|
|
|
// May need a resolution strategy for support libs to our versions
|
2018-09-18 23:01:47 +02:00
|
|
|
androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'
|
2018-12-13 14:31:18 +01:00
|
|
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
|
|
|
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.1'
|
|
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
|
|
|
|
androidTestImplementation 'androidx.test:rules:1.1.1'
|
2014-11-09 18:02:29 +01:00
|
|
|
}
|