From b37b613436ac84bf2d29f43494e4afa062db35bf Mon Sep 17 00:00:00 2001 From: zhangskz <89936743+zhangskz@users.noreply.github.com> Date: Tue, 3 May 2022 11:58:31 -0400 Subject: [PATCH] Update protobuf_version.bzl to separate protoc and per-language java major version (#9900) --- java/core/BUILD.bazel | 6 +++--- java/kotlin-lite/BUILD.bazel | 4 ++-- java/kotlin/BUILD.bazel | 4 ++-- java/util/BUILD.bazel | 4 ++-- protobuf_release.bzl | 4 ++-- protobuf_version.bzl | 3 ++- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/java/core/BUILD.bazel b/java/core/BUILD.bazel index 4a3884768..60be80719 100644 --- a/java/core/BUILD.bazel +++ b/java/core/BUILD.bazel @@ -4,7 +4,7 @@ load("@rules_jvm_external//:defs.bzl", "java_export") load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library") load("//:internal.bzl", "conformance_test") -load("//:protobuf_version.bzl", "PROTOBUF_VERSION") +load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION") load("//java/internal:testing.bzl", "junit_tests") LITE_SRCS = [ @@ -116,7 +116,7 @@ java_library( # Bazel users, don't depend on this target, use //java/lite. java_export( name = "lite_mvn", - maven_coordinates = "com.google.protobuf:protobuf-javalite:%s" % PROTOBUF_VERSION, + maven_coordinates = "com.google.protobuf:protobuf-javalite:%s" % PROTOBUF_JAVA_VERSION, pom_template = "//java/lite:pom_template.xml", resources = [ "//:lite_well_known_protos", @@ -151,7 +151,7 @@ java_library( # Bazel users, don't depend on this target, use :core. java_export( name = "core_mvn", - maven_coordinates = "com.google.protobuf:protobuf-java:%s" % PROTOBUF_VERSION, + maven_coordinates = "com.google.protobuf:protobuf-java:%s" % PROTOBUF_JAVA_VERSION, pom_template = "pom_template.xml", resources = [ "//:well_known_protos", diff --git a/java/kotlin-lite/BUILD.bazel b/java/kotlin-lite/BUILD.bazel index 88f6014fc..47b02c2ae 100644 --- a/java/kotlin-lite/BUILD.bazel +++ b/java/kotlin-lite/BUILD.bazel @@ -2,7 +2,7 @@ load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") load("@rules_java//java:defs.bzl", "java_lite_proto_library") load("@rules_jvm_external//:kt_defs.bzl", "kt_jvm_export") load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") -load("//:protobuf_version.bzl", "PROTOBUF_VERSION") +load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION") load("//:protobuf.bzl", "internal_gen_kt_protos") java_lite_proto_library( @@ -34,7 +34,7 @@ kt_jvm_export( "@com_github_jetbrains_kotlin//:kotlin-stdlib", "//java/lite", ], - maven_coordinates = "com.google.protobuf:protobuf-kotlin-lite:%s" % PROTOBUF_VERSION, + maven_coordinates = "com.google.protobuf:protobuf-kotlin-lite:%s" % PROTOBUF_JAVA_VERSION, pom_template = "//java/kotlin-lite:pom_template.xml", resources = ["//:well_known_protos"], runtime_deps = [ diff --git a/java/kotlin/BUILD.bazel b/java/kotlin/BUILD.bazel index c48cb0376..a3cf83d46 100644 --- a/java/kotlin/BUILD.bazel +++ b/java/kotlin/BUILD.bazel @@ -3,7 +3,7 @@ load("@rules_java//java:defs.bzl", "java_proto_library") load("@rules_jvm_external//:kt_defs.bzl", "kt_jvm_export") load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//:protobuf_version.bzl", "PROTOBUF_VERSION") +load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION") load("//:protobuf.bzl", "internal_gen_kt_protos") exports_files([ @@ -56,7 +56,7 @@ kt_jvm_export( "@com_github_jetbrains_kotlin//:kotlin-stdlib", "//java/core", ], - maven_coordinates = "com.google.protobuf:protobuf-kotlin:%s" % PROTOBUF_VERSION, + maven_coordinates = "com.google.protobuf:protobuf-kotlin:%s" % PROTOBUF_JAVA_VERSION, pom_template = "//java/kotlin:pom_template.xml", resources = ["//:well_known_protos"], runtime_deps = [ diff --git a/java/util/BUILD.bazel b/java/util/BUILD.bazel index ac9b5fde3..bea3099da 100644 --- a/java/util/BUILD.bazel +++ b/java/util/BUILD.bazel @@ -2,7 +2,7 @@ load("@rules_java//java:defs.bzl", "java_proto_library") load("@rules_jvm_external//:defs.bzl", "java_export") load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//:protobuf_version.bzl", "PROTOBUF_VERSION") +load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION") load("//java/internal:testing.bzl", "junit_tests") java_library( @@ -25,7 +25,7 @@ java_library( java_export( name = "util_mvn", deploy_env = ["//java/core"], - maven_coordinates = "com.google.protobuf:protobuf-java-util:%s" % PROTOBUF_VERSION, + maven_coordinates = "com.google.protobuf:protobuf-java-util:%s" % PROTOBUF_JAVA_VERSION, pom_template = "pom_template.xml", visibility = ["//java:__pkg__"], runtime_deps = [":util"], diff --git a/protobuf_release.bzl b/protobuf_release.bzl index c5d5f2bf2..327ae9a0a 100644 --- a/protobuf_release.bzl +++ b/protobuf_release.bzl @@ -4,11 +4,11 @@ Generates package naming variables for use with rules_pkg. load("@rules_pkg//:providers.bzl", "PackageVariablesInfo") load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") -load(":protobuf_version.bzl", "PROTOBUF_VERSION") +load(":protobuf_version.bzl", "PROTOC_VERSION") def _package_naming_impl(ctx): values = {} - values["version"] = PROTOBUF_VERSION + values["version"] = PROTOC_VERSION # infer from the current cpp toolchain. toolchain = find_cpp_toolchain(ctx) diff --git a/protobuf_version.bzl b/protobuf_version.bzl index 98cf8371d..8da8329be 100644 --- a/protobuf_version.bzl +++ b/protobuf_version.bzl @@ -1 +1,2 @@ -PROTOBUF_VERSION = '3.20.1' +PROTOC_VERSION = '3.20.1' +PROTOBUF_JAVA_VERSION = '3.20.1'