Skip to content

Commit

Permalink
Add proto datastore dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Dec 19, 2024
1 parent 83b08bf commit 2b0a1ee
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
28 changes: 20 additions & 8 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ plugins {
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.kotlin.ksp)
alias(libs.plugins.compose)
alias(libs.plugins.protobuf.core)

id(Dependencies.junit5AndroidPluginId) version Versions.junit5Plugin
}
Expand Down Expand Up @@ -55,11 +56,7 @@ android {
}
}

playConfigs {
register("playStagemoleRelease") {
enabled = true
}
}
playConfigs { register("playStagemoleRelease") { enabled = true } }

androidResources {
@Suppress("UnstableApiUsage")
Expand Down Expand Up @@ -222,8 +219,7 @@ android {
}

val variantName = name
val capitalizedVariantName =
variantName.toString().capitalized()
val capitalizedVariantName = variantName.toString().capitalized()
val artifactName = "MullvadVPN-${versionName}${artifactSuffix}"

tasks.register<Copy>("create${capitalizedVariantName}DistApk") {
Expand Down Expand Up @@ -316,7 +312,8 @@ tasks.create("printVersion") {

play {
serviceAccountCredentials.set(file("$credentialsPath/play-api-key.json"))
// Disable for all flavors by default. Only specific flavors should be enabled using PlayConfigs.
// Disable for all flavors by default. Only specific flavors should be enabled using
// PlayConfigs.
enabled = false
// This property refers to the Publishing API (not git).
commit = true
Expand All @@ -326,6 +323,19 @@ play {
userFraction = 1.0
}

protobuf {
protoc { artifact = libs.plugins.protobuf.protoc.get().toString() }
plugins {
create("java") { artifact = libs.plugins.grpc.protoc.gen.grpc.java.get().toString() }
}
generateProtoTasks {
all().forEach {
it.plugins { create("java") { option("lite") } }
it.builtins { create("kotlin") { option("lite") } }
}
}
}

dependencies {
implementation(projects.lib.common)
implementation(projects.lib.daemonGrpc)
Expand All @@ -345,6 +355,7 @@ dependencies {

implementation(libs.commons.validator)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.datastore)
implementation(libs.androidx.ktx)
implementation(libs.androidx.coresplashscreen)
implementation(libs.androidx.lifecycle.runtime)
Expand All @@ -370,6 +381,7 @@ dependencies {
implementation(libs.kotlin.reflect)
implementation(libs.kotlin.stdlib)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.protobuf.kotlin.lite)

// UI tooling
implementation(libs.compose.ui.tooling.preview)
Expand Down
6 changes: 6 additions & 0 deletions android/app/src/main/proto/user_prefs.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
syntax = "proto3";

option java_package = "net.mullvad.mullvadvpn.repository";
option java_multiple_files = true;

message UserPreferences { bool is_privacy_disclosure_accepted = 1; }
14 changes: 9 additions & 5 deletions android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ androidx-activitycompose = "1.9.3"
androidx-appcompat = "1.7.0"
androidx-ktx = "1.15.0"
androidx-coresplashscreen = "1.1.0-rc01"
androidx-datastore = "1.1.1"
androidx-espresso = "3.6.1"
androidx-lifecycle = "2.8.7"
androidx-test = "1.6.1"
Expand All @@ -33,7 +34,6 @@ compose-material3 = "1.3.1"
grpc = "1.69.0"
grpc-kotlin = "1.4.1"
grpc-kotlin-jar = "1.4.1:jdk8@jar"
grpc-protobuf = "4.29.1"

# Koin
koin = "4.0.0"
Expand All @@ -51,7 +51,8 @@ kotlinx = "1.9.0"
kotlinx-serialization = "2.1.0"

# Protobuf
protobuf = "0.9.4"
protobuf-gradle-plugin = "0.9.4"
protobuf = "4.29.1"

# Misc
commonsvalidator = "1.9.0"
Expand Down Expand Up @@ -81,6 +82,7 @@ android-volley = { module = "com.android.volley:volley", version.ref = "android-
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activitycompose" }
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
androidx-coresplashscreen = { module = "androidx.core:core-splashscreen", version.ref = "androidx-coresplashscreen" }
androidx-datastore = { module = "androidx.datastore:datastore", version.ref = "androidx-datastore" }
androidx-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-espresso" }
androidx-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-ktx" }
androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
Expand Down Expand Up @@ -119,7 +121,9 @@ grpc-okhttp = { module = "io.grpc:grpc-okhttp", version.ref = "grpc" }
grpc-android = { module = "io.grpc:grpc-android", version.ref = "grpc" }
grpc-kotlin-stub = { module = "io.grpc:grpc-kotlin-stub", version.ref = "grpc-kotlin" }
grpc-protobuf-lite = { module = "io.grpc:grpc-protobuf-lite", version.ref = "grpc" }
grpc-protobuf-kotlin-lite = { module = "com.google.protobuf:protobuf-kotlin-lite", version.ref = "grpc-protobuf" }

# Protobuf
protobuf-kotlin-lite = { module = "com.google.protobuf:protobuf-kotlin-lite", version.ref = "protobuf" }

# Koin
koin = { module = "io.insert-koin:koin-core", version.ref = "koin" }
Expand Down Expand Up @@ -177,8 +181,8 @@ kotlin-ksp = { id = "com.google.devtools.ksp", version.ref = "kotlin-ksp" }
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlinx-serialization" }

# Protobuf
protobuf-core = { id = "com.google.protobuf", version.ref = "protobuf" }
protobuf-protoc = { id = "com.google.protobuf:protoc", version.ref = "grpc-protobuf" }
protobuf-core = { id = "com.google.protobuf", version.ref = "protobuf-gradle-plugin" }
protobuf-protoc = { id = "com.google.protobuf:protoc", version.ref = "protobuf" }

# gRPC
grpc-protoc-gen-grpc-java = { id = "io.grpc:protoc-gen-grpc-java", version.ref = "grpc" }
Expand Down
2 changes: 1 addition & 1 deletion android/lib/daemon-grpc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ dependencies {
implementation(libs.grpc.android)
implementation(libs.grpc.kotlin.stub)
implementation(libs.grpc.protobuf.lite)
implementation(libs.grpc.protobuf.kotlin.lite)
implementation(libs.protobuf.kotlin.lite)

implementation(libs.arrow)
implementation(libs.arrow.optics)
Expand Down

0 comments on commit 2b0a1ee

Please sign in to comment.