Skip to content
Merged
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
10 changes: 9 additions & 1 deletion .github/workflows/build-quick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ jobs:
run: ./check-rust.bat

- name: Run tests (Unit)
run: ./gradlew test rsdroid:lint ktlintCheck --daemon
run: ./gradlew test rsdroid:lint rsdroid-android:lint ktlintCheck --daemon

- name: Run tests (Emulator)
uses: reactivecircus/android-emulator-runner@v2
Expand All @@ -287,6 +287,14 @@ jobs:
if-no-files-found: error
path: rsdroid/build/outputs/aar

- name: Upload Android wrapper AAR as artifact
uses: actions/upload-artifact@v6
if: '!cancelled()'
with:
name: rsdroid-android-aar-${{ matrix.os }}
if-no-files-found: error
path: rsdroid-android/build/outputs/aar

- name: Upload rsdroid-robo JAR as artifact
uses: actions/upload-artifact@v6
if: '!cancelled()'
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ jobs:
if-no-files-found: error
path: rsdroid/build/outputs/aar

- name: Upload Android wrapper AAR as artifact
uses: actions/upload-artifact@v6
with:
name: rsdroid-android-aar
if-no-files-found: error
path: rsdroid-android/build/outputs/aar

- name: Upload rsdroid-robo JAR as artifact
uses: actions/upload-artifact@v6
with:
Expand All @@ -184,15 +191,15 @@ jobs:

# following steps only run on workflow dispatch

- name: Publish AAR to Maven
- name: Publish backend and Android wrapper AARs to Maven
if: "${{ github.event.inputs.mavenPublish != '' && github.event_name == 'workflow_dispatch'}}"
env:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
run: |
./gradlew rsdroid:publishAllPublicationsToMavenCentral -DtestBuildType=release -Dorg.gradle.daemon=false -Dorg.gradle.console=plain
./gradlew rsdroid:publishAllPublicationsToMavenCentral rsdroid-android:publishAllPublicationsToMavenCentral -DtestBuildType=release -Dorg.gradle.daemon=false -Dorg.gradle.console=plain

- name: Publish JAR to Maven
if: "${{ github.event.inputs.mavenPublish != '' && github.event_name == 'workflow_dispatch'}}"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ set PATH=%PATH%;c:\msys64\usr\bin

## Building

Two main files need to be built:
The build produces three artifacts:

- The main .aar file, which contains the backend Kotlin code, web assets, and
Anki backend code compiled for Android.
- An Android wrapper .aar in `rsdroid-android/build/outputs/aar`. Its published
Maven metadata declares an API dependency on the main backend artifact.
- A .jar that contains the backend code compiled for the host platform, for use
with Robolectric unit tests.

Expand Down
2 changes: 1 addition & 1 deletion check-droid.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ if not exist rsdroid\build\outputs\aar\rsdroid-release.aar (
exit 1
)

./gradlew rsdroid:lint rsdroid-instrumented:connectedCheck
./gradlew rsdroid:lint rsdroid-android:lint rsdroid-instrumented:connectedCheck
2 changes: 1 addition & 1 deletion check-droid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ test -f rsdroid/build/outputs/aar/rsdroid-release.aar || (

. ./set-android-ndk-home.sh

./gradlew rsdroid:lint rsdroid-instrumented:connectedCheck
./gradlew rsdroid:lint rsdroid-android:lint rsdroid-instrumented:connectedCheck
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ android.useAndroidX=true
android.enableJetifier=false

GROUP=io.github.david-allison
VERSION_NAME=0.1.72-anki26.09.3
VERSION_NAME=0.1.73-anki26.09.3

POM_INCEPTION_YEAR=2020

Expand Down
14 changes: 14 additions & 0 deletions rsdroid-android/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# rsdroid-android

Android entry point for the Anki backend. This Android library exposes
[`:rsdroid`](../rsdroid) through an `api` dependency, so consumers can use the
backend API through this module.

## Planned contents

After the split, `anki-backend-android` will contain:

- Android native libraries (`librsdroid.so` for each supported architecture).
- Web assets packaged as Android assets.
- Android SQLite adapters.
- Planned to be extracted later.
45 changes: 45 additions & 0 deletions rsdroid-android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
plugins {
alias(libs.plugins.android.library)
id 'signing'
alias(libs.plugins.gradle.maven.publish.plugin)
}

android {
namespace = 'net.ankiweb.rsdroid.android'
compileSdk = libs.versions.compileSdk.get().toInteger()

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

defaultConfig {
minSdk = libs.versions.minSdk.get().toInteger()

consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled = false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

testOptions {
targetSdk = libs.versions.targetSdk.get().toInteger()
}

lint {
targetSdk = libs.versions.targetSdk.get().toInteger()
}
}

dependencies {
api project(path: ':rsdroid')
}

mavenPublishing {
publishToMavenCentral(true)
signAllPublications()
}
Empty file.
5 changes: 5 additions & 0 deletions rsdroid-android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
POM_ARTIFACT_ID=anki-backend-android
POM_PACKAGING=aar

POM_NAME=Anki Backend (Android)
POM_DESCRIPTION=Android entry point for the Anki backend
21 changes: 21 additions & 0 deletions rsdroid-android/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ pluginManagement {

rootProject.name = "Anki-Android-Backend"

include(":rsdroid-testing", ":rsdroid-instrumented", ":rsdroid")
include(":rsdroid-testing", ":rsdroid-instrumented", ":rsdroid", ":rsdroid-android")
Loading