Commit Graph

12 Commits (main)

Author SHA1 Message Date
Mike Kruskal 396e26b475 Enable C++ tests for Bazel 7 on mac
PiperOrigin-RevId: 610573579
2024-02-26 17:13:47 -08:00
Adam Cozzette a7b0421c78 Breaking change: make protobuf comply with the C++ layering check
This check enforces that each C++ build target has the correct dependencies for
all headers that it includes. We have many targets that were not correct with
respect to this check, so I fixed them up.

I also cleaned up the C++ targets related to the well-known types. I created a
cc_proto_library() target for each one and removed the :wkt_cc_protos target,
since this was necessary to satisfy the layering check. I deleted the
//src/google/protobuf:protobuf_nowkt target and deprecated :protobuf_nowkt,
because the distinction between the :protobuf and :protobuf_nowkt targets was
not really correct. Neither one exposed the headers for the well-known types in
a way that was valid with respect to the layering check, and the idea of
bundling all the well-known types together is not idiomatic in Bazel anyway.
This is a breaking change, because the //:protobuf target no longer bundles the
well-known types. From now on they should be accessed through the new
//:*_cc_proto aliases in our top-level package.

I renamed the :port_def target to :port, which simplifies things a bit by
matching our internal name.

The original motivation for this change was that to move utf8_range onto our CI
infrastructure, we needed to make its dependency rules_fuzzing compatible with
Bazel 6. The rules_fuzzing project builds with the layering check, and I found
that the process of upgrading it to Bazel 6 made it take a dependency on
protobuf, which caused it to break due to layering violations. I was able to
work around this, but it would still be nice to comply with the layering check
so that we don't have to worry about this kind of thing in the future.

PiperOrigin-RevId: 595516736
2024-01-03 15:20:05 -08:00
Mike Kruskal ab2451f6c2 Don't rely on .bazelrc for signaling sanitizer builds
PiperOrigin-RevId: 582436549
2023-11-14 14:15:01 -08:00
Protobuf Team Bot 312986896d Disable Bzlmod explicitly in .bazelrc
This will help make sure [Bazel Downstream Pipeline](https://github.com/bazelbuild/continuous-integration/blob/master/docs/downstream-testing.md) is green after enabling Bzlmod at Bazel@HEAD

See https://github.com/bazelbuild/bazel/issues/18958#issuecomment-1749058780

Related https://github.com/protocolbuffers/protobuf/issues/14313

Closes: https://github.com/protocolbuffers/protobuf/pull/14314
PiperOrigin-RevId: 572920528
2023-10-12 08:58:17 -07:00
Adam Cozzette d99134f6f8 Update .bazelrc to use C++ 17
This is in preparation for moving upb into the protobuf repo. Upb requires C++
17. Protobuf supports C++ 14, and our non-upb CI tests will keep using C++ 14
to ensure that it still works. Our Bazel CI runs use the bazelrc files in the
ci/ directory, so these runs should be unaffected by this change.

PiperOrigin-RevId: 555223181
2023-08-09 11:28:03 -07:00
Mike Kruskal 723bd4c3c1 Modify release artifacts for protoc to statically link system libraries.
Closes #12063

PiperOrigin-RevId: 513034570
2023-02-28 14:13:48 -08:00
Mike Kruskal d938afd6e3
Add sanitized builds to Kokoro (#10706)
* Adding build configs for sanitization

* Update bazel runner to accept configs to loop over

* Fix Bazel query from to googletest upgrade

* Fix pre-existing ODR violation

* Clean up bazel configs

* Fix UBSAN issues in tests

* Upgrade zlib to pull in UBSAN fix

* Fix conformance test UB

* Add *san builds to Bazel tests

* Add dbg to *san builds

* Extend timeout for Bazel build

* Enable ODR checks again by using static linkage in ASAN

* Cleanup kokoro setup

* Disable MSAN for now

* Enable MSAN in kokoro build

* Fix msan failure

* Remove broken bazel clean

* Cleanup

* Fix false leaks

* Fix cap-add argument

* Fix asan config name

* Remove LSAN verbosity

* Expand size of big test, add verbose failures

* Skip slow test in TSAN

* Workaround for bazel issue with ubsan
2022-10-06 10:50:18 -07:00
Mike Kruskal d220b43c6c
Enable warnings as errors during tests (#10482)
* Enable warnings as errors by default for test builds

* Fixing C++ warnings

* Adding host flags, and enabling warnings as error for non-C++ too

* Switch to BUILD copts instead of bazelrc to treat Windows as a snowflake

* Disable warnings as errors on Windows, since it doesn't like the c++14 flag
2022-08-29 18:19:38 -04:00
Mike Kruskal a3c8e2deb0
Integrate from Piper for C++, Java, and Python (#10455)
* Sync from Piper @469587494

PROTOBUF_SYNC_PIPER

* Fixing github SOT protoc builds

* Fixing typos from google

* Remove leaked util/hash reference

* Fixing bad python merge

* Fixing python C++ library order
2022-08-24 10:46:33 -07:00
Adam Cozzette 500cbd7b90
Upgrade third_party/googletest submodule to current main branch (#10393)
* Upgrade third_party/googletest submodule to current main branch

We can finally do this upgrade now that we have dropped our autotools
build. Googletest recommends living at head, so let's go straight to the
most recent commit on main. For some reason the googletest archive is
not present in the Bazel build mirror, so I removed that entry and just
left the GitHub download link in our WORKSPACE file.

Googletest now requires C++14, so I updated all the C++11 flags I could
find to C++14 instead. I added a .bazelrc file to add -std=c++14 for all
our Bazel builds.

* Delete the empty //src/google/protobuf:protobuf_test target

* Avoid building C++ unit tests in aarch64 jobs for Python and Ruby
2022-08-11 18:22:15 -07:00
Adam Cozzette 98b6ead775
Remove .bazelrc file containing the -std=c++11 flag (#8874)
MSVC warns about that flag since it's not in the format it expects, and
the flag seems to be unnecessary anyway.
2021-08-13 13:32:59 -07:00
Adam Cozzette 0554bb24c0 Add a top-level .bazelrc to make sure we use C++11 2021-08-06 11:09:53 -07:00