blob: 8fa92db4ea591cc5665d888ead2cc2b177e57d73 [file]
diff --git a/MODULE.bazel b/MODULE.bazel
index a490e51b27..d5b3e174b7 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -40,7 +40,7 @@ bazel_dep(name = "rules_kotlin", version = "2.3.20")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_python", version = "1.6.0")
-bazel_dep(name = "rules_rust", version = "0.69.0")
+bazel_dep(name = "rules_rust", version = "0.69.0", dev_dependency = True)
bazel_dep(name = "rules_ruby", version = "0.20.1", dev_dependency = True)
@@ -194,7 +194,7 @@ rust.toolchain(
versions = ["1.85.0"],
)
-crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate")
+crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate", dev_dependency = True)
crate.spec(
package = "googletest",
version = ">0.0.0",
diff --git a/bazel/flags/BUILD b/bazel/flags/BUILD
index 393fab95d6..9012b01649 100644
--- a/bazel/flags/BUILD
+++ b/bazel/flags/BUILD
@@ -46,7 +46,7 @@ string_list_flag(
# This is now enabled by default.
bool_flag(
name = "prefer_prebuilt_protoc",
- build_setting_default = True,
+ build_setting_default = False,
# See https://github.com/protocolbuffers/protobuf/issues/25561
scope = "universal", # propagate from host to exec configuration
visibility = ["//bazel/toolchains:__pkg__"],
diff --git a/java/core/BUILD.bazel b/java/core/BUILD.bazel
index 4cbd4732c1..2e789054c8 100644
--- a/java/core/BUILD.bazel
+++ b/java/core/BUILD.bazel
@@ -183,10 +183,7 @@ protobuf_java_export(
protobuf_java_library(
name = "lite_runtime_only",
srcs = LITE_SRCS,
- visibility = [
- "//java/kotlin:__pkg__",
- "//java/lite:__pkg__",
- ],
+ visibility = ["//visibility:public"],
)
proto_library(
diff --git a/src/google/protobuf/compiler/java/full/message.cc b/src/google/protobuf/compiler/java/full/message.cc
index 819f20a44b..e3f7b82701 100644
--- a/src/google/protobuf/compiler/java/full/message.cc
+++ b/src/google/protobuf/compiler/java/full/message.cc
@@ -875,32 +875,26 @@ void ImmutableMessageGenerator::GenerateIsInitialized(io::Printer* printer) {
// Memoizes whether the protocol buffer is fully initialized (has all
// required fields). -1 means not yet computed. 0 means false and 1 means
// true.
- if (internal::IsOss()) {
- // Leave this as non-transient in OSS to avoid breaking customers that are
- // holding GSON wrong.
- // TODO: Remove this in a future PBJ breaking release.
- printer->Print("private byte memoizedIsInitialized = -1;\n");
- } else {
- // If the message transitively has no required fields or extensions,
- // isInitialized() is always true.
- if (!HasRequiredFields(descriptor_)) {
- printer->Print(
- "/**\n"
- " * @deprecated This always returns true for this type as it \n"
- " * does not transitively contain any required fields.\n"
- " */\n"
- "@java.lang.Deprecated\n"
- "@java.lang.Override\n"
- "public final boolean isInitialized() {\n"
- " return true;\n"
- "}\n"
- "\n");
- return;
- }
- printer->Print("private transient byte memoizedIsInitialized = -1;\n");
+ // If the message transitively has no required fields or extensions,
+ // isInitialized() is always true.
+ if (!HasRequiredFields(descriptor_)) {
+ printer->Print(
+ "/**\n"
+ " * @deprecated This always returns true for this type as it \n"
+ " * does not transitively contain any required fields.\n"
+ " */\n"
+ "@java.lang.Deprecated\n"
+ "@java.lang.Override\n"
+ "public final boolean isInitialized() {\n"
+ " return true;\n"
+ "}\n"
+ "\n");
+ return;
}
+ printer->Print("private transient byte memoizedIsInitialized = -1;\n");
+
printer->Print(
"@java.lang.Override\n"
"public final boolean isInitialized() {\n");
diff --git a/upb/BUILD b/upb/BUILD
index 4ce905cbbf..d8e701c131 100644
--- a/upb/BUILD
+++ b/upb/BUILD
@@ -125,6 +125,26 @@ cc_library(
visibility = ["//hpb/bazel:__pkg__"],
)
+# Aliases ######################################################################
+
+alias(
+ name = "base",
+ actual = "//upb/base",
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "mem",
+ actual = "//upb/mem",
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "message",
+ actual = "//upb/message",
+ visibility = ["//visibility:public"],
+)
+
# Amalgamation #################################################################
upb_amalgamation(
diff --git a/upb/bazel/private/BUILD b/upb/bazel/private/BUILD
index 0c7ac5d672..9ee2f21179 100644
--- a/upb/bazel/private/BUILD
+++ b/upb/bazel/private/BUILD
@@ -23,6 +23,6 @@ bzl_library(
"//bazel/common:proto_common_bzl",
"//bazel/common:proto_info_bzl",
"@bazel_skylib//lib:paths",
- "@bazel_tools//tools/cpp:toolchain_utils.bzl",
+ "@rules_cc//cc:find_cc_toolchain_bzl",
],
)
diff --git a/upb/bazel/private/upb_proto_library_internal/aspect.bzl b/upb/bazel/private/upb_proto_library_internal/aspect.bzl
index 61f70a8561..b625db3eea 100644
--- a/upb/bazel/private/upb_proto_library_internal/aspect.bzl
+++ b/upb/bazel/private/upb_proto_library_internal/aspect.bzl
@@ -1,6 +1,6 @@
"""Implementation of the aspect that powers the upb_*_proto_library() rules."""
-load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
+load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain")
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("//bazel/common:proto_common.bzl", "proto_common")
@@ -244,7 +244,7 @@ def upb_proto_aspect_impl(
)
else:
proto_info = target[ProtoInfo]
- cc_toolchain = find_cpp_toolchain(ctx)
+ cc_toolchain = find_cc_toolchain(ctx)
feature_configuration = _get_feature_configuration(ctx, cc_toolchain, proto_info)
files = _generate_upb_protos(
ctx,
diff --git a/upb/bazel/private/upb_proto_library_internal/cc_library_func.bzl b/upb/bazel/private/upb_proto_library_internal/cc_library_func.bzl
index 47fc5a1cc2..90db085061 100644
--- a/upb/bazel/private/upb_proto_library_internal/cc_library_func.bzl
+++ b/upb/bazel/private/upb_proto_library_internal/cc_library_func.bzl
@@ -1,11 +1,11 @@
"""A function to compile C/C++ code, like cc_library() but from Starlark."""
-load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
+load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain", "use_cc_toolchain")
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
def upb_use_cpp_toolchain():
- return use_cpp_toolchain()
+ return use_cc_toolchain()
def cc_library_func(ctx, name, hdrs, srcs, copts, dep_ccinfos, includes = [], alwayslink = False):
"""Like cc_library(), but callable from rules.
@@ -25,7 +25,7 @@ def cc_library_func(ctx, name, hdrs, srcs, copts, dep_ccinfos, includes = [], al
compilation_contexts = [info.compilation_context for info in dep_ccinfos]
linking_contexts = [info.linking_context for info in dep_ccinfos]
- toolchain = find_cpp_toolchain(ctx)
+ toolchain = find_cc_toolchain(ctx)
feature_configuration = cc_common.configure_features(
ctx = ctx,
cc_toolchain = toolchain,
diff --git a/upb/bazel/upb_c_proto_library.bzl b/upb/bazel/upb_c_proto_library.bzl
index d09387be84..3c47e50993 100644
--- a/upb/bazel/upb_c_proto_library.bzl
+++ b/upb/bazel/upb_c_proto_library.bzl
@@ -38,7 +38,7 @@ upb_c_proto_library_aspect = aspect(
default = Label("//upb_generator/c:toolchain"),
),
"_cc_toolchain": attr.label(
- default = "@bazel_tools//tools/cpp:current_cc_toolchain",
+ default = "@rules_cc//cc:current_cc_toolchain",
),
},
implementation = _upb_c_proto_library_aspect_impl,
diff --git a/upb/bazel/upb_minitable_proto_library.bzl b/upb/bazel/upb_minitable_proto_library.bzl
index 6a27082c68..9520a44ec8 100644
--- a/upb/bazel/upb_minitable_proto_library.bzl
+++ b/upb/bazel/upb_minitable_proto_library.bzl
@@ -53,7 +53,7 @@ upb_minitable_proto_library_aspect = aspect(
default = Label("//upb_generator/minitable:toolchain"),
),
"_cc_toolchain": attr.label(
- default = "@bazel_tools//tools/cpp:current_cc_toolchain",
+ default = "@rules_cc//cc:current_cc_toolchain",
),
"_fasttable_enabled": attr.label(default = "//upb:fasttable_enabled"),
},
diff --git a/upb/bazel/upb_proto_reflection_library.bzl b/upb/bazel/upb_proto_reflection_library.bzl
index 77f168ef28..0a3e159807 100644
--- a/upb/bazel/upb_proto_reflection_library.bzl
+++ b/upb/bazel/upb_proto_reflection_library.bzl
@@ -37,7 +37,7 @@ _upb_proto_reflection_library_aspect = aspect(
cfg = getattr(proto_common, "proto_lang_toolchain_cfg", "target"),
),
"_cc_toolchain": attr.label(
- default = "@bazel_tools//tools/cpp:current_cc_toolchain",
+ default = "@rules_cc//cc:current_cc_toolchain",
),
},
implementation = _upb_proto_reflection_library_aspect_impl,
diff --git a/upb_generator/minitable/generator.cc b/upb_generator/minitable/generator.cc
index 54f8490ce4..801c58a8b2 100644
--- a/upb_generator/minitable/generator.cc
+++ b/upb_generator/minitable/generator.cc
@@ -297,7 +297,7 @@ void WriteExtension(const DefPoolPair& pools, upb::FieldDefPtr ext,
if (!options.one_output_per_message) {
output("static ");
}
- output("const upb_MiniTableExtension $0_obj = {\n ", ExtensionVarName(ext));
+ output("const UPB_RETAIN upb_MiniTableExtension $0_obj = {\n ", ExtensionVarName(ext));
output("$0,\n", FieldInitializer(pools, ext));
output(" $0,\n", GetSub(ext, true, options));
output(" &$0,\n", MessageVarName(ext.containing_type()));