Skip to content

Commit

Permalink
clean up libs and fix AOSP build
Browse files Browse the repository at this point in the history
  • Loading branch information
grote committed Aug 28, 2024
1 parent 48aea1d commit 5030eea
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,7 +37,6 @@ android_app {
// WebDAV
"seedvault-lib-dav4jvm",
"seedvault-lib-okhttp",
"seedvault-lib-okio",
],
manifest: "app/src/main/AndroidManifest.xml",

Expand Down
36 changes: 36 additions & 0 deletions core/Android.bp
Original file line number Diff line number Diff line change
@@ -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",
],
}
8 changes: 4 additions & 4 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
3 changes: 2 additions & 1 deletion core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
SPDX-FileCopyrightText: 2021 The Calyx Institute
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.calyxos.seedvault.core">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" }
Expand Down Expand Up @@ -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"]
Expand Down
6 changes: 6 additions & 0 deletions libs/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
6 changes: 0 additions & 6 deletions libs/dav4jvm/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Binary file removed libs/dav4jvm/okio-jvm-3.7.0.jar
Binary file not shown.
Binary file added libs/kotlin-logging-jvm-6.0.3.jar
Binary file not shown.
1 change: 1 addition & 0 deletions storage/lib/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions storage/lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5030eea

Please sign in to comment.