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

144 lines
6.1 KiB
Groovy
Raw Normal View History

import org.gradle.internal.jvm.Jvm
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilerExecutionStrategy
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
// The version for the Kotlin plugin and dependencies
Dependency updates 20220929 (#12533) * Bump junit_version from 5.9.0 to 5.9.1 Bumps `junit_version` from 5.9.0 to 5.9.1. Updates `junit-jupiter` from 5.9.0 to 5.9.1 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.9.0...r5.9.1) Updates `junit-vintage-engine` from 5.9.0 to 5.9.1 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.9.0...r5.9.1) Updates `junit-jupiter-params` from 5.9.0 to 5.9.1 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.9.0...r5.9.1) --- updated-dependencies: - dependency-name: org.junit.jupiter:junit-jupiter dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.junit.vintage:junit-vintage-engine dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.junit.jupiter:junit-jupiter-params dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump annotation from 1.4.0 to 1.5.0 Bumps annotation from 1.4.0 to 1.5.0. --- updated-dependencies: - dependency-name: androidx.annotation:annotation dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Bump mockk from 1.12.8 to 1.13.1 Bumps [mockk](https://github.com/mockk/mockk) from 1.12.8 to 1.13.1. - [Release notes](https://github.com/mockk/mockk/releases) - [Commits](https://github.com/mockk/mockk/commits) --- updated-dependencies: - dependency-name: io.mockk:mockk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Bump activity-ktx from 1.5.1 to 1.6.0 Bumps activity-ktx from 1.5.1 to 1.6.0. --- updated-dependencies: - dependency-name: androidx.activity:activity-ktx dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Bump fragments_version from 1.5.2 to 1.5.3 Bumps `fragments_version` from 1.5.2 to 1.5.3. Updates `fragment-ktx` from 1.5.2 to 1.5.3 Updates `fragment-testing` from 1.5.2 to 1.5.3 --- updated-dependencies: - dependency-name: androidx.fragment:fragment-ktx dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.fragment:fragment-testing dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump mockk from 1.13.1 to 1.13.2 Bumps [mockk](https://github.com/mockk/mockk) from 1.13.1 to 1.13.2. - [Release notes](https://github.com/mockk/mockk/releases) - [Commits](https://github.com/mockk/mockk/compare/1.13.1...1.13.2) --- updated-dependencies: - dependency-name: io.mockk:mockk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump kotlin_version from 1.7.10 to 1.7.20 Bumps `kotlin_version` from 1.7.10 to 1.7.20. Updates `kotlin-gradle-plugin` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-stdlib` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-test` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-reflect` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-test-junit5` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-test-junit` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) --- updated-dependencies: - dependency-name: org.jetbrains.kotlin:kotlin-gradle-plugin dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-stdlib dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-test dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-reflect dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-test-junit5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-test-junit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-29 19:04:39 +02:00
ext.kotlin_version = '1.7.20'
ext.lint_version = '30.3.1'
ext.acra_version = '5.9.6'
ext.ankidroid_backend_version = '0.1.15-anki2.1.54' // this is parsed in tools/setup-anki-backend.sh
ext.hamcrest_version = '2.2'
Dependency updates 20220929 (#12533) * Bump junit_version from 5.9.0 to 5.9.1 Bumps `junit_version` from 5.9.0 to 5.9.1. Updates `junit-jupiter` from 5.9.0 to 5.9.1 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.9.0...r5.9.1) Updates `junit-vintage-engine` from 5.9.0 to 5.9.1 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.9.0...r5.9.1) Updates `junit-jupiter-params` from 5.9.0 to 5.9.1 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.9.0...r5.9.1) --- updated-dependencies: - dependency-name: org.junit.jupiter:junit-jupiter dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.junit.vintage:junit-vintage-engine dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.junit.jupiter:junit-jupiter-params dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump annotation from 1.4.0 to 1.5.0 Bumps annotation from 1.4.0 to 1.5.0. --- updated-dependencies: - dependency-name: androidx.annotation:annotation dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Bump mockk from 1.12.8 to 1.13.1 Bumps [mockk](https://github.com/mockk/mockk) from 1.12.8 to 1.13.1. - [Release notes](https://github.com/mockk/mockk/releases) - [Commits](https://github.com/mockk/mockk/commits) --- updated-dependencies: - dependency-name: io.mockk:mockk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Bump activity-ktx from 1.5.1 to 1.6.0 Bumps activity-ktx from 1.5.1 to 1.6.0. --- updated-dependencies: - dependency-name: androidx.activity:activity-ktx dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Bump fragments_version from 1.5.2 to 1.5.3 Bumps `fragments_version` from 1.5.2 to 1.5.3. Updates `fragment-ktx` from 1.5.2 to 1.5.3 Updates `fragment-testing` from 1.5.2 to 1.5.3 --- updated-dependencies: - dependency-name: androidx.fragment:fragment-ktx dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.fragment:fragment-testing dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump mockk from 1.13.1 to 1.13.2 Bumps [mockk](https://github.com/mockk/mockk) from 1.13.1 to 1.13.2. - [Release notes](https://github.com/mockk/mockk/releases) - [Commits](https://github.com/mockk/mockk/compare/1.13.1...1.13.2) --- updated-dependencies: - dependency-name: io.mockk:mockk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump kotlin_version from 1.7.10 to 1.7.20 Bumps `kotlin_version` from 1.7.10 to 1.7.20. Updates `kotlin-gradle-plugin` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-stdlib` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-test` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-reflect` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-test-junit5` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-test-junit` from 1.7.10 to 1.7.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) --- updated-dependencies: - dependency-name: org.jetbrains.kotlin:kotlin-gradle-plugin dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-stdlib dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-test dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-reflect dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-test-junit5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-test-junit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-29 19:04:39 +02:00
ext.junit_version = '5.9.1'
ext.coroutines_version = '1.6.4'
ext.fragments_version = "1.5.4"
repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "app.brant:amazonappstorepublisher:0.1.0"
2021-05-26 21:24:24 +02:00
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Dependency updates 20220825 (#12170) * build(deps): bump robolectric from 4.8.1 to 4.8.2 Bumps [robolectric](https://github.com/robolectric/robolectric) from 4.8.1 to 4.8.2. - [Release notes](https://github.com/robolectric/robolectric/releases) - [Commits](https://github.com/robolectric/robolectric/compare/robolectric-4.8.1...robolectric-4.8.2) --- updated-dependencies: - dependency-name: org.robolectric:robolectric dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump mockk from 1.12.5 to 1.12.7 Bumps [mockk](https://github.com/mockk/mockk) from 1.12.5 to 1.12.7. - [Release notes](https://github.com/mockk/mockk/releases) - [Commits](https://github.com/mockk/mockk/compare/1.12.5...1.12.7) --- updated-dependencies: - dependency-name: io.mockk:mockk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump ktlint-gradle from 10.3.0 to 11.0.0 Bumps ktlint-gradle from 10.3.0 to 11.0.0. --- updated-dependencies: - dependency-name: org.jlleitschuh.gradle:ktlint-gradle dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump jsoup from 1.15.2 to 1.15.3 Bumps [jsoup](https://github.com/jhy/jsoup) from 1.15.2 to 1.15.3. - [Release notes](https://github.com/jhy/jsoup/releases) - [Changelog](https://github.com/jhy/jsoup/blob/master/CHANGES) - [Commits](https://github.com/jhy/jsoup/compare/jsoup-1.15.2...jsoup-1.15.3) --- updated-dependencies: - dependency-name: org.jsoup:jsoup dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump webkit from 1.4.0 to 1.5.0 Bumps webkit from 1.4.0 to 1.5.0. --- updated-dependencies: - dependency-name: androidx.webkit:webkit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-25 18:06:33 +02:00
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.0.0"
}
}
2021-05-27 07:41:13 +02:00
repositories {
mavenCentral()
}
allprojects {
apply plugin: "org.jlleitschuh.gradle.ktlint"
}
Properties localProperties = new Properties()
if (project.rootProject.file('local.properties').exists()) {
localProperties.load(project.rootProject.file('local.properties').newDataInputStream())
}
Boolean fatalWarnings = !(localProperties['fatal_warnings'] == "false")
// Here we extract per-module "best practices" settings to a single top-level evaluation
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android.testOptions.unitTests {
includeAndroidResources = true
}
project.android.testOptions.unitTests.all {
// tell backend to avoid rollover time, and disable interval fuzzing
environment "ANKI_TEST_MODE", "1"
useJUnitPlatform()
testLogging {
events "failed", "skipped"
showStackTraces = true
exceptionFormat = "full"
}
maxParallelForks = gradleTestMaxParallelForks
forkEvery = 40
systemProperties['junit.jupiter.execution.parallel.enabled'] = true
systemProperties['junit.jupiter.execution.parallel.mode.default'] = "concurrent"
}
}
ktlint {
// remove version override when ktlint gradle plugin releases with 0.45+ transitive
// check for "ktlint" here:
// https://github.com/JLLeitschuh/ktlint-gradle/blob/master/plugin/gradle/libs.versions.toml
version = "0.45.2"
disabledRules = ["no-wildcard-imports"]
}
/**
Kotlin allows concrete function implementations inside interfaces.
For those to work when Kotlin compilation targets the JVM backend, you have to enable the interoperability via
'freeCompilerArgs' in your gradle file, and you have to choose one of the appropriate '-Xjvm-default' modes.
https://kotlinlang.org/docs/java-to-kotlin-interop.html#default-methods-in-interfaces
and we used "all" because we don't have downstream consumers
https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
*/
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
allWarningsAsErrors = fatalWarnings
freeCompilerArgs = ['-Xjvm-default=all']
}
}
}
}
2016-03-11 23:45:45 +01:00
ext {
jvmVersion = Jvm.current().javaVersion.majorVersion
if (jvmVersion != "11" && jvmVersion != "17" && jvmVersion != "18") {
println "\n\n\n"
println "**************************************************************************************************************"
println "\n\n\n"
println "ERROR: AnkiDroid builds with JVM version 11, 17 or 18."
println " Incompatible major version detected: '" + jvmVersion + "'"
println "\n\n\n"
println "**************************************************************************************************************"
println "\n\n\n"
System.exit(1)
}
ciBuild = System.getenv("CI") == "true" // works for Travis CI or Github Actions
2016-03-11 23:45:45 +01:00
// allows for -Dpre-dex=false to be set
preDexEnabled = "true" == System.getProperty("pre-dex", "true")
// allows for universal APKs to be generated
universalApkEnabled = "true" == System.getProperty("universal-apk", "false")
if (System.getProperty("os.name") == "Mac OS X") {
// macOS reports hardware cores. This is accurate for CI, Intel (halved due to SMT) and Apple Silicon
gradleTestMaxParallelForks = "sysctl -n hw.physicalcpu".execute().text.toInteger()
} else if (ciBuild) {
// GitHub Actions (Standard_DS2_v2) are 1:1 on Linux/Windows with two vCPU cores
// Sources:
// Standard_DS2_v2 https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#cloud-hosts-for-github-hosted-runners
// Which is 1:1 https://docs.microsoft.com/en-gb/azure/virtual-machines/acu : DS1_v2 - DS15_v2 | 1:1
gradleTestMaxParallelForks = 2
// separate gradle compile process is a major speed improvement, but consumes 2x RAM
// the CI machines don't have enough RAM to do that without going in to swap quite a bit
// so for CI machines only - to improve reliability despite compilation speed hit, compile kotlin in process
println "CI build detected: setting compiler execution strategy to IN_PROCESS"
tasks.withType(KotlinCompile).configureEach {
compilerExecutionStrategy.set(KotlinCompilerExecutionStrategy.IN_PROCESS)
}
} else {
// Use 50% of cores to account for SMT which doesn't help this workload
gradleTestMaxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}
2016-10-23 10:55:19 +02:00
}