Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
541 changes: 0 additions & 541 deletions AnkiDroid/build.gradle

This file was deleted.

558 changes: 558 additions & 0 deletions AnkiDroid/build.gradle.kts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion AnkiDroid/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import androidx.test.runner.AndroidJUnitRunner
* A test runner which sets [com.ichi2.anki.AnkiDroidApp.INSTRUMENTATION_TESTING] to true
* so a test collection path is used
*/
@Suppress("unused") // referenced by build.gradle
@Suppress("unused") // referenced by build.gradle.kts
class NewCollectionPathTestRunner : AndroidJUnitRunner() {
override fun newApplication(
cl: ClassLoader?,
Expand Down
47 changes: 47 additions & 0 deletions buildSrc/src/main/kotlin/ankidroid.android.app.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2026 David Allison <davidallisongithub@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
Convention plugin: applies `com.android.application` plus Kotlin Parcelize,
and pins the settings shared with every other Android module
(compileSdk, minSdk, Java 17). Mirrors `ankidroid.android.library`.
*/

import com.android.build.api.dsl.ApplicationExtension
import com.ichi2.anki.gradle.libsVersionFor

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.plugin.parcelize")
}

extensions.configure<ApplicationExtension> {
compileSdk = libsVersionFor("compileSdk").toInt()

defaultConfig {
minSdk = libsVersionFor("minSdk").toInt()
// After #13695: change .tests_emulator.yml
targetSdk = libsVersionFor("targetSdk").toInt()
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

// Shared project-wide lint configuration.
apply(from = "${rootDir}/lint.gradle")
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ compileSdk = "36"

# Changing minSdk means newer AnkiDroid versions will not support older devices.
# However the Play Store will keep old AnkiDroid versions available for older
# devices *if* you also change AnkiDroid/build.gradle play { retain {} } block
# devices *if* you also change AnkiDroid/build.gradle.kts play { retain {} } block
# to include the version codes of the last released version for the older
# minSdk. It is critical to update those version codes when you change this.
minSdk = "24"
Expand Down
10 changes: 5 additions & 5 deletions tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ if [ "$PUBLIC" = "public" ] && ! [ -f ../ankidroiddocs/changelog.asc ]; then
fi

# Captured once so every APK in this release reports the same BUILD_TIME
# (consumed by AnkiDroid/build.gradle via -PbuildTime).
# (consumed by AnkiDroid/build.gradle.kts via -PbuildTime).
BUILD_TIME_MS=$(date +%s000)
export BUILD_TIME_MS

# Define the location of the manifest file
SRC_DIR="./AnkiDroid"
GRADLEFILE="$SRC_DIR/build.gradle"
GRADLEFILE="$SRC_DIR/build.gradle.kts"
CHANGELOG="$SRC_DIR/src/main/assets/changelog.html"

if ! VERSION=$(grep 'versionName=' $GRADLEFILE | sed -e 's/.*="//' | sed -e 's/".*//')
if ! VERSION=$(grep 'versionName =' $GRADLEFILE | sed -e 's/.*"\(.*\)".*/\1/')
then
echo "Unable to get current version. Is sed installed?"
exit 1
Expand Down Expand Up @@ -87,13 +87,13 @@ if [ "$PUBLIC" != "public" ]; then
# Increment version code
# It is an integer in AndroidManifest that nobody actually sees.
# Ex: 72 to 73
PREVIOUS_CODE=$(grep 'versionCode=' $GRADLEFILE | sed -e 's/.*=//')
PREVIOUS_CODE=$(grep 'versionCode =' $GRADLEFILE | sed -e 's/.*= //')
GUESSED_CODE=$((PREVIOUS_CODE + 1))

# Edit AndroidManifest.xml to bump version string
echo "Bumping version from $PREVIOUS_VERSION$SUFFIX to $VERSION (and code from $PREVIOUS_CODE to $GUESSED_CODE)"
sed -i -e s/"$PREVIOUS_VERSION""$SUFFIX"/"$VERSION"/g $GRADLEFILE
sed -i -e s/versionCode="$PREVIOUS_CODE"/versionCode="$GUESSED_CODE"/g $GRADLEFILE
sed -i -e "s/versionCode = $PREVIOUS_CODE/versionCode = $GUESSED_CODE/g" $GRADLEFILE
fi

# If any changes go in during the release process, pushing fails, so push immediately.
Expand Down
Loading