Modularize protos (#3152)

pull/3153/head
Phil Oliver 2025-09-19 15:09:08 -04:00 zatwierdzone przez GitHub
rodzic 58adf41510
commit ab2fff219d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
9 zmienionych plików z 86 dodań i 46 usunięć

5
.gitmodules vendored
Wyświetl plik

@ -1,8 +1,5 @@
[submodule "app proto submodule"]
path = app/src/main/proto
url = https://github.com/meshtastic/protobufs.git
[submodule "mesh_service_example proto submodule"]
path = mesh_service_example/src/main/proto
path = core/proto/src/main/proto
url = https://github.com/meshtastic/protobufs.git
[submodule "design"]
path = design

Wyświetl plik

@ -17,7 +17,6 @@
import com.geeksville.mesh.buildlogic.Configs
import com.geeksville.mesh.buildlogic.GitVersionValueSource
import com.google.protobuf.gradle.proto
import java.io.FileInputStream
import java.util.Properties
@ -32,7 +31,6 @@ plugins {
alias(libs.plugins.meshtastic.android.room)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.meshtastic.kotlinx.serialization)
alias(libs.plugins.protobuf)
alias(libs.plugins.devtools.ksp)
alias(libs.plugins.datadog)
alias(libs.plugins.secrets)
@ -147,7 +145,6 @@ android {
bundle { language { enableSplit = false } }
buildFeatures { aidl = true }
sourceSets {
named("main") { proto { srcDir("src/main/proto") } }
// Adds exported schema location as test app assets.
named("androidTest") { assets.srcDirs(files("$projectDir/schemas")) }
}
@ -164,27 +161,8 @@ datadog {
// }
}
// per protobuf-gradle-plugin docs, this is recommended for android
protobuf {
protoc { artifact = libs.protoc.get().toString() }
generateProtoTasks {
all().forEach { task ->
task.builtins {
create("java") {}
create("kotlin") {}
}
}
}
}
// workaround for https://github.com/google/ksp/issues/1590
androidComponents {
onVariants(selector().all()) { variant ->
project.afterEvaluate {
val variantNameCapped = variant.name.replaceFirstChar { it.uppercase() }
tasks.named("ksp${variantNameCapped}Kotlin") { dependsOn("generate${variantNameCapped}Proto") }
}
}
onVariants(selector().withBuildType("release")) { variant ->
if (variant.flavorName == "google") {
val variantNameCapped = variant.name.replaceFirstChar { it.uppercase() }
@ -204,12 +182,12 @@ dependencies {
implementation(projects.core.navigation)
implementation(projects.core.network)
implementation(projects.core.prefs)
implementation(projects.core.proto)
// Bundles
implementation(libs.bundles.markdown)
implementation(libs.bundles.coroutines)
implementation(libs.bundles.datastore)
implementation(libs.bundles.protobuf)
implementation(libs.bundles.coil)
// ZXing

@ -1 +0,0 @@
Subproject commit 6a8b80a10835acf48b2dfa2ad8aa0cc596219619

Wyświetl plik

@ -0,0 +1,58 @@
/*
* Copyright (c) 2025 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
* Copyright (c) 2025 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
plugins {
alias(libs.plugins.meshtastic.android.library)
alias(libs.plugins.protobuf)
}
android { namespace = "org.meshtastic.core.proto" }
// per protobuf-gradle-plugin docs, this is recommended for android
protobuf {
protoc { artifact = libs.protoc.get().toString() }
generateProtoTasks {
all().forEach { task ->
task.builtins {
create("java") {}
create("kotlin") {}
}
}
}
}
dependencies {
// This needs to be API for consuming modules
api(libs.protobuf.kotlin)
}

@ -0,0 +1 @@
Subproject commit 46b81e822af1b8e408f437092337f129dee693e6

Wyświetl plik

@ -199,7 +199,6 @@ coil = ["coil", "coil-network-core", "coil-network-okhttp", "coil-svg"]
datadog = ["dd-sdk-android-compose", "dd-sdk-android-logs", "dd-sdk-android-okhttp", "dd-sdk-android-rum", "dd-sdk-android-session-replay", "dd-sdk-android-session-replay-compose", "dd-sdk-android-timber", "dd-sdk-android-trace", "dd-sdk-android-trace-otel"]
markdown = ["markdown-renderer", "markdown-renderer-m3", "markdown-renderer-android"]
osm = ["osmdroid-android", "osmbonuspack", "mgrs"]
protobuf = ["protobuf-kotlin"]
# Testing
testing = ["junit", "ext-junit"]

Wyświetl plik

@ -1,3 +1,22 @@
/*
* Copyright (c) 2025 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import com.geeksville.mesh.buildlogic.FlavorDimension
import com.geeksville.mesh.buildlogic.MeshtasticFlavor
/*
* Copyright (c) 2025 Meshtastic LLC
*
@ -20,36 +39,26 @@ plugins {
alias(libs.plugins.meshtastic.android.application.compose)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.protobuf)
alias(libs.plugins.kover)
}
android {
namespace = "com.meshtastic.android.meshserviceexample"
buildFeatures { aidl = true }
}
// per protobuf-gradle-plugin docs, this is recommended for android
protobuf {
protoc { protoc { artifact = "com.google.protobuf:protoc:4.32.1" } }
generateProtoTasks {
all().forEach { task ->
task.builtins {
create("java")
create("kotlin")
}
}
defaultConfig {
// Force this app to use the Google variant of any modules it's using that apply AndroidLibraryConventionPlugin
missingDimensionStrategy(FlavorDimension.marketplace.name, MeshtasticFlavor.google.name)
}
}
dependencies {
implementation(projects.core.proto)
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.activity)
implementation(libs.constraintlayout)
implementation(libs.bundles.protobuf)
implementation(libs.kotlinx.serialization.json)
// OSM

@ -1 +0,0 @@
Subproject commit 6a8b80a10835acf48b2dfa2ad8aa0cc596219619

Wyświetl plik

@ -17,7 +17,7 @@ import org.gradle.kotlin.dsl.maven
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include(":app", ":core:model", ":core:navigation", ":core:network", ":core:prefs", ":mesh_service_example")
include(":app", ":core:model", ":core:navigation", ":core:network", ":core:prefs", ":core:proto", ":mesh_service_example")
rootProject.name = "MeshtasticAndroid"
// https://docs.gradle.org/current/userguide/declaring_dependencies.html#sec:type-safe-project-accessors