diff --git a/Android.bp b/Android.bp index e5cfe7a07..a8d835f1e 100644 --- a/Android.bp +++ b/Android.bp @@ -16,6 +16,9 @@ android_app { proto: { type: "lite", local_include_dirs: ["app/src/main/proto"], + output_params: [ + "--kotlin_out=$DST_DIR", + ], }, static_libs: [ "kotlin-stdlib-jdk8", @@ -33,6 +36,7 @@ android_app { "kotlinx-coroutines-android", "kotlinx-coroutines-core", // app backup related libs + "seedvault-lib-protobuf-kotlin-lite", "seedvault-lib-kotlin-logging-jvm", "seedvault-lib-chunker", "seedvault-lib-zstd-jni", diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 22e6af618..db81278fa 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -111,6 +111,9 @@ android { id("java") { option("lite") } + id("kotlin") { + option("lite") + } } } } @@ -177,6 +180,9 @@ dependencies { implementation(fileTree("${rootProject.rootDir}/libs/koin-android").include("*.jar")) implementation(fileTree("${rootProject.rootDir}/libs/koin-android").include("*.aar")) + implementation( + fileTree("${rootProject.rootDir}/libs").include("protobuf-kotlin-lite-3.21.12.jar") + ) implementation(fileTree("${rootProject.rootDir}/libs").include("seedvault-chunker-0.1.jar")) implementation(fileTree("${rootProject.rootDir}/libs").include("zstd-jni-1.5.6-5.aar")) implementation(fileTree("${rootProject.rootDir}/libs").include("kotlin-bip39-jvm-1.0.6.jar")) diff --git a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsActivity.kt b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsActivity.kt index 976cb364c..c9e4cf8c2 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsActivity.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsActivity.kt @@ -10,6 +10,9 @@ import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat.OnPreferenceStartFragmentCallback import com.stevesoltys.seedvault.R +import com.stevesoltys.seedvault.proto.SnapshotKt.apk +import com.stevesoltys.seedvault.proto.copy +import com.stevesoltys.seedvault.proto.snapshot import com.stevesoltys.seedvault.ui.RequireProvisioningActivity import com.stevesoltys.seedvault.ui.RequireProvisioningViewModel import com.stevesoltys.seedvault.ui.recoverycode.ARG_FOR_NEW_CODE @@ -28,6 +31,19 @@ class SettingsActivity : RequireProvisioningActivity(), OnPreferenceStartFragmen override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + val s = snapshot { + token = 23 + } + s.copy { + name = "bar" + } + val a = apk { + versionCode = 42 + } + a.copy { + installer = "foo" + } + setContentView(R.layout.activity_fragment_container) setSupportActionBar(requireViewById(R.id.toolbar)) diff --git a/libs/Android.bp b/libs/Android.bp index ae63f75ad..957fd4468 100644 --- a/libs/Android.bp +++ b/libs/Android.bp @@ -10,6 +10,12 @@ android_library_import { extract_jni: true, } +java_import { + name: "seedvault-lib-protobuf-kotlin-lite", + jars: ["protobuf-kotlin-lite-3.21.12.jar"], + sdk_version: "current", +} + java_import { name: "seedvault-lib-kotlin-bip39", jars: ["kotlin-bip39-jvm-1.0.6.jar"], diff --git a/libs/protobuf-kotlin-lite-3.21.12.jar b/libs/protobuf-kotlin-lite-3.21.12.jar new file mode 100644 index 000000000..a16c4cab5 Binary files /dev/null and b/libs/protobuf-kotlin-lite-3.21.12.jar differ