feat(wire): migrate from protobuf -> wire#4401
Merged
Merged
Conversation
- Refactored core:data repositories to use Wire types and snake_case properties. - Updated core:ui extensions and SecurityIcon to Wire. - Migrated feature:messaging (Message, ViewModel, Reaction) to Wire. - Resolved compilation errors in core:database and core:model. - Added ByteStringSerializer and UserExtensions. - Standardized PortNum and enum usage across migrated modules.
Migrate feature:settings module from Protobuf Java to Wire:
Core Infrastructure:
- Update ConfigState to use Wire's Message<T, *> and ProtoAdapter
- Replace MessageLite with Message in RadioConfigScreenList
- Fix SettingsViewModel imports and property names (snake_case)
- Update SettingsScreen DeviceProfile import
Config Screens (22 files):
- Migrate all config item lists to use Wire adapters
- Replace copy { } builder syntax with copy() method
- Update property names to snake_case (e.g., isServer → is_server)
- Add null safety for nullable configs
- Fix enum references (e.g., SerialConfig → ModuleConfig.SerialConfig)
Files migrated:
- User, Bluetooth, Device, Display, LoRa, Network, Position, Power, Security
- Telemetry, MQTT, Serial, ExternalNotification, StoreForward, RangeTest
- CannedMessage, Audio, RemoteHardware, NeighborInfo, AmbientLighting
- DetectionSensor, Paxcounter, StatusMessage
Partial migration:
- RadioConfigViewModel: removed builder imports, updated RadioConfigState
- ShutdownConfirmationDialog: partial updates
Remaining work (~680 errors):
- RadioConfigViewModel: deviceProfile builder, SecurityConfig refs, property names
- Navigation files: ConfigRoute, ModuleRoute (Protobuf Java imports)
- DebugViewModel: extensive Protobuf Java usage
Used automated script for bulk replacements of common patterns.
…e properties Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit migrates the project from using the `protobuf-java` library to `wire`. This involves changing how Protocol Buffer messages are created, accessed, and serialized throughout the codebase.
Key changes include:
- Replacing builder patterns (`.newBuilder().build()`) with direct constructor instantiation (`MyMessage(...)`).
- Updating field access from `getFieldName()` or `fieldName` to `field_name`.
- Changing `hasFieldName()` checks to nullable property checks (`fieldName != null`).
- Migrating `ByteString` from `com.google.protobuf.ByteString` to `okio.ByteString`.
- Updating serialization/deserialization calls from `parseFrom()` and `toByteArray()` to `MyMessage.ADAPTER.decode()` and `encode()`.
- Adjusting enum value access from `get...Value()` or `.number` to `.value`.
- Removing `copy { ... }` blocks in favor of the `copy(...)` data class method.
This refactoring affects various features, including node management, configuration handling, messaging, mapping, and data handling services, leading to more idiomatic Kotlin code for protobuf interactions.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Removes a number of extraneous line breaks and trailing commas throughout the codebase, primarily within data class and protobuf message instantiations. This change is purely stylistic and has no effect on the application's logic. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit contains various minor cleanups and refactoring within the test suite. The primary change is the removal of redundant multi-line object instantiations, converting them into single-line statements for improved readability across multiple test files. Additionally, the copyright year has been updated in some test files. No functional changes are included. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Refreshes the detekt baseline to reflect the latest codebase state. This includes removing resolved issues and adding new ones to suppress warnings for the time being. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit completes the migration from `com.google.protobuf` to the Wire library for handling protocol buffers. - Deletes `UserExtensions.kt` as its functionality is no longer needed with Wire's generated data classes. - Updates data repositories, tests, and service handlers to use Wire's generated classes and their direct property access (e.g., `user.long_name` instead of `user.longName`). - Modifies entity and model classes (`MeshLog`) to correctly interact with the new Wire objects. - Adjusts ProGuard rules to keep the new Wire-generated classes. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Removes redundant null-safe operators (`?: 0`, `?: 0f`, `?: false`, `?: ""`) on protobuf fields that are now non-nullable. This simplifies the code by removing unnecessary checks for default values. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Protobuf boolean and numeric fields now have non-nullable types, so the explicit `?: 0`, `?: false`, and `== true` checks are no longer necessary. This change cleans up the code by removing this redundant logic. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit introduces several refactoring changes to improve null safety and simplify the codebase. - In `RouteDiscovery.kt`, the destination and source IDs are now correctly read from the data payload (`d.dest` and `d.source`) for more reliable route creation. - The `MeshServiceNotificationsImpl.kt` file has been updated to use Kotlin's `when` expression for better readability and has removed redundant null checks by leveraging non-nullable types, particularly for notification messages and telemetry data formatting. - Extension functions for `LocalStats` and `DeviceMetrics` now operate on non-nullable receivers, simplifying their implementation. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit refactors the build scripts for `core/api`, `core/model`, and `core/proto` to align with modern Kotlin Multiplatform (KMP) publishing practices. Key changes include: - Removing explicit `googleRelease` publications in favor of default KMP behavior. - Renaming the default `proto` artifact to `core-proto` for consistency across modules. - Introducing a convention plugin (`meshtastic.kmp.library`) to simplify the `core/proto` build script. - Standardizing the placement of `afterEvaluate` publishing blocks and cleaning up minor code formatting in various Gradle and source files. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Resolved conflicts in metrics charts: - DeviceMetrics.kt: Combined snake_case properties (HEAD) with upstream filtering logic. - PowerMetrics.kt: Updated retrieveCurrent/retrieveVoltage to return NaN for missing values to support upstream's filtering logic. - SignalMetrics.kt: Applied upstream filtering (non-zero RSSI, non-NaN SNR) to HEAD's property names. - EnvironmentCharts.kt: Preserved upstream's filtering structure ensuring x/y synchronization, while using HEAD's property accessors.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Resolved conflicts in ModuleRoute.kt by combining new upstream logic (isSupported, Icons.Rounded) with Wire migration changes (AdminMessage, snake_case properties).
…g for SFPP hashes
This commit refactors several parts of the codebase to modernize protobuf usage and improve data type consistency.
Key changes include:
- Replaced the deprecated protobuf builder syntax (e.g., `channelSet { ... }`) with direct constructor calls (e.g., `ChannelSet(...)`). This affects various tests and utility functions.
- Changed the data type for SFPP hashes from `ByteArray` to `okio.ByteString` in the `PacketRepository` and `PacketDao`. This provides a more robust and idiomatic way to handle binary data.
- Updated database queries and test assertions to work with `ByteString` for SFPP hash comparisons.
- Removed redundant code and simplified logic in `ChannelSet.kt` and `ModuleRoute.kt`.
- Added a custom `testInstrumentationRunner` to the app's `build.gradle.kts` file.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Adds the `okio.ByteString.Companion.toByteString` import to the `ChannelSet.kt` file. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Renamed the `String.toByteString()` extension function to `String.base64ToByteString()` to more accurately reflect its purpose of decoding a Base64 string. This change includes: - Adding KDoc to clarify that the function decodes a Base64 string and can throw an `IllegalArgumentException`. - Updating the `EditBase64Preference` component to use the new function name. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Moves the Kover XML report generation and Codecov upload to a separate `coverage` job. This new job runs after the `androidTest` job completes. The `koverXmlReport` task is removed from the test execution script within the `androidTest` job. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit enhances the ProGuard configuration for Protobuf classes, ensuring all necessary classes for packet handling, serialization, and configuration are kept during release builds. This prevents potential crashes due to class stripping by R8. Additionally, this commit improves null safety in the `FromRadioPacketHandler` and `MeshDataHandler` by replacing non-null assertions (`!!`) with safe calls (`?.let`), reducing the risk of `NullPointerException`s. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit introduces a suite of Kotlin extension functions for Wire `ProtoAdapter` to improve proto message handling.
Key additions in `core/model/util/WireExtensions.kt`:
- `decodeOrNull`: Provides a safe, null-returning alternative to `decode`, automatically logging any exceptions. It has overloads for both `ByteString` and `ByteArray`.
- `isWithinSizeLimit`: More accurately checks if a message's encoded size is within a specified limit, replacing manual `ByteArray.size` checks.
- `toReadableString`, `toOneLiner`, `logMessage`: Helper functions for improved debugging and logging of proto messages.
These new extensions have been integrated throughout the codebase:
- All `runCatching { ADAPTER.decode(...) }.getOrNull()` calls have been replaced with the new `decodeOrNull` extension.
- TypeConverters in `core/database` now use `decodeOrNull` for safer proto deserialization from the database.
- Packet size validation in `MeshCommandSender` now uses the more accurate `isWithinSizeLimit` and provides a more detailed error message.
- The debug screen (`DebugViewModel`) and data handlers (`MeshDataHandler`) now use `toReadableString` for prettier, more robust proto message formatting.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Replaced the spread operator (`*bytes`) in `ByteString.of(*bytes)` with the more efficient `bytes.toByteString()` extension function.
This change also allowed for the removal of the `@Suppress("SpreadOperator")` annotation.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit refactors the GitHub Actions workflows to improve efficiency and simplify the CI process. Key changes include: - Consolidating the `coverage` job into the `androidTest` job within the `reusable-android-test.yml` workflow. This generates and uploads Kover coverage reports and test results in a single job. - Combining coverage and test result uploads into a single Codecov action step in the `reusable-android-build.yml` workflow. - Disabling test sharding for pull requests by removing `num_shards` from the `pull-request.yml` workflow, as it was not providing performance benefits. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Introduces the `org.gradle.test-retry` Gradle plugin to automatically retry failed tests. This change applies the plugin to both Android application and library modules. It configures a maximum of 2 retries per failed test and a total of 10 max failures for a test suite. The build will not fail if a test passes upon retry. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit enables Gradle's Isolated Projects feature for improved build performance and correctness by making several key adjustments to the build logic. - Enables `org.gradle.isolated-projects=true` in `gradle.properties`. - Refactors `Dokka.kt` and `Kover.kt` aggregation logic to be compatible with isolated projects by adding all subprojects as dependencies directly, rather than iterating and checking for plugins. - Simplifies and rewrites the module dependency graph generation logic in `Graph.kt` to work within the constraints of isolated projects, removing the recursive and configuration-phase heavy implementation. - Cleans up and organizes `gradle.properties` for better readability, adding more optimization flags for AGP, Kotlin, and KSP. - Adds a separate `gradle.properties` for the `build-logic` included build. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
…aggregation Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
# Conflicts: # .github/workflows/pull-request.yml
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the app from Google Protobuf to Square Wire, updating generated model usage, serialization, and build/CI configuration to improve KMP compatibility and align with upstream changes.
Changes:
- Replaced Protobuf-Java builders/parsers with Wire
Message/ADAPTERencode-decode flows across UI, service, datastore, and model layers. - Switched byte handling from
com.google.protobuf.ByteStringtookio.ByteString, updating persistence and serialization paths. - Consolidated/updated build logic and GitHub workflows to run a unified “check” pipeline and support the new proto toolchain.
Reviewed changes
Copilot reviewed 210 out of 235 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| feature/settings/src/main/kotlin/org/meshtastic/feature/settings/radio/component/ConfigState.kt | Updates save/restore to Wire adapter encoding/decoding for config state. |
| feature/settings/src/main/kotlin/org/meshtastic/feature/settings/radio/component/BluetoothConfigItemList.kt | Migrates Bluetooth config UI to Wire models & snake_case fields. |
| feature/settings/src/main/kotlin/org/meshtastic/feature/settings/radio/channel/component/ChannelCard.kt | Updates channel card UI to Wire-generated settings/config types. |
| feature/settings/src/androidTest/kotlin/org/meshtastic/feature/settings/radio/component/EditDeviceProfileDialogTest.kt | Refactors device profile dialog test fixtures to Wire models. |
| feature/node/src/test/kotlin/org/meshtastic/feature/node/metrics/EnvironmentMetricsStateTest.kt | Updates metrics state tests to Wire Telemetry/EnvironmentMetrics. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/model/NodeDetailAction.kt | Switches display units type reference to Wire config enum. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/model/MetricsState.kt | Replaces protobuf message list types with Wire equivalents. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/model/IsEffectivelyUnmessageable.kt | Migrates unmessageable flag access to Wire field naming. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/metrics/TracerouteMapScreen.kt | Updates traceroute overlay/log parsing accessors for Wire fields. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/metrics/PositionLog.kt | Migrates position log screen to Wire Position and nullable fields. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/metrics/NeighborInfoLog.kt | Updates neighbor info UI to Wire user fields and nullable packet paths. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/metrics/HardwareModelExtensions.kt | Updates hardware model enum API usage for Wire (value). |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/metrics/EnvironmentCharts.kt | Updates chart inputs to Wire telemetry and nullable time fields. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/metrics/BaseMetricChart.kt | Updates app bar title user field to Wire long_name. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/list/NodeListViewModel.kt | Migrates shared contact/config access to Wire models and nullability. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/list/NodeListScreen.kt | Updates shared contact type to Wire model. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/detail/NodeDetailScreen.kt | Updates UI to Wire user fields; introduces new loading string usage. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/detail/NodeDetailActions.kt | Updates request action parameters to use Wire user fields. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/component/PowerMetrics.kt | Migrates telemetry power metric fields to Wire snake_case + nullable values. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/component/PositionSection.kt | Updates display units type to Wire config enum. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/component/NodeMenu.kt | Migrates dialog strings to Wire user fields and stringResource usage. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/component/NodeDetailsSection.kt | Updates user/metrics fields to Wire nullable + snake_case. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/component/LinkedCoordinatesItem.kt | Updates geo label to Wire user fields and units type. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/component/ElevationInfo.kt | Updates display units enum reference to Wire config. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/component/AdministrationSection.kt | Updates firmware edition type and metadata fields for Wire. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/compass/CompassViewModel.kt | Migrates compass inputs to Wire Position + nullable DOP/precision fields. |
| feature/node/src/main/kotlin/org/meshtastic/feature/node/compass/CompassUiState.kt | Updates display units type to Wire config enum. |
| feature/node/src/google/kotlin/org/meshtastic/feature/node/component/InlineMap.kt | Migrates precision bits access for Wire position fields. |
| feature/node/detekt-baseline.xml | Updates detekt baseline for refactors/new complexity entries. |
| feature/messaging/src/main/kotlin/org/meshtastic/feature/messaging/component/Reaction.kt | Migrates reaction UI to Wire User model. |
| feature/messaging/src/main/kotlin/org/meshtastic/feature/messaging/component/MessageItem.kt | Updates message UI semantics and chip text to Wire user fields. |
| feature/messaging/src/main/kotlin/org/meshtastic/feature/messaging/MessageViewModel.kt | Migrates channel set/shared contact creation and firmware metadata fields. |
| feature/messaging/src/main/kotlin/org/meshtastic/feature/messaging/MessageListPaged.kt | Updates relay node display name field to Wire long_name. |
| feature/messaging/src/main/kotlin/org/meshtastic/feature/messaging/Message.kt | Updates channel set type and user naming to Wire model fields. |
| feature/messaging/src/androidTest/kotlin/org/meshtastic/feature/messaging/component/MessageItemTest.kt | Updates test expectations for Wire user naming fields. |
| feature/map/src/main/kotlin/org/meshtastic/feature/map/node/NodeMapViewModel.kt | Migrates port enum access and position field comparisons for Wire. |
| feature/map/src/main/kotlin/org/meshtastic/feature/map/BaseMapViewModel.kt | Migrates waypoint/user types and traceroute position maps to Wire. |
| feature/map/src/google/kotlin/org/meshtastic/feature/map/node/NodeMapScreen.kt | Updates app bar title to Wire user fields. |
| feature/map/src/google/kotlin/org/meshtastic/feature/map/model/NodeClusterItem.kt | Migrates precision bits field access for Wire. |
| feature/map/src/google/kotlin/org/meshtastic/feature/map/component/WaypointMarkers.kt | Migrates waypoint markers to Wire Waypoint and nullable fields. |
| feature/map/src/google/kotlin/org/meshtastic/feature/map/MapViewModel.kt | Updates display units flow to Wire config types and waypoint positioning. |
| feature/map/src/fdroid/kotlin/org/meshtastic/feature/map/node/NodeMapScreen.kt | Migrates position list mapping to Wire nullable position fields. |
| feature/map/src/fdroid/kotlin/org/meshtastic/feature/map/MapViewModel.kt | Migrates local config type and default instance construction to Wire. |
| feature/map/src/fdroid/kotlin/org/meshtastic/feature/map/MapViewExtensions.kt | Migrates map marker creation to Wire Position fields. |
| feature/firmware/src/main/kotlin/org/meshtastic/feature/firmware/FirmwareUpdateViewModel.kt | Updates battery/hw model reads for Wire nullable fields and enums. |
| feature/firmware/detekt-baseline.xml | Updates detekt baseline XML formatting/entries. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/util/ProtoExtensions.kt | Replaces protobuf parsing with Wire adapters; updates channel list construction. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/share/SharedContactViewModel.kt | Migrates admin/shared contact types to Wire SharedContact. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/share/SharedContactDialog.kt | Updates shared contact dialog logic for Wire nullable user/public key fields. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/qr/ScannedQrCodeViewModel.kt | Migrates QR channel/config setting to Wire encode/decode. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/component/preview/PreviewUtils.kt | Updates preview fixtures to Wire User/Paxcount/EnvironmentMetrics. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/component/SignalInfo.kt | Migrates device metric fields to Wire snake_case. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/component/SecurityIcon.kt | Migrates channel set/settings/config types to Wire models and fields. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/component/NodeKeyStatusIcon.kt | Switches ByteString import to okio.ByteString. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/component/NodeChip.kt | Updates node chip semantics/text and preview fixtures to Wire models. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/component/ElevationInfo.kt | Updates display units import path to Wire enum. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/component/EditBase64Preference.kt | Migrates base64 decode path to okio ByteString extensions. |
| core/ui/src/main/kotlin/org/meshtastic/core/ui/component/DropDownPreference.kt | Removes protobuf-specific enum deprecation detection logic. |
| core/ui/detekt-baseline.xml | Updates detekt baseline XML formatting/entries. |
| core/strings/src/commonMain/composeResources/values/strings.xml | Adds/replaces string resources related to channel URL and filtering labels. |
| core/service/src/main/kotlin/org/meshtastic/core/service/ServiceRepository.kt | Migrates client notification type to Wire model. |
| core/service/src/main/kotlin/org/meshtastic/core/service/ServiceAction.kt | Migrates shared contact action payload type to Wire SharedContact. |
| core/service/src/main/kotlin/org/meshtastic/core/service/MeshServiceNotifications.kt | Migrates telemetry/client notification types to Wire models. |
| core/service/detekt-baseline.xml | Updates detekt baseline XML formatting/entries. |
| core/proto/consumer-rules.pro | Updates keep rules for Wire-generated proto classes. |
| core/proto/build.gradle.kts | Replaces protobuf plugin with Wire + KMP configuration and publication tweaks. |
| core/network/build.gradle.kts | Removes protobuf plugin usage from network module build config. |
| core/model/src/test/kotlin/org/meshtastic/core/model/NodeInfoTest.kt | Updates display units/hardware model references to Wire enums. |
| core/model/src/test/kotlin/org/meshtastic/core/model/DataPacketTest.kt | Migrates hash storage/assertions to okio ByteString. |
| core/model/src/test/kotlin/org/meshtastic/core/model/ChannelOptionTest.kt | Updates modem preset enum sourcing to Wire config enums. |
| core/model/src/main/kotlin/org/meshtastic/core/model/util/Extensions.kt | Updates toOneLineString redaction logic for Wire toString() output. |
| core/model/src/main/kotlin/org/meshtastic/core/model/util/DistanceExtensions.kt | Migrates units enum usage to Wire value. |
| core/model/src/main/kotlin/org/meshtastic/core/model/util/ChannelSet.kt | Migrates channel URL parsing/serialization to Wire adapter encode/decode. |
| core/model/src/main/kotlin/org/meshtastic/core/model/util/ByteStringSerializer.kt | Adds kotlinx.serialization + Parceler support for okio ByteString. |
| core/model/src/main/kotlin/org/meshtastic/core/model/util/ByteStringExtensions.kt | Replaces protobuf ByteString helpers with okio ByteString base64 helpers. |
| core/model/src/main/kotlin/org/meshtastic/core/model/NeighborInfo.kt | Migrates neighbor info decoding and response formatting to Wire models. |
| core/model/src/main/kotlin/org/meshtastic/core/model/ChannelOption.kt | Migrates LoRa config field access to Wire snake_case fields. |
| core/model/src/main/kotlin/org/meshtastic/core/model/Channel.kt | Migrates channel settings/config + key handling to Wire/okio ByteString. |
| core/model/src/androidTest/kotlin/org/meshtastic/core/model/ChannelTest.kt | Updates channel URL tests and modem preset iteration to Wire enums. |
| core/model/detekt-baseline.xml | Updates detekt baseline XML formatting/entries. |
| core/model/build.gradle.kts | Adjusts publishing configuration blocks ordering/artifact naming. |
| core/datastore/src/main/kotlin/org/meshtastic/core/datastore/serializer/ModuleConfigSerializer.kt | Migrates DataStore serializer to Wire ADAPTER encode/decode. |
| core/datastore/src/main/kotlin/org/meshtastic/core/datastore/serializer/LocalConfigSerializer.kt | Migrates DataStore serializer to Wire ADAPTER encode/decode. |
| core/datastore/src/main/kotlin/org/meshtastic/core/datastore/serializer/ChannelSetSerializer.kt | Migrates DataStore serializer to Wire ADAPTER encode/decode. |
| core/datastore/src/main/kotlin/org/meshtastic/core/datastore/di/DataStoreModule.kt | Updates default instances and corruption handlers for Wire constructors. |
| core/datastore/src/main/kotlin/org/meshtastic/core/datastore/ModuleConfigDataSource.kt | Reworks module config persistence update logic for Wire oneof-nullables. |
| core/datastore/src/main/kotlin/org/meshtastic/core/datastore/LocalConfigDataSource.kt | Reworks local config persistence update logic for Wire oneof-nullables. |
| core/datastore/src/main/kotlin/org/meshtastic/core/datastore/ChannelSetDataSource.kt | Migrates channel set persistence to Wire copy/update patterns. |
| core/datastore/detekt-baseline.xml | Adds detekt baseline for datastore module after refactor. |
| core/database/src/main/kotlin/org/meshtastic/core/database/model/Message.kt | Updates routing error enum value mapping to Wire enums. |
| core/database/src/main/kotlin/org/meshtastic/core/database/entity/TracerouteNodePositionEntity.kt | Migrates stored position type to Wire Position. |
| core/database/src/main/kotlin/org/meshtastic/core/database/entity/Packet.kt | Migrates sfpp_hash storage to okio ByteString. |
| core/database/src/main/kotlin/org/meshtastic/core/database/entity/MeshLog.kt | Reworks log decoding/accessors to use stored Wire FromRadio and adapters. |
| core/database/src/main/kotlin/org/meshtastic/core/database/dao/PacketDao.kt | Updates DAO methods to accept okio ByteString hashes and Wire settings type. |
| core/database/detekt-baseline.xml | Adds detekt baseline for database module issues after migration. |
| core/data/src/main/kotlin/org/meshtastic/core/data/repository/TracerouteSnapshotRepository.kt | Updates snapshot storage types to Wire Position. |
| core/data/src/main/kotlin/org/meshtastic/core/data/repository/RadioConfigRepository.kt | Migrates DeviceProfile assembly to Wire models and nullable fields. |
| core/data/src/main/kotlin/org/meshtastic/core/data/repository/PacketRepository.kt | Migrates hash persistence to okio ByteString and port enum access to Wire. |
| core/data/src/main/kotlin/org/meshtastic/core/data/repository/NodeRepository.kt | Migrates default user creation to Wire User and HardwareModel. |
| core/data/detekt-baseline.xml | Updates detekt baseline XML formatting/entries. |
| core/api/build.gradle.kts | Adjusts publishing to a googleRelease publication name. |
| build-logic/gradle.properties | Adds build-logic gradle tuning and standard headers. |
| build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/ProjectExtensions.kt | Adds test-retry configuration for Gradle test tasks. |
| build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/Kover.kt | Adjusts aggregation to be compatible with isolated projects/plugin application. |
| build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/Dokka.kt | Updates Dokka aggregation dependency wiring. |
| build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt | Applies Gradle test-retry plugin for library modules. |
| build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt | Applies Gradle test-retry plugin for application modules. |
| app/src/test/java/com/geeksville/mesh/ui/metrics/EnvironmentMetricsTest.kt | Migrates test telemetry fixtures to Wire models. |
| app/src/test/java/com/geeksville/mesh/service/StoreForwardHistoryRequestTest.kt | Updates Store & Forward request tests to Wire models/fields. |
| app/src/test/java/com/geeksville/mesh/service/PacketHandlerTest.kt | Updates tests to revised sendToRadio(ToRadio) API and Wire models. |
| app/src/test/java/com/geeksville/mesh/service/MeshNodeManagerTest.kt | Migrates user/position fixtures to Wire model constructors. |
| app/src/test/java/com/geeksville/mesh/service/MeshMessageProcessorTest.kt | Migrates packet fixtures to Wire MeshPacket/Data. |
| app/src/test/java/com/geeksville/mesh/service/MeshDataMapperTest.kt | Migrates payload and port enum handling to Wire/okio ByteString. |
| app/src/test/java/com/geeksville/mesh/service/MeshConnectionManagerTest.kt | Updates LocalConfig fixtures and sendToRadio API usage. |
| app/src/test/java/com/geeksville/mesh/service/MeshCommandSenderTest.kt | Migrates user fixture creation to Wire User. |
| app/src/test/java/com/geeksville/mesh/service/Fakes.kt | Refactors test fakes to match new notifications/types. |
| app/src/test/java/com/geeksville/mesh/repository/radio/TCPInterfaceTest.kt | Updates heartbeat serialization expectations for Wire encoding. |
| app/src/main/java/com/geeksville/mesh/ui/contact/ContactsViewModel.kt | Migrates channel set and user fields to Wire and nullability patterns. |
| app/src/main/java/com/geeksville/mesh/ui/contact/Contacts.kt | Migrates channel set type and settings list access to Wire APIs. |
| app/src/main/java/com/geeksville/mesh/ui/contact/ContactItem.kt | Updates channel set type to Wire model. |
| app/src/main/java/com/geeksville/mesh/ui/connections/components/CurrentlyConnectedInfo.kt | Migrates node metadata/user preview fixtures to Wire models. |
| app/src/main/java/com/geeksville/mesh/ui/connections/ConnectionsViewModel.kt | Updates local config default construction to Wire. |
| app/src/main/java/com/geeksville/mesh/ui/connections/ConnectionsScreen.kt | Updates config enum usage and connection state collection defaults. |
| app/src/main/java/com/geeksville/mesh/service/ReactionReceiver.kt | Migrates reaction payload bytes and port enum to Wire/okio. |
| app/src/main/java/com/geeksville/mesh/service/PacketHandler.kt | Changes send API to ToRadio + Wire encoding, and updates logging. |
| app/src/main/java/com/geeksville/mesh/service/MeshTracerouteHandler.kt | Migrates route discovery field access to Wire snake_case. |
| app/src/main/java/com/geeksville/mesh/service/MeshService.kt | Updates config/channel set serialization and port enum lookup for Wire. |
| app/src/main/java/com/geeksville/mesh/service/MeshNeighborInfoHandler.kt | Replaces protobuf parsing with Wire ADAPTER decode and nullable field access. |
| app/src/main/java/com/geeksville/mesh/service/MeshMqttManager.kt | Migrates MQTT proxy message plumbing to Wire models. |
| app/src/main/java/com/geeksville/mesh/service/MeshLocationManager.kt | Migrates position message creation to Wire Position with nullable fields. |
| app/src/main/java/com/geeksville/mesh/service/MeshHistoryManager.kt | Migrates Store & Forward request creation and payload encoding to Wire. |
| app/src/main/java/com/geeksville/mesh/service/MeshDataMapper.kt | Updates mapping from Wire MeshPacket to DataPacket with nullable fields. |
| app/src/main/java/com/geeksville/mesh/service/MeshConnectionManager.kt | Migrates config/module config reads and ToRadio requests to Wire fields. |
| app/src/main/java/com/geeksville/mesh/service/MeshConfigHandler.kt | Simplifies config progress messaging and migrates types to Wire. |
| app/src/main/java/com/geeksville/mesh/service/FromRadioPacketHandler.kt | Refactors dispatch to Wire nullable oneof fields rather than variant enums. |
| app/src/main/java/com/geeksville/mesh/repository/radio/TCPInterface.kt | Updates heartbeat send to Wire ToRadio.encode(). |
| app/src/main/java/com/geeksville/mesh/repository/radio/RadioInterfaceService.kt | Updates periodic heartbeat construction to Wire. |
| app/src/main/java/com/geeksville/mesh/repository/network/MQTTRepository.kt | Migrates MQTT proxy message creation to Wire MqttClientProxyMessage. |
| app/src/main/java/com/geeksville/mesh/model/UIState.kt | Migrates notification/shared contact/channel set types to Wire. |
| app/build.gradle.kts | Sets a custom instrumentation test runner. |
| .github/workflows/reusable-lint.yml | Removes reusable lint workflow in favor of unified reusable-check workflow. |
| .github/workflows/release.yml | Updates release pipeline to use reusable-check with flags. |
| .github/workflows/pull-request.yml | Consolidates PR CI into a single android-check job. |
| .github/workflows/merge-queue.yml | Consolidates merge queue CI into a single android-check job. |
This commit introduces several optimizations and improvements to the build process.
- **Enable Gradle Doctor:** The Gradle Doctor plugin is now integrated to help diagnose and fix build issues. It runs as part of the `reusable-check.yml` workflow.
- **Add Dependency Guard:** The `dependency-guard` plugin has been added to prevent unexpected dependency updates. A baseline for the `googleReleaseRuntimeClasspath` configuration has been established.
- **Optimize Gradle Performance:**
- Switched from G1GC to ParallelGC for Gradle and Kotlin daemon JVM arguments to improve performance on CI.
- Disabled PNG crunching for faster debug builds.
- **Enhance CI Workflow:**
- Enabled Compose compiler metrics and reports for better insights into composition performance.
- Added a step to report the APK size in the job summary.
- **Dependency Updates:**
- Removed the unused `streamsupport-minifuture` library.
- Switched `guava` from the `-jre` to the `-android` artifact.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit introduces several small refactorings and fixes across the codebase: - Clamps non-positive parameters to zero when building a `StoreAndForward` history request. - Simplifies boolean logic using the Elvis operator (`?:`) in `IsEffectivelyUnmessageable`, `BaseMapViewModel`, and `MeshLog`. - Filters out the "UNRECOGNIZED" option from the Bluetooth pairing mode dropdown. - Excludes telemetry data with a timestamp of 0 from environment charts. - Adds a new string resource `filter_disable_for_contact`. - Removes an unused `loadingMessage` variable in `NodeDetailScreen`. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Exclude `build` and `dependencies` directories from the Kotlin Gradle target in the Spotless configuration to prevent unnecessary formatting checks on generated or vendored files. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit addresses an issue with the manual parceling of the `DataPacket` class, specifically how the `MessageStatus` enum is read from a Parcel. The previous implementation was incorrect, causing `MessageStatus` to be consistently deserialized as null. This has been fixed by manually reading the presence flag and string value that `Parcelize` writes for enums, ensuring correct restoration. Additionally, Robolectric tests have been added to verify the `DataPacket` parcelization logic, covering both full and null-field scenarios to prevent future regressions. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
The Dependency Guard plugin and its associated configuration and workflow tasks have been removed from the project. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This change configures the Wire code generator to flatten `oneof` fields. By setting `boxOneOfsMinSize` to a large value, the intermediate sealed classes for `oneof` fields are removed. Instead, the fields are generated as nullable properties on the parent class. This simplifies code usage and reduces the generated method count and binary size. The existing codebase is already aligned with this flattened structure. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit introduces several code cleanups and minor refactorings across the application to improve clarity, remove redundancy, and enhance efficiency. Key changes include: - **Refactoring:** Simplified logic in `FromRadioPacketHandler`, `DebugViewModel`, and `MeshDataHandler` by removing redundant variables, unnecessary checks, and complex structures. Replaced `if/else` and `when` statements with more direct returns and property access. - **Nullability:** Changed the return type of `TypeConverter` functions in `Converters.kt` from nullable to non-nullable `ByteArray`, ensuring type safety. - **Efficiency:** Removed unused assignments and simplified chained calls in `PacketHandler` and `MeshMessageProcessor`. - **Readability:** Improved code formatting and introduced local variables in `FromRadioPacketHandler` and `MeshDataHandler` for better readability. - **Testing:** Streamlined test case setup in `DataPacketParcelTest`. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
# Conflicts: # core/model/src/main/kotlin/org/meshtastic/core/model/DataPacket.kt
- Updates Robolectric test configuration to target SDK 34.
- Adds `@Suppress("DEPRECATION")` to handle the deprecated `readParcelable` method in `DataPacketParcelTest`.
- Refactors `DataPacketTest` to use `ByteString` and `assertEquals` for byte array comparisons, improving test clarity and consistency.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit refactors the `reusable-check.yml` workflow to run jobs in a matrix across different product flavors (`google`, `fdroid`), in addition to the existing API level matrix. Key changes include: - Renamed the workflow input `test_flavors` to `flavors` and changed its type to a JSON array string. - Added `flavor` to the build matrix, allowing parallel execution for each specified flavor. - Updated Gradle tasks to run for the specific flavor in the matrix, rather than using conditional logic for `google`, `fdroid`, or `both`. - Lint and unit tests now run only on the first API level *and* the first flavor in the matrix to conserve resources. - Simplified artifact uploading by using the matrix `flavor` to dynamically name the artifact and define its path. - Updated `pull-request.yml`, `merge-queue.yml`, and `release.yml` to use the new `flavors` input. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit introduces several changes:
- **`PacketRepository`**: The `hash.toByteString()` conversion is now performed only once and stored in a local variable to avoid redundant calls within loops.
- **`ChannelOptionTest`**: The test is improved to exclude `UNSET` and `UNRECOGNIZED` enum entries from `ModemPreset`, making the test more robust against proto changes.
- **Build Logic**:
- Removes a duplicate `apply(plugin = "meshtastic.dokka")` call in the `AndroidApplicationConventionPlugin`.
- Refactors the Dokka aggregation task to add subprojects as dependencies only if they have the Dokka plugin applied, preventing build configuration errors.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrate Protobuf to Wire & Sync Upstream
Summary
Replaces the Google Protobuf library with Square Wire across the entire application to improve Kotlin Multiplatform (KMP) compatibility and modernize the codebase.
Key Changes