PROTOBUF_SYNC_PIPER
pull/9090/head
Adam Cozzette 3 years ago
parent 3afc828309
commit 1f66b1b032
  1. 1
      docs/third_party.md
  2. 2
      editors/protobuf-mode.el
  3. 2
      java/lite.md
  4. 1
      java/util/pom.xml
  5. 2
      src/README.md
  6. 12
      src/google/protobuf/arenastring.cc
  7. 2
      src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
  8. 2
      tests.sh
  9. 148
      toolchain/cc_toolchain_config.bzl
  10. 8
      toolchain/toolchains.bazelrc

@ -129,6 +129,7 @@ GRPC (http://www.grpc.io/) is Google's RPC implementation for Protocol Buffers.
* https://github.com/Yeolar/raster (C++) * https://github.com/Yeolar/raster (C++)
* https://github.com/jnordberg/wsrpc (JavaScript Node.js/Browser) * https://github.com/jnordberg/wsrpc (JavaScript Node.js/Browser)
* https://github.com/ppissias/xsrpcj (Java) * https://github.com/ppissias/xsrpcj (Java)
* https://github.com/twitchtv/twirp (Multiple languages)
Inactive: Inactive:

@ -68,7 +68,7 @@
(eval-when-compile (eval-when-compile
(and (= emacs-major-version 24) (and (= emacs-major-version 24)
(>= emacs-minor-version 4) (>= emacs-minor-version 4)
(require 'cl)) (require 'cl-lib))
(require 'cc-langs) (require 'cc-langs)
(require 'cc-fonts)) (require 'cc-fonts))

@ -30,7 +30,7 @@ protobuf Java runtime. If you are using Maven, use the following:
<dependency> <dependency>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-javalite</artifactId> <artifactId>protobuf-javalite</artifactId>
<version>3.9.1</version> <version>3.18.1</version>
</dependency> </dependency>
``` ```

@ -49,6 +49,7 @@
<dependency> <dependency>
<groupId>org.easymock</groupId> <groupId>org.easymock</groupId>
<artifactId>easymock</artifactId> <artifactId>easymock</artifactId>
<scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.truth</groupId> <groupId>com.google.truth</groupId>

@ -19,7 +19,7 @@ To build protobuf from source, the following tools are needed:
On Ubuntu/Debian, you can install them with: On Ubuntu/Debian, you can install them with:
$ sudo apt-get install autoconf automake libtool curl make g++ unzip sudo apt-get install autoconf automake libtool curl make g++ unzip
On other platforms, please use the corresponding package managing tool to On other platforms, please use the corresponding package managing tool to
install them before proceeding. install them before proceeding.

@ -256,6 +256,12 @@ void ArenaStringPtr::ClearToDefault(const LazyString& default_value,
} }
} }
inline void SetStrWithHeapBuffer(std::string* str, ArenaStringPtr* s) {
TaggedPtr<std::string> res;
res.Set(str);
s->UnsafeSetTaggedPointer(res);
}
const char* EpsCopyInputStream::ReadArenaString(const char* ptr, const char* EpsCopyInputStream::ReadArenaString(const char* ptr,
ArenaStringPtr* s, ArenaStringPtr* s,
Arena* arena) { Arena* arena) {
@ -264,13 +270,11 @@ const char* EpsCopyInputStream::ReadArenaString(const char* ptr,
int size = ReadSize(&ptr); int size = ReadSize(&ptr);
if (!ptr) return nullptr; if (!ptr) return nullptr;
auto str = Arena::Create<std::string>(arena); auto* str = Arena::Create<std::string>(arena);
ptr = ReadString(ptr, size, str); ptr = ReadString(ptr, size, str);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
TaggedPtr<std::string> res; SetStrWithHeapBuffer(str, s);
res.Set(str);
s->UnsafeSetTaggedPointer(res);
return ptr; return ptr;
} }

@ -643,6 +643,8 @@ void ParseFunctionGenerator::GenerateArenaString(Formatter& format,
", ~0x$2$u", ", ~0x$2$u",
inlined_string_index / 32, inlined_string_index / 32,
strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8)); strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8));
} else {
GOOGLE_DCHECK(field->default_value_string().empty());
} }
format( format(
");\n" ");\n"

@ -222,7 +222,7 @@ internal_build_java() {
cp -r java $dir cp -r java $dir
cd $dir && $MVN clean cd $dir && $MVN clean
# Skip tests here - callers will decide what tests they want to run # Skip tests here - callers will decide what tests they want to run
$MVN install -pl util -Dmaven.test.skip=true $MVN install -pl core -Dmaven.test.skip=true
} }
build_java() { build_java() {

@ -0,0 +1,148 @@
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"feature",
"flag_group",
"flag_set",
"tool",
"tool_path",
)
all_link_actions = [
ACTION_NAMES.cpp_link_executable,
ACTION_NAMES.cpp_link_dynamic_library,
ACTION_NAMES.cpp_link_nodeps_dynamic_library,
]
all_compile_actions = [
ACTION_NAMES.assemble,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.clif_match,
ACTION_NAMES.lto_backend,
]
def _impl(ctx):
tool_paths = [
tool_path(
name = "gcc",
path = "/usr/local/bin/clang",
),
tool_path(
name = "ld",
path = "/usr/bin/ld",
),
tool_path(
name = "ar",
path = "/usr/bin/ar",
),
tool_path(
name = "compat-ld",
path = "/usr/bin/ld",
),
tool_path(
name = "cpp",
path = "/bin/false",
),
tool_path(
name = "dwp",
path = "/bin/false",
),
tool_path(
name = "gcov",
path = "/bin/false",
),
tool_path(
name = "nm",
path = "/bin/false",
),
tool_path(
name = "objcopy",
path = "/bin/false",
),
tool_path(
name = "objdump",
path = "/bin/false",
),
tool_path(
name = "strip",
path = "/bin/false",
),
]
linker_flags = feature(
name = "default_linker_flags",
enabled = True,
flag_sets = [
flag_set(
actions = all_link_actions,
flag_groups = [
flag_group(
flags = [
"-lstdc++",
"--target=" + ctx.attr.target_full_name,
],
),
],
),
],
)
compiler_flags = feature(
name = "default_compile_flags",
enabled = True,
flag_sets = [
flag_set(
actions = all_compile_actions,
flag_groups = [
flag_group(
flags = [
ctx.attr.bit_flag,
"-Wall",
"-no-canonical-prefixes",
"--target=" + ctx.attr.target_full_name,
"-isystem",
ctx.attr.toolchain_dir,
ctx.attr.include_flag,
],
),
],
),
],
)
return cc_common.create_cc_toolchain_config_info(
abi_libc_version = ctx.attr.target_cpu,
abi_version = ctx.attr.target_cpu,
ctx = ctx,
compiler = "clang",
cxx_builtin_include_directories = [
ctx.attr.toolchain_dir,
"/usr/include",
"/usr/local/lib/clang",
],
features = [linker_flags, compiler_flags],
host_system_name = "local",
target_cpu = ctx.attr.target_cpu,
target_libc = ctx.attr.target_cpu,
target_system_name = ctx.attr.target_full_name,
toolchain_identifier = ctx.attr.toolchain_name,
tool_paths = tool_paths,
)
cc_toolchain_config = rule(
implementation = _impl,
attrs = {
"bit_flag": attr.string(mandatory = True, values = ["-m32", "-m64"]),
"include_flag": attr.string(mandatory = False),
"target_cpu": attr.string(mandatory = True, values = ["aarch64", "ppc64", "systemz", "x86_32", "x86_64"]),
"target_full_name": attr.string(mandatory = True),
"toolchain_dir": attr.string(mandatory = True),
"toolchain_name": attr.string(mandatory = True),
},
provides = [CcToolchainConfigInfo],
)

@ -0,0 +1,8 @@
build:cross_config --crosstool_top=//toolchain:clang_suite
build:cross_config --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
build:linux-aarch_64 --config=cross_config --cpu=linux-aarch_64
build:linux-ppcle_64 --config=cross_config --cpu=linux-ppcle_64
build:linux-s390_64 --config=cross_config --cpu=linux-s390_64
build:linux-x86_32 --config=cross_config --cpu=linux-x86_32
build:linux-x86_64 --config=cross_config --cpu=linux-x86_64
Loading…
Cancel
Save