2019-02-17 16:53:25 +01:00
|
|
|
plugins {
|
2022-05-01 19:39:18 +02:00
|
|
|
// Gradle plugin portal
|
2023-02-28 15:25:18 +01:00
|
|
|
id 'com.github.triplet.play' version '3.8.1'
|
2019-02-17 16:53:25 +01:00
|
|
|
}
|
|
|
|
|
2014-11-09 18:02:29 +01:00
|
|
|
apply plugin: 'com.android.application'
|
2020-06-17 23:51:47 +02:00
|
|
|
apply plugin: 'app.brant.amazonappstorepublisher'
|
2021-01-22 06:50:34 +01:00
|
|
|
apply plugin: 'idea'
|
2021-05-26 21:24:24 +02:00
|
|
|
apply plugin: 'kotlin-android'
|
2021-08-22 19:47:01 +02:00
|
|
|
apply plugin: 'kotlin-parcelize'
|
2021-01-22 06:50:34 +01:00
|
|
|
|
2018-09-03 10:02:27 +02:00
|
|
|
|
2018-11-24 21:11:48 +01:00
|
|
|
repositories {
|
|
|
|
google()
|
2021-04-16 04:00:57 +02:00
|
|
|
mavenCentral()
|
2021-03-06 19:05:53 +01:00
|
|
|
maven { url "https://jitpack.io" }
|
2018-11-24 21:11:48 +01:00
|
|
|
}
|
2021-01-22 06:50:34 +01:00
|
|
|
|
|
|
|
|
|
|
|
idea {
|
|
|
|
module {
|
|
|
|
downloadJavadoc = System.getenv("CI") != "true"
|
|
|
|
downloadSources = System.getenv("CI") != "true"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-09 18:02:29 +01:00
|
|
|
def homePath = System.properties['user.home']
|
|
|
|
android {
|
2022-09-09 06:37:57 +02:00
|
|
|
compileSdkVersion 33 // change api compileSdkVersion at the same time
|
2014-11-09 18:02:29 +01:00
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
applicationId "com.ichi2.anki"
|
2021-07-20 01:17:44 +02:00
|
|
|
buildConfigField "Boolean", "CI", (System.getenv("CI") == "true").toString()
|
2022-06-28 07:27:32 +02:00
|
|
|
buildConfigField "Boolean", "LEGACY_SCHEMA", "true"
|
|
|
|
buildConfigField "String", "ACRA_URL", '"https://ankidroid.org/acra/report"'
|
|
|
|
buildConfigField "String", "BACKEND_VERSION", "\"$ankidroid_backend_version\""
|
2022-12-10 23:35:57 +01:00
|
|
|
buildConfigField "Boolean", "ENABLE_LEAK_CANARY", "false"
|
2023-02-18 04:40:48 +01:00
|
|
|
buildConfigField "Boolean", "ALLOW_UNSAFE_MIGRATION", "false"
|
2023-01-15 10:57:04 +01:00
|
|
|
resValue "string", "app_name", "AnkiDroid"
|
2020-06-15 03:38:52 +02:00
|
|
|
|
|
|
|
// The version number is of the form:
|
|
|
|
// <major>.<minor>.<maintenance>[dev|alpha<build>|beta<build>|]
|
|
|
|
// The <build> is only present for alpha and beta releases (e.g., 2.0.4alpha2 or 2.0.4beta4), developer builds do
|
|
|
|
// not have a build number (e.g., 2.0.4dev) and official releases only have three components (e.g., 2.0.4).
|
|
|
|
//
|
|
|
|
// The version code is derived from the version name as follows:
|
|
|
|
// AbbCCtDD
|
|
|
|
// A: 1-digit decimal number representing the major version
|
|
|
|
// bb: 2-digit decimal number representing the minor version
|
|
|
|
// CC: 2-digit decimal number representing the maintenance version
|
|
|
|
// t: 1-digit decimal number representing the type of the build
|
|
|
|
// 0: developer build
|
|
|
|
// 1: alpha release
|
|
|
|
// 2: beta release
|
|
|
|
// 3: public release
|
|
|
|
// DD: 2-digit decimal number representing the build
|
|
|
|
// 00 for internal builds and public releases
|
|
|
|
// alpha/beta build number for alpha/beta releases
|
|
|
|
//
|
|
|
|
// This ensures the correct ordering between the various types of releases (dev < alpha < beta < release) which is
|
|
|
|
// needed for upgrades to be offered correctly.
|
2023-03-01 00:04:38 +01:00
|
|
|
versionCode=21600194
|
|
|
|
versionName="2.16alpha94"
|
2020-12-08 23:47:14 +01:00
|
|
|
minSdkVersion 21
|
2020-06-05 00:21:52 +02:00
|
|
|
//noinspection OldTargetApi - also performed in api/build.fradle
|
2023-02-13 03:04:16 +01:00
|
|
|
targetSdkVersion 30 // change .tests_emulator.yml
|
2014-11-10 13:10:07 +01:00
|
|
|
testApplicationId "com.ichi2.anki.tests"
|
2016-05-27 09:25:12 +02:00
|
|
|
vectorDrawables.useSupportLibrary = true
|
2021-10-26 10:58:37 +02:00
|
|
|
testInstrumentationRunner 'com.ichi2.testutils.NewCollectionPathTestRunner'
|
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 {
|
2023-01-14 12:16:48 +01:00
|
|
|
versionNameSuffix "-debug"
|
2018-08-28 17:21:35 +02:00
|
|
|
debuggable true
|
2023-01-10 01:01:02 +01:00
|
|
|
applicationIdSuffix ".debug"
|
2020-06-15 22:11:12 +02:00
|
|
|
splits.abi.universalApk = true // Build universal APK for debug always
|
2018-08-28 17:21:35 +02:00
|
|
|
// Check Crash Reports page on developer wiki for info on ACRA testing
|
2022-06-28 07:27:32 +02:00
|
|
|
// 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
|
|
|
if (project.rootProject.file('local.properties').exists()) {
|
|
|
|
Properties localProperties = new Properties()
|
|
|
|
localProperties.load(project.rootProject.file('local.properties').newDataInputStream())
|
2022-06-28 07:27:32 +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
|
2020-04-15 22:42:31 +02:00
|
|
|
testCoverageEnabled localProperties['enable_coverage'] != "false"
|
2021-10-22 07:41:59 +02:00
|
|
|
// not profiled: optimization for build times
|
|
|
|
if (localProperties['enable_languages'] == "false") {
|
|
|
|
android.defaultConfig.resConfigs "en"
|
|
|
|
}
|
2022-06-28 07:27:32 +02:00
|
|
|
// allow overriding default schema version
|
|
|
|
if (localProperties["legacy_schema"] != null) {
|
|
|
|
buildConfigField "Boolean", "LEGACY_SCHEMA", localProperties["legacy_schema"]
|
|
|
|
}
|
2023-02-18 04:40:48 +01:00
|
|
|
// allows the scoped storage migration when the user is not logged in
|
|
|
|
if (localProperties["allow_unsafe_migration"] != null) {
|
|
|
|
buildConfigField "Boolean", "ALLOW_UNSAFE_MIGRATION", localProperties["allow_unsafe_migration"]
|
|
|
|
}
|
2022-12-10 23:35:57 +01:00
|
|
|
// allow disabling leak canary
|
|
|
|
if (localProperties["enable_leak_canary"] != null) {
|
|
|
|
buildConfigField "Boolean", "ENABLE_LEAK_CANARY", localProperties["enable_leak_canary"]
|
|
|
|
} else {
|
|
|
|
buildConfigField "Boolean", "ENABLE_LEAK_CANARY", "true"
|
|
|
|
}
|
2020-04-15 22:42:31 +02:00
|
|
|
} else {
|
|
|
|
testCoverageEnabled true
|
|
|
|
}
|
|
|
|
|
2021-04-01 07:52:24 +02:00
|
|
|
// make the icon red if in debug mode
|
|
|
|
resValue 'color', 'anki_foreground_icon_color_0', "#FFFF0000"
|
|
|
|
resValue 'color', 'anki_foreground_icon_color_1', "#FFFF0000"
|
2023-01-10 01:01:02 +01:00
|
|
|
resValue "string", "applicationId", "${defaultConfig.applicationId}${applicationIdSuffix}"
|
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
|
2020-06-15 22:11:12 +02:00
|
|
|
splits.abi.universalApk = universalApkEnabled // Build universal APK for release with `-Duniversal-apk=true`
|
2014-11-09 18:02:29 +01:00
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
signingConfig signingConfigs.release
|
2023-01-15 10:57:04 +01:00
|
|
|
|
|
|
|
// syntax: assembleRelease -PcustomSuffix="suffix" -PcustomName="New name"
|
|
|
|
if (project.hasProperty("customSuffix")) {
|
|
|
|
applicationIdSuffix project.property("customSuffix")
|
2023-03-05 01:48:43 +01:00
|
|
|
resValue "string", "applicationId", "${defaultConfig.applicationId}${applicationIdSuffix}"
|
|
|
|
} else {
|
|
|
|
resValue "string", "applicationId", defaultConfig.applicationId
|
2023-01-15 10:57:04 +01:00
|
|
|
}
|
|
|
|
if (project.hasProperty("customName")) {
|
|
|
|
resValue "string", "app_name", project.property("customName")
|
|
|
|
}
|
|
|
|
|
2021-04-01 07:52:24 +02:00
|
|
|
resValue 'color', 'anki_foreground_icon_color_0', "#FF29B6F6"
|
|
|
|
resValue 'color', 'anki_foreground_icon_color_1', "#FF0288D1"
|
2014-11-09 18:02:29 +01:00
|
|
|
}
|
|
|
|
}
|
2016-03-11 23:45:45 +01:00
|
|
|
|
2021-04-20 05:39:06 +02:00
|
|
|
/**
|
|
|
|
* Product Flavors are used for Amazon App Store and Google Play Store.
|
|
|
|
* This is because we cannot use Camera Permissions in Amazon App Store (for FireTv etc...)
|
|
|
|
* Therefore, different AndroidManifest for Camera Permissions is used in Amazon flavor.
|
|
|
|
*/
|
|
|
|
flavorDimensions "appStore"
|
|
|
|
productFlavors {
|
|
|
|
play {
|
|
|
|
dimension "appStore"
|
|
|
|
}
|
|
|
|
amazon {
|
|
|
|
dimension "appStore"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-15 03:38:52 +02:00
|
|
|
/**
|
|
|
|
* Set this to true to create five separate APKs instead of one:
|
|
|
|
* - 2 APKs that only work on ARM/ARM64 devices
|
|
|
|
* - 2 APKs that only works on x86/x86_64 devices
|
|
|
|
* - a universal APK that works on all devices
|
|
|
|
* The advantage is the size of most APKs is reduced by about 2.5MB.
|
|
|
|
* Upload all the APKs to the Play Store and people will download
|
|
|
|
* the correct one based on the CPU architecture of their device.
|
|
|
|
*/
|
|
|
|
def enableSeparateBuildPerCPUArchitecture = true
|
|
|
|
|
|
|
|
splits {
|
|
|
|
abi {
|
|
|
|
reset()
|
|
|
|
enable enableSeparateBuildPerCPUArchitecture
|
2020-06-15 22:11:12 +02:00
|
|
|
//universalApk enableUniversalApk // set in debug + release config blocks above
|
2020-06-15 03:38:52 +02:00
|
|
|
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// applicationVariants are e.g. debug, release
|
|
|
|
applicationVariants.all { variant ->
|
2021-03-04 19:56:07 +01:00
|
|
|
|
|
|
|
// We want the same version stream for all ABIs in debug but for release we can split them
|
2020-06-15 03:38:52 +02:00
|
|
|
if (variant.buildType.name == 'release') {
|
2021-04-16 20:04:54 +02:00
|
|
|
variant.outputs.all { output ->
|
2021-03-04 19:56:07 +01:00
|
|
|
|
2020-06-15 03:38:52 +02:00
|
|
|
// For each separate APK per architecture, set a unique version code as described here:
|
|
|
|
// https://developer.android.com/studio/build/configure-apk-splits.html
|
|
|
|
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
2021-03-04 19:56:07 +01:00
|
|
|
def outputFile = output.outputFile
|
|
|
|
if (outputFile != null && outputFile.name.endsWith('.apk')) {
|
|
|
|
def abi = output.getFilter("ABI")
|
|
|
|
if (abi != null) { // null for the universal-debug, universal-release variants
|
|
|
|
// From: https://developer.android.com/studio/publish/versioning#appversioning
|
|
|
|
// "Warning: The greatest value Google Play allows for versionCode is 2100000000"
|
|
|
|
// AnkiDroid versionCodes have a budget 8 digits (through AnkiDroid 9)
|
|
|
|
// This style does ABI version code ranges with the 9th digit as 0-4.
|
|
|
|
// This consumes ~20% of the version range space, w/50 years of versioning at our major-version pace
|
|
|
|
output.versionCodeOverride =
|
|
|
|
// ex: 321200106 = 3 * 100000000 + 21200106
|
|
|
|
versionCodes.get(abi) * 100000000 + defaultConfig.versionCode
|
|
|
|
}
|
2020-06-15 03:38:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-03 10:02:27 +02:00
|
|
|
testOptions {
|
|
|
|
animationsDisabled true
|
|
|
|
}
|
|
|
|
|
2018-08-28 17:21:35 +02:00
|
|
|
compileOptions {
|
2023-02-17 13:34:53 +01:00
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
2021-03-31 22:21:09 +02:00
|
|
|
coreLibraryDesugaringEnabled true
|
2018-08-28 17:21:35 +02:00
|
|
|
}
|
2023-02-17 13:34:53 +01:00
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = JavaVersion.VERSION_1_8
|
|
|
|
}
|
2021-01-18 23:20:24 +01:00
|
|
|
ndkVersion "22.0.7026061"
|
2018-11-24 21:11:48 +01:00
|
|
|
}
|
2015-10-27 03:23:05 +01:00
|
|
|
|
|
|
|
play {
|
2020-11-11 15:39:32 +01:00
|
|
|
serviceAccountCredentials.set(file("${homePath}/src/AnkiDroid-GCP-Publish-Credentials.json"))
|
|
|
|
track.set('alpha')
|
2015-10-27 03:23:05 +01:00
|
|
|
}
|
2020-06-17 23:51:47 +02:00
|
|
|
amazon {
|
|
|
|
securityProfile = file("${homePath}/src/AnkiDroid-Amazon-Publish-Security-Profile.json")
|
|
|
|
applicationId = "amzn1.devportal.mobileapp.524a424d314931494c55383833305539"
|
2021-05-26 00:33:10 +02:00
|
|
|
pathToApks = [ file("./build/outputs/apk/amazon/release/AnkiDroid-amazon-universal-release.apk") ]
|
2020-06-17 23:51:47 +02:00
|
|
|
replaceEdit = true
|
|
|
|
}
|
2014-11-09 18:02:29 +01:00
|
|
|
|
2021-05-31 15:50:12 +02:00
|
|
|
// Install Git pre-commit hook for Ktlint
|
|
|
|
task installGitHook(type: Copy) {
|
|
|
|
from new File(rootProject.rootDir, 'pre-commit')
|
|
|
|
into { new File(rootProject.rootDir, '.git/hooks') }
|
|
|
|
fileMode 0755
|
|
|
|
}
|
|
|
|
tasks.getByPath(':AnkiDroid:preBuild').dependsOn installGitHook
|
|
|
|
|
2022-04-25 22:03:45 +02:00
|
|
|
// Issue 11078 - some emulators run, but run zero tests, and still report success
|
|
|
|
task assertNonzeroAndroidTests() {
|
|
|
|
doLast {
|
|
|
|
// androidTest currently creates one .xml file per emulator with aggregate results in this dir
|
|
|
|
File folder = file("./build/outputs/androidTest-results/connected/flavors/play")
|
|
|
|
File[] listOfFiles = folder.listFiles({ d, f -> f ==~ /.*.xml/ } as FilenameFilter)
|
|
|
|
for (File file : listOfFiles) {
|
|
|
|
// The aggregate results file currently contains a line with this pattern holding test count
|
|
|
|
String[] matches = file.readLines().findAll { it.contains('<testsuite') }
|
|
|
|
if (matches.length != 1) {
|
|
|
|
throw new GradleScriptException("Unable to determine count of tests executed for " + file.name + ". Regex pattern out of date?", null)
|
|
|
|
}
|
|
|
|
if (!(matches[0] ==~ /.* tests="\d+" .*/) || matches[0].contains('tests="0"')) {
|
|
|
|
throw new GradleScriptException("androidTest executed 0 tests for " + file.name + " - Probably a bug with the emulator. Try another image.", null)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
afterEvaluate {
|
|
|
|
tasks.getByPath(':AnkiDroid:connectedPlayDebugAndroidTest').finalizedBy(assertNonzeroAndroidTests)
|
|
|
|
}
|
|
|
|
|
2020-08-20 23:40:33 +02:00
|
|
|
apply from: "./robolectricDownloader.gradle"
|
2019-11-04 04:42:37 +01:00
|
|
|
apply from: "./jacoco.gradle"
|
2020-05-15 18:16:59 +02:00
|
|
|
apply from: "../lint.gradle"
|
2018-11-24 22:15:16 +01:00
|
|
|
|
2014-11-09 18:02:29 +01:00
|
|
|
dependencies {
|
2020-07-16 00:19:36 +02:00
|
|
|
configurations.all {
|
|
|
|
resolutionStrategy {
|
2023-03-23 16:11:40 +01:00
|
|
|
force 'org.jetbrains:annotations:24.0.1'
|
2020-07-16 00:19:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-11 03:03:24 +02:00
|
|
|
lintChecks project(":lint-rules")
|
|
|
|
|
2023-02-06 14:32:59 +01:00
|
|
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.2'
|
2023-03-23 16:11:40 +01:00
|
|
|
compileOnly 'org.jetbrains:annotations:24.0.1'
|
2021-11-04 11:13:34 +01:00
|
|
|
compileOnly "com.google.auto.service:auto-service-annotations:1.0.1"
|
2021-11-05 00:05:38 +01:00
|
|
|
annotationProcessor "com.google.auto.service:auto-service:1.0.1"
|
2018-10-09 06:25:08 +02:00
|
|
|
|
2023-03-23 16:11:40 +01:00
|
|
|
implementation 'androidx.activity:activity-ktx:1.7.0'
|
2023-02-28 15:25:18 +01:00
|
|
|
implementation 'androidx.annotation:annotation:1.6.0'
|
2023-02-17 13:34:53 +01:00
|
|
|
implementation 'androidx.appcompat:appcompat:1.7.0-alpha02'
|
|
|
|
implementation 'androidx.browser:browser:1.5.0'
|
2022-09-13 21:58:14 +02:00
|
|
|
implementation "androidx.core:core-ktx:1.9.0"
|
2023-02-17 13:34:53 +01:00
|
|
|
implementation 'androidx.exifinterface:exifinterface:1.3.6'
|
2022-07-01 20:24:22 +02:00
|
|
|
implementation "androidx.fragment:fragment-ktx:$fragments_version"
|
2022-02-01 14:43:44 +01:00
|
|
|
implementation "androidx.preference:preference-ktx:1.2.0"
|
2023-03-23 16:11:40 +01:00
|
|
|
implementation 'androidx.recyclerview:recyclerview:1.3.0'
|
|
|
|
implementation 'androidx.sqlite:sqlite-framework:2.3.1'
|
2020-06-25 12:12:02 +02:00
|
|
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
2020-06-12 12:02:49 +02:00
|
|
|
implementation 'androidx.viewpager2:viewpager2:1.0.0'
|
2022-05-30 16:43:35 +02:00
|
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
2023-03-23 16:11:40 +01:00
|
|
|
implementation 'androidx.webkit:webkit:1.6.1'
|
2021-03-06 15:30:19 +01:00
|
|
|
// Note: the design support library can be quite buggy, so test everything thoroughly before updating it
|
2023-02-06 14:32:59 +01:00
|
|
|
implementation 'com.google.android.material:material:1.8.0'
|
2023-02-06 19:58:59 +01:00
|
|
|
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
|
2022-11-05 17:49:19 +01:00
|
|
|
implementation 'com.vanniktech:android-image-cropper:4.5.0'
|
2022-08-19 16:45:50 +02:00
|
|
|
implementation 'org.nanohttpd:nanohttpd:2.3.1'
|
2021-06-27 16:26:09 +02:00
|
|
|
|
2022-06-11 07:14:13 +02:00
|
|
|
// Backend libraries
|
|
|
|
|
2023-03-23 16:11:40 +01:00
|
|
|
implementation 'com.google.protobuf:protobuf-kotlin:3.22.2' // This is required when loading from a file
|
2022-06-11 07:14:13 +02:00
|
|
|
|
2022-06-28 07:27:32 +02:00
|
|
|
Properties localProperties = new Properties()
|
|
|
|
if (project.rootProject.file('local.properties').exists()) {
|
|
|
|
localProperties.load(project.rootProject.file('local.properties').newDataInputStream())
|
|
|
|
}
|
|
|
|
if (localProperties['local_backend'] == "true") {
|
|
|
|
implementation files("../../Anki-Android-Backend/rsdroid/build/outputs/aar/rsdroid-release.aar")
|
|
|
|
testImplementation files("../../Anki-Android-Backend/rsdroid-testing/build/libs/rsdroid-testing-${ankidroid_backend_version}.jar")
|
|
|
|
// On Windows, you can use something like
|
|
|
|
// implementation files("C:\\GitHub\\Rust-Test\\rsdroid\\build\\outputs\\aar\\rsdroid-release.aar")
|
|
|
|
} else {
|
|
|
|
implementation "io.github.david-allison-1:anki-android-backend:$ankidroid_backend_version"
|
|
|
|
testImplementation "io.github.david-allison-1:anki-android-backend-testing:$ankidroid_backend_version"
|
|
|
|
}
|
2022-06-11 07:14:13 +02:00
|
|
|
|
2022-04-23 16:46:38 +02:00
|
|
|
// A path for a testing library which provide Parameterized Test
|
2022-05-01 19:39:18 +02:00
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter:$junit_version"
|
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version"
|
2018-10-05 19:41:05 +02:00
|
|
|
|
|
|
|
// May need a resolution strategy for support libs to our versions
|
2021-10-31 19:27:32 +01:00
|
|
|
implementation "ch.acra:acra-http:$acra_version"
|
|
|
|
implementation "ch.acra:acra-dialog:$acra_version"
|
|
|
|
implementation "ch.acra:acra-toast:$acra_version"
|
|
|
|
implementation "ch.acra:acra-limiter:$acra_version"
|
2018-10-05 19:41:05 +02:00
|
|
|
|
2022-06-16 21:54:47 +02:00
|
|
|
implementation 'com.afollestad.material-dialogs:core:3.3.0'
|
|
|
|
implementation 'com.afollestad.material-dialogs:input:3.3.0'
|
2021-03-06 15:30:19 +01:00
|
|
|
// io.github.java-diff-utils:java-diff-utils is the natural successor here, but requires API24, #7091
|
|
|
|
implementation 'org.bitbucket.cowwoc:diff-match-patch:1.2'
|
2021-05-07 23:18:55 +02:00
|
|
|
// noinspection GradleDependency - commons-compress 1.12 - later versions use `File.toPath`; API26 can remove?
|
2023-02-05 23:38:18 +01:00
|
|
|
implementation 'org.apache.commons:commons-compress:1.12' // #6419 - handle >2GB apkg files
|
2021-03-31 23:21:59 +02:00
|
|
|
implementation 'org.apache.commons:commons-collections4:4.4' // SetUniqueList
|
2022-02-06 05:33:44 +01:00
|
|
|
implementation 'commons-io:commons-io:2.11.0' // FileUtils.contentEquals
|
2020-03-02 13:45:23 +01:00
|
|
|
implementation 'net.mikehardy:google-analytics-java7:2.0.13'
|
2022-06-13 21:06:12 +02:00
|
|
|
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
|
2018-11-08 14:53:48 +01:00
|
|
|
implementation 'com.arcao:slf4j-timber:3.1'
|
2021-08-19 20:33:03 +02:00
|
|
|
implementation 'com.jakewharton.timber:timber:5.0.1'
|
2023-02-28 15:25:18 +01:00
|
|
|
implementation 'org.jsoup:jsoup:1.15.4'
|
2021-03-06 15:30:19 +01:00
|
|
|
implementation "com.github.zafarkhaja:java-semver:0.9.0" // For AnkiDroid JS API Versioning
|
2021-03-14 23:16:12 +01:00
|
|
|
implementation 'com.drakeet.drawer:drawer:1.0.3'
|
2021-11-19 01:33:55 +01:00
|
|
|
implementation 'uk.co.samuelwall:material-tap-target-prompt:3.3.2'
|
2022-05-31 05:32:55 +02:00
|
|
|
implementation 'com.github.mrudultora:Colorpicker:1.2.0'
|
2022-07-30 20:31:24 +02:00
|
|
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
2022-08-29 12:15:45 +02:00
|
|
|
implementation 'com.github.ByteHamster:SearchPreference:v2.3.0'
|
2022-09-13 21:58:14 +02:00
|
|
|
implementation 'com.github.AppIntro:AppIntro:6.2.0'
|
2022-06-16 21:54:47 +02:00
|
|
|
|
2022-01-02 19:42:20 +01:00
|
|
|
// Cannot use debugImplementation since classes need to be imported in AnkiDroidApp
|
|
|
|
// and there's no no-op version for release build. Usage has been disabled for release
|
|
|
|
// build via AnkiDroidApp.
|
2022-11-11 16:56:00 +01:00
|
|
|
implementation 'com.squareup.leakcanary:leakcanary-android:2.10'
|
2022-01-02 19:42:20 +01:00
|
|
|
|
2018-05-19 04:55:10 +02:00
|
|
|
api project(":api")
|
2016-10-22 15:32:58 +02:00
|
|
|
|
2022-05-01 19:39:18 +02:00
|
|
|
testImplementation "org.junit.vintage:junit-vintage-engine:$junit_version"
|
2023-03-23 16:11:40 +01:00
|
|
|
testImplementation 'org.mockito:mockito-inline:5.2.0'
|
2022-11-28 11:06:08 +01:00
|
|
|
testImplementation "org.mockito.kotlin:mockito-kotlin:4.1.0"
|
2022-04-25 19:57:21 +02:00
|
|
|
testImplementation "org.hamcrest:hamcrest:$hamcrest_version"
|
2018-06-17 23:04:21 +02:00
|
|
|
testImplementation 'net.lachlanmckee:timber-junit-rule:1.0.1'
|
2021-12-04 19:29:52 +01:00
|
|
|
// robolectricDownloader.gradle *may* need a new SDK jar entry if they release one or if we change targetSdk. Instructions in that gradle file.
|
2022-11-15 14:25:35 +01:00
|
|
|
testImplementation "org.robolectric:robolectric:$robolectric_version"
|
2022-11-11 16:56:00 +01:00
|
|
|
testImplementation "androidx.test:core:$androidx_test_version"
|
|
|
|
testImplementation "androidx.test.ext:junit:$androidx_test_junit_version"
|
2021-08-24 12:38:41 +02:00
|
|
|
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
2022-03-05 00:00:55 +01:00
|
|
|
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
2022-09-12 20:15:21 +02:00
|
|
|
testImplementation "org.jetbrains.kotlin:kotlin-test-junit5:$kotlin_version"
|
2022-06-21 10:36:55 +02:00
|
|
|
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
|
2023-02-06 14:32:59 +01:00
|
|
|
testImplementation "io.mockk:mockk:1.13.4"
|
2022-04-17 15:32:59 +02:00
|
|
|
testImplementation 'org.apache.commons:commons-exec:1.3' // obtaining the OS
|
2022-03-05 00:00:55 +01:00
|
|
|
|
2020-05-27 19:14:41 +02:00
|
|
|
// debugImplementation required vs testImplementation: https://issuetracker.google.com/issues/128612536
|
2022-11-11 16:56:00 +01:00
|
|
|
debugImplementation("androidx.fragment:fragment-testing:$fragments_version") {
|
|
|
|
// exclude transitive androidx.test:core dep: https://github.com/android/android-test/issues/1587
|
|
|
|
exclude group: 'androidx.test', module: 'core'
|
|
|
|
}
|
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
|
2022-11-11 16:56:00 +01:00
|
|
|
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
|
|
|
|
androidTestImplementation("androidx.test.espresso:espresso-contrib:$espresso_version") {
|
Update to Anki 2.1.54 backend
Squashes a few commits:
Move the legacy schema toggle into BackendFactory
Simplify backend handling; rework collection instantiation
When the Rust code was initially introduced, it was not clear whether
it would be usable on all devices, or whether it would need to be removed
for some reason. This no doubt influenced the design of the existing API,
which tries to make it easy to swap the Rust code out with something else.
Unfortunately this approach has some downsides:
- It makes it somewhat harder to follow, as method calls jump through
multiple interfaces before they're actually sent to the backend.
- It makes utilizing new methods considerably more cumbersome.
For example, take the extract_av_tags() call. It follows the following
path:
collection method or method in related helper class:
https://github.com/ankidroid/Anki-Android/blob/cea79e1b077bc30e7eed8f37529002aae416d34d/AnkiDroid/src/main/java/com/ichi2/libanki/TemplateManager.kt#L242
to generic interface:
https://github.com/ankidroid/Anki-Android/blob/cea79e1b077bc30e7eed8f37529002aae416d34d/AnkiDroid/src/main/java/com/ichi2/libanki/backend/DroidBackend.kt#L83
to specific implementation:
https://github.com/ankidroid/Anki-Android/blob/cea79e1b077bc30e7eed8f37529002aae416d34d/AnkiDroid/src/main/java/com/ichi2/libanki/backend/RustDroidV16Backend.kt#L57
and if it's unusable with the legacy schema (which I don't believe is
actually true in this case), it also needs to be added to the other
implementation:
https://github.com/ankidroid/Anki-Android/blob/cea79e1b077bc30e7eed8f37529002aae416d34d/AnkiDroid/src/main/java/com/ichi2/libanki/backend/RustDroidBackend.kt#L87
and then finally, a method in the backend module is invoked.
The backend module has code generation so that invoking a backend method
is as simple as making a method call, but currently you have to weave
the call through 3 or so levels of indirection before you can actually
use it. With something like 170 available methods, that's a fair amount
of extra work required.
Rather than trying to insulate libanki from the backend code, this PR
drops some of the indirection in favour of the approach the desktop takes:
libanki is the insulation layer; it can call freely into the backend methods,
but consumers (eg the GUI code) are expected to only call methods on the
collection, and not access the backend directly.
In addition to the above, collection initialization has been reworked
to be more similar to the computer version. Instead of the collection
being created from a database object, a backend is passed into the
collection creation, and the collection takes care of creating a DB
instance that wraps the backend.
Remove always-on isUsingRustBackend
Drop the legacy upgrade/initialization code
Schema 11 was introduced in 2012, and decks that still are <11 are very
rare. The desktop dropped support for schema 10 back in early 2020.
This also removes the need to modify SCHEMA_VERSION when switching
between TESTING_USE_V16_BACKEND.
Remove DOWNGRADE_REQUIRED and slightly simplify startup error handling
- The backend automatically downgrades when required, and possible. No
backup is required, as the downgrade happens in a single transaction,
and the downgrade code has proven itself over time.
- Store the type of failure in getColSafe(), so it can be checked later.
Update to work with desktop 2.1.53 code
Depends on https://github.com/ankidroid/Anki-Android-Backend/pull/202
Due to the removal and change of a few backend methods, syncing, importing
and the card templates screen will not work when the schema16 setting is
active (actually schema18 now). To get them working again, those code
paths will need to switch to the backend implementations.
A few notes:
- Downgrading happens automatically when loading the collection in schema11
mode, so the extra code dealing with downgrades & "can downgrade" reporting
can be stripped.
- Added the ability to run col.set_config("key", JSONObject.NULL), as
unit tests were attempting to write the entire collection config, which is
no longer supported.
- All tests pass on both old and new backends, though the latter required
disabling a few failed tests when running with the new schema
(eg notetype updating).
Integrates, and thus closes #11579 and closes #11581
Remove the time argument to Storage.collection()
Collection does not currently take a time argument, and relies on the
global object instead, so this change brings Storage in line with it.
Reuse the backend when closing+reopening a collection
Avoids having to re-initialize the translations, and reduces leaks
(the import + export code leaks backends still)
2022-06-28 08:03:17 +02:00
|
|
|
exclude module: "protobuf-lite"
|
|
|
|
}
|
2022-11-11 16:56:00 +01:00
|
|
|
androidTestImplementation "androidx.test:core:$androidx_test_version"
|
|
|
|
androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit_version"
|
|
|
|
androidTestImplementation "androidx.test:rules:$androidx_test_version"
|
2022-08-16 22:08:37 +02:00
|
|
|
androidTestImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
2022-09-09 01:43:58 +02:00
|
|
|
androidTestImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
|
2014-11-09 18:02:29 +01:00
|
|
|
}
|
2022-08-29 14:16:34 +02:00
|
|
|
|
|
|
|
android {
|
2023-02-15 20:35:16 +01:00
|
|
|
|
2023-02-15 21:00:29 +01:00
|
|
|
|
|
|
|
packagingOptions {
|
|
|
|
resources {
|
|
|
|
excludes += ['META-INF/DEPENDENCIES']
|
|
|
|
}
|
|
|
|
}
|
2023-02-15 20:35:16 +01:00
|
|
|
namespace 'com.ichi2.anki'
|
2022-08-29 14:16:34 +02:00
|
|
|
testOptions {
|
|
|
|
kotlinOptions {
|
|
|
|
freeCompilerArgs += [
|
|
|
|
'-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi',
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2022-08-29 12:15:45 +02:00
|
|
|
}
|