diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de5dad32f..01fb51b11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,9 @@ jobs: run: | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;25.2.9519653" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null + - name: Install Rust Toolchain + run: rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android + - name: Ktlint Check run: ./gradlew ktlintCheck diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 60f9d61f7..f5c41d2fb 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,6 +1,6 @@ name: Pull Request Check -on: [pull_request] +on: [ pull_request ] jobs: linux: @@ -22,6 +22,9 @@ jobs: run: | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;25.2.9519653" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null + - name: Install Rust Toolchain + run: rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android + - name: Ktlint Check run: ./gradlew ktlintCheck diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index e16493f7a..2b573b0f3 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -25,6 +25,9 @@ jobs: run: | echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;25.2.9519653" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null + - name: Install Rust Toolchain + run: rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android + - name: Gradle Build uses: gradle/gradle-build-action@v2 with: @@ -60,7 +63,7 @@ jobs: - name: Push Apks uses: Ehviewer-Overhauled/github-action-push-to-another-repository@main env: - SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} + SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} with: source-directory: app/build/outputs/apk/release/fdroid destination-github-username: Ehviewer-Overhauled diff --git a/app/build.gradle.kts b/app/build.gradle.kts index adcb6ff12..1b25a3af6 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -14,6 +14,7 @@ plugins { kotlin("plugin.serialization") id("com.google.devtools.ksp") id("com.mikepenz.aboutlibraries.plugin") + id("org.mozilla.rust-android-gradle.rust-android") } android { @@ -263,3 +264,17 @@ aboutLibraries { duplicationMode = MERGE duplicationRule = GROUP } + +cargo { + module = "src/main/rust" + libname = "ehviewer_rust" + targets = listOf("arm", "x86", "arm64", "x86_64") +} + +tasks.whenObjectAdded { + if ((this.name == "mergeDebugJniLibFolders" || this.name == "mergeReleaseJniLibFolders")) { + this.dependsOn("cargoBuild") + // fix mergeDebugJniLibFolders UP-TO-DATE + this.inputs.dir(buildDir.resolve("rustJniLibs/android")) + } +} diff --git a/app/src/main/rust/.gitignore b/app/src/main/rust/.gitignore new file mode 100644 index 000000000..ea8c4bf7f --- /dev/null +++ b/app/src/main/rust/.gitignore @@ -0,0 +1 @@ +/target diff --git a/app/src/main/rust/Cargo.lock b/app/src/main/rust/Cargo.lock new file mode 100644 index 000000000..4c12743ce --- /dev/null +++ b/app/src/main/rust/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ehviewer_rust" +version = "0.1.0" diff --git a/app/src/main/rust/Cargo.toml b/app/src/main/rust/Cargo.toml new file mode 100644 index 000000000..2645a92f4 --- /dev/null +++ b/app/src/main/rust/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "ehviewer_rust" +version = "0.1.0" + +[lib] +crate_type = ["staticlib", "dylib"] + +[dependencies] diff --git a/app/src/main/rust/src/lib.rs b/app/src/main/rust/src/lib.rs new file mode 100644 index 000000000..aa0e8287e --- /dev/null +++ b/app/src/main/rust/src/lib.rs @@ -0,0 +1,3 @@ +fn main() { + println!(""); +} diff --git a/build.gradle.kts b/build.gradle.kts index 87d9f0fde..0abecd2bc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,5 +17,6 @@ tasks.register("Delete", Delete::class) { buildscript { dependencies { classpath("com.android.tools:r8:8.2.12-dev") + classpath("org.mozilla.rust-android-gradle:plugin:0.9.3") } }