diff --git a/Android.bp b/Android.bp index 46529b7a2..d91128085 100644 --- a/Android.bp +++ b/Android.bp @@ -26,7 +26,8 @@ android_app { "com.google.android.material_material", "kotlinx-coroutines-android", "kotlinx-coroutines-core", - // storage backup lib + // our own gradle module libs + "seedvault-lib-core", "seedvault-lib-storage", // koin "seedvault-lib-koin-core-jvm", // did not manage to add this as transitive dependency @@ -36,7 +37,6 @@ android_app { // WebDAV "seedvault-lib-dav4jvm", "seedvault-lib-okhttp", - "seedvault-lib-okio", ], manifest: "app/src/main/AndroidManifest.xml", diff --git a/core/Android.bp b/core/Android.bp new file mode 100644 index 000000000..d19540919 --- /dev/null +++ b/core/Android.bp @@ -0,0 +1,36 @@ +// +// SPDX-FileCopyrightText: 2021 The Calyx Institute +// SPDX-License-Identifier: Apache-2.0 +// + +android_library { + name: "seedvault-lib-core", + sdk_version: "current", + srcs: [ + "src/main/java/**/*.kt", + "src/main/java/**/*.java", + ], + exclude_srcs: [ + "src/main/java/org/calyxos/seedvault/core/backends/BackendTest.kt", + ], + static_libs: [ + "androidx.core_core-ktx", + "androidx.documentfile_documentfile", + "kotlinx-coroutines-android", + "kotlinx-coroutines-core", + "seedvault-lib-kotlin-logging-jvm", + // WebDAV + "seedvault-lib-dav4jvm", + "seedvault-lib-okhttp", + "okio-lib", + ], + manifest: "src/main/AndroidManifest.xml", + platform_apis: true, + system_ext_specific: true, + optimize: { + enabled: false, + }, + kotlincflags: [ + "-opt-in=kotlin.RequiresOptIn", + ], +} diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 201768ab0..daed7a8f4 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -36,17 +36,17 @@ android { dependencies { val aospLibs: FileTree by rootProject.extra compileOnly(aospLibs) - compileOnly("org.ogce:xpp3:1.1.6") compileOnly(kotlin("test")) implementation(libs.bundles.kotlin) implementation(libs.bundles.coroutines) implementation(libs.androidx.documentfile) implementation(libs.androidx.core.ktx) - // implementation(fileTree("${rootProject.rootDir}/libs/dav4jvm").include("okio-jvm-3.7.0.jar")) implementation(fileTree("${rootProject.rootDir}/libs/dav4jvm").include("*.jar")) - implementation("io.github.oshai:kotlin-logging-jvm:6.0.3") - implementation("org.slf4j:slf4j-simple:2.0.3") + implementation(libs.squareup.okio) + implementation(libs.kotlin.logging) + implementation(libs.slf4j.api) testImplementation(kotlin("test")) testImplementation("org.ogce:xpp3:1.1.6") + testImplementation("org.slf4j:slf4j-simple:2.0.3") } diff --git a/core/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml index 6c244e77d..6099552b2 100644 --- a/core/src/main/AndroidManifest.xml +++ b/core/src/main/AndroidManifest.xml @@ -2,7 +2,8 @@ SPDX-FileCopyrightText: 2021 The Calyx Institute SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/core/src/main/java/org/calyxos/seedvault/core/backends/BackendProperties.kt b/core/src/main/java/org/calyxos/seedvault/core/backends/BackendProperties.kt index f4d4acc6f..1b31136d3 100644 --- a/core/src/main/java/org/calyxos/seedvault/core/backends/BackendProperties.kt +++ b/core/src/main/java/org/calyxos/seedvault/core/backends/BackendProperties.kt @@ -5,10 +5,10 @@ package org.calyxos.seedvault.core.backends -import android.annotation.WorkerThread import android.content.Context import android.net.ConnectivityManager import android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET +import androidx.annotation.WorkerThread import at.bitfire.dav4jvm.exception.HttpException import java.io.IOException diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c29bca2a3..ec08b6848 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -38,6 +38,7 @@ dokka = "1.9.20" # Dokka has no releases after 1.9.20 # Lint versions lint-rules = { strictly = "0.1.0" } +logging = { strictly = "6.0.3" } # Google versions # https://android.googlesource.com/platform/external/protobuf/+/refs/tags/android-14.0.0_r53/java/pom.xml#7 @@ -73,6 +74,11 @@ androidx-documentfile = { strictly = "1.1.0-alpha01" } # 1.1.0-alpha02 in AOSP b # https://android.googlesource.com/platform/prebuilts/sdk/+/android-14.0.0_r53/current/androidx/m2repository/androidx/work/work-runtime-ktx?autodive=0 androidx-work-runtime = { strictly = "2.10.0-alpha01" } +# https://android.googlesource.com/platform/external/okio/+/refs/tags/android-14.0.0_r53/CHANGELOG.md +squareup-okio = { strictly = "3.7.0" } +# https://android.googlesource.com/platform/external/slf4j/+/refs/tags/android-14.0.0_r53/slf4j-api/pom.xml#10 +slf4j-api = { strictly = "2.0.12" } + [libraries] # Kotlin standard dependencies kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } @@ -104,6 +110,10 @@ androidx-documentfile = { module = "androidx.documentfile:documentfile", version androidx-work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "androidx-work-runtime" } androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" } +squareup-okio = { module= "com.squareup.okio:okio", version.ref = "squareup-okio" } +kotlin-logging = { module = "io.github.oshai:kotlin-logging-jvm", version.ref = "logging" } +slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j-api" } + [bundles] kotlin = ["kotlin-stdlib", "kotlin-stdlib-jdk8", "kotlin-stdlib-common"] coroutines = ["kotlinx-coroutines-core-jvm", "kotlinx-coroutines-android"] diff --git a/libs/Android.bp b/libs/Android.bp index 33f511014..29940da43 100644 --- a/libs/Android.bp +++ b/libs/Android.bp @@ -8,3 +8,9 @@ java_import { jars: ["kotlin-bip39-jvm-1.0.6.jar"], sdk_version: "current", } + +java_import { + name: "seedvault-lib-kotlin-logging-jvm", + jars: ["kotlin-logging-jvm-6.0.3.jar"], + sdk_version: "current", +} diff --git a/libs/dav4jvm/Android.bp b/libs/dav4jvm/Android.bp index 660926629..ea70b04be 100644 --- a/libs/dav4jvm/Android.bp +++ b/libs/dav4jvm/Android.bp @@ -14,9 +14,3 @@ java_import { jars: ["okhttp-4.12.0.jar"], sdk_version: "current", } - -java_import { - name: "seedvault-lib-okio", - jars: ["okio-jvm-3.7.0.jar"], - sdk_version: "current", -} diff --git a/libs/dav4jvm/okio-jvm-3.7.0.jar b/libs/dav4jvm/okio-jvm-3.7.0.jar deleted file mode 100644 index 8da081a91..000000000 Binary files a/libs/dav4jvm/okio-jvm-3.7.0.jar and /dev/null differ diff --git a/libs/kotlin-logging-jvm-6.0.3.jar b/libs/kotlin-logging-jvm-6.0.3.jar new file mode 100644 index 000000000..b9f78839b Binary files /dev/null and b/libs/kotlin-logging-jvm-6.0.3.jar differ diff --git a/storage/lib/Android.bp b/storage/lib/Android.bp index d28d5c877..2cac46ca1 100644 --- a/storage/lib/Android.bp +++ b/storage/lib/Android.bp @@ -19,6 +19,7 @@ android_library { local_include_dirs: ["src/main/proto"], }, static_libs: [ + "seedvault-lib-core", "seedvault-lib-tink-android", "libprotobuf-java-lite", "androidx.core_core-ktx", diff --git a/storage/lib/build.gradle.kts b/storage/lib/build.gradle.kts index 49851eec9..5ada1faa4 100644 --- a/storage/lib/build.gradle.kts +++ b/storage/lib/build.gradle.kts @@ -94,9 +94,6 @@ dependencies { implementation(libs.androidx.room.runtime) implementation(libs.google.protobuf.javalite) implementation(libs.google.tink.android) - // TODO include via gradle and AOSP - // https://android.googlesource.com/platform/external/okio/+/refs/tags/android-14.0.0_r53/CHANGELOG.md - implementation(fileTree("${rootProject.rootDir}/libs/dav4jvm").include("okio-jvm-3.7.0.jar")) ksp(group = "androidx.room", name = "room-compiler", version = libs.versions.room.get()) lintChecks(libs.thirdegg.lint.rules)