From adced8bbb2f5a941ec3b2a7293125a8383211bac Mon Sep 17 00:00:00 2001 From: Matt Sicker Date: Thu, 7 Nov 2024 14:04:33 -0600 Subject: [PATCH] refactor(proto): Extract protobuf dependency management In order to use a managed dependency in the `protoc` configuration settings, dependencyResolutionManagement must be used instead of enforcePlatform. --- kork-proto/kork-proto.gradle | 8 +++----- settings.gradle | 13 +++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/kork-proto/kork-proto.gradle b/kork-proto/kork-proto.gradle index 85b74fa5f..8806e6d0d 100644 --- a/kork-proto/kork-proto.gradle +++ b/kork-proto/kork-proto.gradle @@ -1,18 +1,16 @@ plugins { - id "java-library" - id "com.google.protobuf" version "0.8.12" + alias libs.plugins.protobuf } dependencies { api(platform(project(":spinnaker-dependencies"))) - implementation "com.google.protobuf:protobuf-java" + implementation libs.protobuf.java } protobuf { protoc { - // TODO: figure out how to reference version in BOM. - artifact = "com.google.protobuf:protoc:3.21.12" + artifact = libs.protoc.get() } } diff --git a/settings.gradle b/settings.gradle index 40df92e74..336240560 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,6 +14,19 @@ * limitations under the License. */ +dependencyResolutionManagement { + versionCatalogs { + libs { + version('protobuf', '3.25.2') + + library('protobuf-java', 'com.google.protobuf', 'protobuf-java').versionRef('protobuf') + library('protoc', 'com.google.protobuf', 'protoc').versionRef('protobuf') + + plugin('protobuf', 'com.google.protobuf').version('0.9.4') + } + } +} + if (spinnakerGradleVersion.endsWith('-SNAPSHOT')) { pluginManagement { repositories {