2019-10-21 22:27:07 +02:00
|
|
|
import com.android.ddmlib.DdmPreferences
|
|
|
|
|
2019-02-17 16:53:25 +01:00
|
|
|
plugins {
|
|
|
|
// Gradle plugin portal
|
2020-04-07 12:12:30 +02:00
|
|
|
id 'com.github.triplet.play' version '2.7.5'
|
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
|
|
|
|
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
|
2019-10-21 22:27:07 +02:00
|
|
|
//noinspection OldTargetApi
|
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
|
2019-10-21 22:27:07 +02:00
|
|
|
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"'
|
2020-04-15 22:42:31 +02:00
|
|
|
|
|
|
|
// #6009 Allow optional disabling of JaCoCo for general build (assembleDebug).
|
|
|
|
// jacocoDebug task was slow, hung, and wasn't required unless I wanted coverage
|
|
|
|
if (project.rootProject.file('local.properties').exists()) {
|
|
|
|
Properties localProperties = new Properties()
|
|
|
|
localProperties.load(project.rootProject.file('local.properties').newDataInputStream())
|
|
|
|
testCoverageEnabled localProperties['enable_coverage'] != "false"
|
|
|
|
} else {
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2016-03-11 23:45:45 +01:00
|
|
|
|
2018-09-03 10:02:27 +02:00
|
|
|
testOptions {
|
|
|
|
animationsDisabled true
|
|
|
|
|
|
|
|
unitTests {
|
|
|
|
includeAndroidResources = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
}
|
2020-02-12 03:05:36 +01:00
|
|
|
lintOptions {
|
|
|
|
check 'NewApi'
|
|
|
|
abortOnError true
|
|
|
|
}
|
2020-04-22 18:23:00 +02:00
|
|
|
ndkVersion "21.1.6352462"
|
2018-11-24 21:11:48 +01:00
|
|
|
}
|
2015-10-27 03:23:05 +01:00
|
|
|
|
|
|
|
play {
|
2020-04-02 19:28:35 +02:00
|
|
|
serviceAccountCredentials = file("${homePath}/src/AnkiDroid-GCP-Publish-Credentials.json")
|
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
|
|
|
|
}
|
|
|
|
|
2019-11-04 04:42:37 +01:00
|
|
|
apply from: "./jacoco.gradle"
|
2018-11-24 22:15:16 +01:00
|
|
|
|
2014-11-09 18:02:29 +01:00
|
|
|
dependencies {
|
2019-07-17 12:17:19 +02:00
|
|
|
compileOnly "com.google.auto.service:auto-service-annotations:1.0-rc6"
|
2019-07-19 04:11:10 +02:00
|
|
|
annotationProcessor "com.google.auto.service:auto-service:1.0-rc6"
|
2018-10-09 06:25:08 +02:00
|
|
|
|
2018-05-19 04:55:10 +02:00
|
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
2019-10-21 22:27:07 +02:00
|
|
|
//noinspection GradleDependency
|
2020-04-03 12:12:11 +02:00
|
|
|
implementation 'androidx.appcompat:appcompat:1.2.0-beta01'
|
2015-09-27 06:18:52 +02:00
|
|
|
// Note: the design support library can be quite buggy, so test everything thoroughly before updating it
|
2020-02-04 11:13:01 +01:00
|
|
|
implementation 'com.google.android.material:material:1.1.0'
|
2018-09-25 00:08:02 +02:00
|
|
|
implementation 'androidx.browser:browser:1.0.0'
|
2020-04-03 12:12:38 +02:00
|
|
|
implementation 'androidx.exifinterface:exifinterface:1.2.0'
|
2019-11-21 21:25:00 +01:00
|
|
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
2020-02-04 16:52:55 +01:00
|
|
|
implementation 'io.requery:sqlite-android:3.31.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-06-25 05:34:32 +02:00
|
|
|
implementation 'androidx.annotation:annotation:1.1.0'
|
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
|
|
|
|
2020-03-02 13:45:23 +01:00
|
|
|
implementation 'net.mikehardy:google-analytics-java7:2.0.13'
|
2019-10-21 22:27:07 +02:00
|
|
|
//noinspection GradleDependency
|
2020-03-31 22:46:07 +02:00
|
|
|
implementation 'com.squareup.okhttp3:okhttp:3.12.10'
|
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'
|
2019-10-07 17:24:49 +02:00
|
|
|
implementation 'com.google.code.gson:gson:2.8.6'
|
2020-03-31 22:46:07 +02:00
|
|
|
implementation 'org.jsoup:jsoup:1.13.1'
|
2018-05-19 04:55:10 +02:00
|
|
|
api project(":api")
|
2016-10-22 15:32:58 +02:00
|
|
|
|
2020-04-30 12:12:13 +02:00
|
|
|
testImplementation 'org.junit.vintage:junit-vintage-engine:5.6.2'
|
2020-03-31 22:46:07 +02:00
|
|
|
testImplementation 'org.mockito:mockito-core:3.3.3'
|
|
|
|
testImplementation 'org.powermock:powermock-core:2.0.7'
|
|
|
|
testImplementation 'org.powermock:powermock-module-junit4:2.0.7'
|
|
|
|
testImplementation 'org.powermock:powermock-api-mockito2:2.0.7'
|
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'
|
2020-04-13 21:24:06 +02:00
|
|
|
testImplementation "org.robolectric:robolectric:4.3.1"
|
2019-05-30 20:21:42 +02:00
|
|
|
testImplementation 'androidx.test:core:1.2.0'
|
|
|
|
testImplementation 'androidx.test.ext:junit:1.1.1'
|
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'
|
2019-05-30 20:21:42 +02:00
|
|
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
|
|
|
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
|
2019-06-27 23:56:44 +02:00
|
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
2019-05-30 20:21:42 +02:00
|
|
|
androidTestImplementation 'androidx.test:rules:1.2.0'
|
2014-11-09 18:02:29 +01:00
|
|
|
}
|