Update protobuf_version.bzl to separate protoc and per-language java major version (#9900)

This commit is contained in:
zhangskz 2022-05-03 11:58:31 -04:00 committed by GitHub
parent cdc11c2d2d
commit b37b613436
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 12 deletions

View File

@ -4,7 +4,7 @@ load("@rules_jvm_external//:defs.bzl", "java_export")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library") load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
load("//:internal.bzl", "conformance_test") 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") load("//java/internal:testing.bzl", "junit_tests")
LITE_SRCS = [ LITE_SRCS = [
@ -116,7 +116,7 @@ java_library(
# Bazel users, don't depend on this target, use //java/lite. # Bazel users, don't depend on this target, use //java/lite.
java_export( java_export(
name = "lite_mvn", 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", pom_template = "//java/lite:pom_template.xml",
resources = [ resources = [
"//:lite_well_known_protos", "//:lite_well_known_protos",
@ -151,7 +151,7 @@ java_library(
# Bazel users, don't depend on this target, use :core. # Bazel users, don't depend on this target, use :core.
java_export( java_export(
name = "core_mvn", 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", pom_template = "pom_template.xml",
resources = [ resources = [
"//:well_known_protos", "//:well_known_protos",

View File

@ -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_java//java:defs.bzl", "java_lite_proto_library")
load("@rules_jvm_external//:kt_defs.bzl", "kt_jvm_export") load("@rules_jvm_external//:kt_defs.bzl", "kt_jvm_export")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") 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") load("//:protobuf.bzl", "internal_gen_kt_protos")
java_lite_proto_library( java_lite_proto_library(
@ -34,7 +34,7 @@ kt_jvm_export(
"@com_github_jetbrains_kotlin//:kotlin-stdlib", "@com_github_jetbrains_kotlin//:kotlin-stdlib",
"//java/lite", "//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", pom_template = "//java/kotlin-lite:pom_template.xml",
resources = ["//:well_known_protos"], resources = ["//:well_known_protos"],
runtime_deps = [ runtime_deps = [

View File

@ -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_jvm_external//:kt_defs.bzl", "kt_jvm_export")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library") 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") load("//:protobuf.bzl", "internal_gen_kt_protos")
exports_files([ exports_files([
@ -56,7 +56,7 @@ kt_jvm_export(
"@com_github_jetbrains_kotlin//:kotlin-stdlib", "@com_github_jetbrains_kotlin//:kotlin-stdlib",
"//java/core", "//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", pom_template = "//java/kotlin:pom_template.xml",
resources = ["//:well_known_protos"], resources = ["//:well_known_protos"],
runtime_deps = [ runtime_deps = [

View File

@ -2,7 +2,7 @@ load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_jvm_external//:defs.bzl", "java_export") load("@rules_jvm_external//:defs.bzl", "java_export")
load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix") load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library") 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") load("//java/internal:testing.bzl", "junit_tests")
java_library( java_library(
@ -25,7 +25,7 @@ java_library(
java_export( java_export(
name = "util_mvn", name = "util_mvn",
deploy_env = ["//java/core"], 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", pom_template = "pom_template.xml",
visibility = ["//java:__pkg__"], visibility = ["//java:__pkg__"],
runtime_deps = [":util"], runtime_deps = [":util"],

View File

@ -4,11 +4,11 @@ Generates package naming variables for use with rules_pkg.
load("@rules_pkg//:providers.bzl", "PackageVariablesInfo") load("@rules_pkg//:providers.bzl", "PackageVariablesInfo")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") 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): def _package_naming_impl(ctx):
values = {} values = {}
values["version"] = PROTOBUF_VERSION values["version"] = PROTOC_VERSION
# infer from the current cpp toolchain. # infer from the current cpp toolchain.
toolchain = find_cpp_toolchain(ctx) toolchain = find_cpp_toolchain(ctx)

View File

@ -1 +1,2 @@
PROTOBUF_VERSION = '3.20.1' PROTOC_VERSION = '3.20.1'
PROTOBUF_JAVA_VERSION = '3.20.1'