mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 12:02:16 +02:00
51c7d9469c
This will hopefully fix the state issues related to Activity restarts, it seems to so far in my testing
186 lines
7.4 KiB
Groovy
186 lines
7.4 KiB
Groovy
import com.android.ddmlib.DdmPreferences
|
|
|
|
plugins {
|
|
// Gradle plugin portal
|
|
id 'com.github.triplet.play' version '2.8.0'
|
|
}
|
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
repositories {
|
|
google()
|
|
jcenter()
|
|
}
|
|
def homePath = System.properties['user.home']
|
|
android {
|
|
compileSdkVersion 28
|
|
|
|
defaultConfig {
|
|
applicationId "com.ichi2.anki"
|
|
minSdkVersion 16
|
|
//noinspection OldTargetApi - also performed in api/build.fradle
|
|
targetSdkVersion 28
|
|
multiDexEnabled true
|
|
testApplicationId "com.ichi2.anki.tests"
|
|
vectorDrawables.useSupportLibrary = true
|
|
// This is a custom class, in androidx to override package-level functions
|
|
testInstrumentationRunner 'androidx.test.runner.MultiDexJUnitRunner'
|
|
|
|
// 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
|
|
DdmPreferences.setTimeOut(120000) // apparently if not multidex you do this
|
|
}
|
|
}
|
|
signingConfigs {
|
|
release {
|
|
storeFile file("${homePath}/src/android-keystore")
|
|
keyAlias "nrkeystorealias"
|
|
storePassword System.getenv("KSTOREPWD")
|
|
keyPassword System.getenv("KEYPWD")
|
|
}
|
|
}
|
|
buildTypes {
|
|
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"'
|
|
|
|
// #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
|
|
}
|
|
|
|
}
|
|
release {
|
|
minifyEnabled true
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
signingConfig signingConfigs.release
|
|
buildConfigField "String", "ACRA_URL", '"https://ankidroid.org/acra/report"'
|
|
}
|
|
}
|
|
|
|
testOptions {
|
|
animationsDisabled true
|
|
|
|
unitTests {
|
|
includeAndroidResources = true
|
|
}
|
|
}
|
|
|
|
dexOptions {
|
|
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
|
|
preDexLibraries = preDexEnabled && !travisBuild
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
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'
|
|
}
|
|
}
|
|
ndkVersion "21.1.6352462"
|
|
}
|
|
|
|
play {
|
|
serviceAccountCredentials = file("${homePath}/src/AnkiDroid-GCP-Publish-Credentials.json")
|
|
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
|
|
}
|
|
|
|
apply from: "./jacoco.gradle"
|
|
apply from: "../lint.gradle"
|
|
|
|
dependencies {
|
|
compileOnly 'org.jetbrains:annotations:16.0.1'
|
|
compileOnly "com.google.auto.service:auto-service-annotations:1.0-rc7"
|
|
annotationProcessor "com.google.auto.service:auto-service:1.0-rc7"
|
|
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
// Note: the design support library can be quite buggy, so test everything thoroughly before updating it
|
|
implementation 'com.google.android.material:material:1.1.0'
|
|
implementation 'androidx.annotation:annotation:1.1.0'
|
|
implementation 'androidx.appcompat:appcompat:1.2.0-rc01'
|
|
implementation 'androidx.browser:browser:1.2.0'
|
|
implementation 'androidx.exifinterface:exifinterface:1.2.0'
|
|
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
|
|
implementation "androidx.multidex:multidex:2.0.1"
|
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
|
implementation 'androidx.sqlite:sqlite-framework:2.1.0'
|
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
|
|
implementation 'androidx.viewpager2:viewpager2:1.0.0'
|
|
implementation 'io.requery:sqlite-android:3.31.0'
|
|
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
|
|
implementation 'com.getbase:floatingactionbutton:1.10.1'
|
|
implementation 'org.bitbucket.cowwoc:diff-match-patch:1.2'
|
|
|
|
// May need a resolution strategy for support libs to our versions
|
|
implementation'ch.acra:acra-http:5.5.1'
|
|
implementation'ch.acra:acra-dialog:5.5.1'
|
|
implementation'ch.acra:acra-toast:5.5.1'
|
|
implementation'ch.acra:acra-limiter:5.5.1'
|
|
|
|
implementation 'net.mikehardy:google-analytics-java7:2.0.13'
|
|
//noinspection GradleDependency NewerVersionAvailable
|
|
implementation 'com.squareup.okhttp3:okhttp:3.12.12'
|
|
implementation 'com.arcao:slf4j-timber:3.1'
|
|
|
|
implementation 'com.jakewharton.timber:timber:4.7.1'
|
|
implementation 'com.google.code.gson:gson:2.8.6'
|
|
implementation 'org.jsoup:jsoup:1.13.1'
|
|
api project(":api")
|
|
|
|
testImplementation 'org.junit.vintage:junit-vintage-engine:5.6.2'
|
|
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'
|
|
testImplementation 'org.hamcrest:hamcrest-all:1.3'
|
|
testImplementation 'net.lachlanmckee:timber-junit-rule:1.0.1'
|
|
testImplementation "org.robolectric:robolectric:4.3.1"
|
|
testImplementation 'androidx.test:core:1.2.0'
|
|
testImplementation 'androidx.test.ext:junit:1.1.1'
|
|
// debugImplementation required vs testImplementation: https://issuetracker.google.com/issues/128612536
|
|
debugImplementation 'androidx.fragment:fragment-testing:1.2.4'
|
|
|
|
// 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'
|
|
androidTestImplementation 'org.smali:dexlib2:2.4.0'
|
|
}
|