Commit Graph

49 Commits (main)

Author SHA1 Message Date
Yohei Yukawa 55592a28e7 Fix #10007: Propagate msvc-style link flags to clang-cl with Bazel
The idea here is to set the existing config "config_msvc" not only
when "msvc-cl" is specified but also when "clang-cl" is specified.

Keep in mind that clang-cl support in protobuf remains to be only
best-effort and untested for now.

PiperOrigin-RevId: 631195504
2024-05-06 15:03:58 -07:00
Protobuf Team Bot 21d75f861c Remove references to rules_proto
They are not needed after the rules are move into protobuf repo.
Except for the reference to toolchain type, which is currently in rules_proto and can be moved after the implementation is moved into protobuf repo.

PiperOrigin-RevId: 622176865
2024-04-05 07:50:25 -07:00
Protobuf Team Bot 83ec410d30 Internal change
PiperOrigin-RevId: 619377672
2024-03-27 05:50:55 -07:00
Ming-Chuan eef55641f8 Fix Android platforms constraint (#16246)
When using bazel platforms and new rules_android_ndk, crosstool_top is actually still `//external:android/crosstool`. The right way to detect Android is to use `constraint_value`.

Closes #16246

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/16246 from sifmelcara:fix-platforms dbf3fd58db
PiperOrigin-RevId: 618198820
2024-03-22 09:25:58 -07:00
Ming-Chuan e54174728f Add back android config_setting that looks for //external:android/crosstool (#16127)
In https://github.com/protocolbuffers/protobuf/pull/15298 `"crosstool_top": "//external:android/crosstool"` was replaced with `"crosstool_top": "@platforms//os:android"`. This breaks users who have not migrated to https://bazel.build/concepts/platforms yet.

Closes #16127

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/16127 from sifmelcara:add-back-legacy-crosstool-top c643235a3d
PiperOrigin-RevId: 615449874
2024-03-13 09:54:06 -07:00
aiuto 3ab1276bbb Update Bazel references to rules_pkg to the supported file locations. (#15780)
WIP:  I want to see this pass CI first.

Fixes: #15779

3 scripted transforms:
```
  -load("@rules_pkg//:mappings.bzl", ...)
  +load("@rules_pkg//pkg:mappings.bzl", ...)
```
```
  -load("@rules_pkg//:pkg.bzl", "pkg_tar")
  +load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
```
```
  -load("@rules_pkg//:pkg.bzl", "pkg_zip")
  +load("@rules_pkg//pkg:zip.bzl", "pkg_zip")
```

Closes #15780

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/15780 from aiuto:rules_pkg a630276341
PiperOrigin-RevId: 606641398
2024-02-13 09:08:42 -08:00
Harald Kjær Nielsen 1eff9d7451 Proper fix utf8 command line arguments (#14253)
https://github.com/protocolbuffers/protobuf/pull/14197
Tried to fix utf-8 issue, but it didnt handle multibyte chars.
Only way I found that works constantly is using `CommandLineToArgvW`.
To not ripple out `wchar_t`, I convert to and from where needed

Closes #14253

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/14253 from hknielsen:proper-fix-none-ascii-issue cad753e9e6
PiperOrigin-RevId: 599990369
2024-01-19 18:47:25 -08:00
Protobuf Team Bot c988f9c0c7 cleanup: reduce warnings on MSVC builds
Protobuf sets the `/utf-8` flag in the linker, but this is a compiler flag [^1]. The linker emits a warning, polluting the logs for all downstream projects [^2] with many `LINK : warning LNK4044: unrecognized option '/utf-8'; ignored` lines.

[^1]: https://learn.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170
[^2]: For an example, see [this build](https://github.com/googleapis/google-cloud-cpp/actions/runs/7484447749/job/20371331322#step:5:4146)

PiperOrigin-RevId: 597570083
2024-01-11 09:15:36 -08:00
Gabriel Féron 585c87904a Fix BUILD.bazel for newer rules_android_ndk (#15298)
When using transitions, and `rules_android_ndk` the constraint needs to be changed to `@platforms`.

Closes #15298

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/15298 from gferon:fix-android-constraint d15c794da3
PiperOrigin-RevId: 596140608
2024-01-05 20:08:45 -08:00
Clayton Walker d580fde63a Add Automatic-Module-Name (#14562)
Adds Automatic-Module-Name after it was lost during the maven-bazel migration (and subsequent re-addition of osgi bundle support).

Updates OsgiWrapper to support adding the Automatic-Module-Name header to the list of properties supported by the `osgi_java_library` rule.

Fixes #12639

Closes #14562

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/14562 from Sineaggi:add-automatic-module-name a27b3e6695
PiperOrigin-RevId: 579748655
2023-11-06 00:28:10 -08:00
Harald Kjær Nielsen 8fc0544228 Support non ascii commandline args (#14197)
Using none ASCII chars for protoc on Windows are not handled well.
This adresses argument file at a location where either directory, or filename contains Unicode chars.

Specifically because MsBuild tool saves argument file in with the UserName appended to the .rsp file.
https://github.com/dotnet/msbuild/pull/9232

But in general we should really handle if none ascii chars are in the path.

Closes #14197

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/14197 from hknielsen:support-non-ascii-commandline-args 673d575665
PiperOrigin-RevId: 568722987
2023-09-26 20:12:36 -07:00
Adam Cozzette 501ececd39 Reorganize upb file structure
This change moves almost everything in the `upb/` directory up one level, so
that for example `upb/upb/generated_code_support.h` becomes just
`upb/generated_code_support.h`. The only exceptions I made to this were that I
left `upb/cmake` and `upb/BUILD` where they are, mostly because that avoids
conflict with other files and the current locations seem reasonable for now.

The `python/` directory is a little bit of a challenge because we had to merge
the existing directory there with `upb/python/`. I made `upb/python/BUILD` into
the BUILD file for the merged directory, and it effectively loads the contents
of the other BUILD file via `python/build_targets.bzl`, but I plan to clean
this up soon.

PiperOrigin-RevId: 568651768
2023-09-26 14:38:35 -07:00
Adam Cozzette 8059da24d2 Start adding upb test runs to CI for protobuf repo
This change moves the upb Fastbuild, Optimized, and FastTable test runs over to
the protobuf repo CI in preparation for moving the upb codebase itself. There
are a bunch more test runs to move, but this initial change handles the easy
ones first.

I also updated our pinned upb version to the current head to pick up some
recent fixes.

PiperOrigin-RevId: 557486174
2023-08-16 08:29:10 -07:00
Benjamin Peterson 1bee4578b8 bazel: Get rid of exec_tools. (#13401)
Bazel has removed this attribute in bazelbuild/bazel@c061e57a70.

Closes #13401

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13401 from benjaminp:exec_tools 9e718ff0fd
PiperOrigin-RevId: 552482730
2023-07-31 08:08:39 -07:00
Son Luong Ngoc 5233990ad7 Fix protoc_nowkt linking on MacOS (#12320)
Depending on how the local cc toolchain is setup on macos, the core
foundation framework might not be available while linking protoc_nowkt.

This results in a few _CF symbols being interpreted as dynamic load and
is set to the binary's flat-namespace, causing runtime errors during
susequent actions such as gen_wkt_cc_sources.

```bash
> otool -dyld_info bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/compiler/protoc_nowkt | grep '_CF'
__DATA_CONST __got         0x10035C038 0x8010000000000007 bind   0x0      flat-namespace _CFRelease
__DATA_CONST __got         0x10035C040 0x8010000000000008 bind   0x0      flat-namespace _CFStringGetCString
__DATA_CONST __got         0x10035C048 0x8010000000000009 bind   0x0      flat-namespace _CFStringGetLength
__DATA_CONST __got         0x10035C050 0x801000000000000A bind   0x0      flat-namespace _CFStringGetMaximumSizeForEncoding
__DATA_CONST __got         0x10035C058 0x801000000000000B bind   0x0      flat-namespace _CFTimeZoneCopyDefault
__DATA_CONST __got         0x10035C060 0x801000000000000C bind   0x0      flat-namespace _CFTimeZoneGetName
```

Tell the linker to use CoreFoundation framework explicitly fixes this
issue.

```bash
> otool -dyld_info bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/compiler/protoc_nowkt | grep '_CF'
__DATA_CONST __got         0x10035C038 0x8010000000000007 bind   0x0      CoreFoundation _CFRelease
__DATA_CONST __got         0x10035C040 0x8010000000000008 bind   0x0      CoreFoundation _CFStringGetCString
__DATA_CONST __got         0x10035C048 0x8010000000000009 bind   0x0      CoreFoundation _CFStringGetLength
__DATA_CONST __got         0x10035C050 0x801000000000000A bind   0x0      CoreFoundation _CFStringGetMaximumSizeForEncoding
__DATA_CONST __got         0x10035C058 0x801000000000000B bind   0x0      CoreFoundation _CFTimeZoneCopyDefault
__DATA_CONST __got         0x10035C060 0x801000000000000C bind   0x0      CoreFoundation _CFTimeZoneGetName
```

closes #12173

Closes #12320

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/12320 from sluongng:main 1416168f12
PiperOrigin-RevId: 526830008
2023-04-24 20:18:30 -07:00
Protobuf Team Bot 4b5652b030 Re-attach OSGI headers to lite,core, and util. This information was dropped in the move from maven to bazel.
PiperOrigin-RevId: 518267412
2023-03-21 07:35:58 -07:00
Jakob Buchgraber c0c79b2791 Bump upb version
PiperOrigin-RevId: 517972179
2023-03-20 08:15:28 -07:00
Mike Kruskal 25dfc39b11 Internal changes
PiperOrigin-RevId: 515648197
2023-03-10 13:24:31 -08:00
Sandy Zhang 1efa2e7205 Merge release branch 22.x into main 2023-03-10 19:17:05 +00:00
deannagarcia 15bd2c21cf Merge 22.x back to main (#12169)
Closes #12169

PiperOrigin-RevId: 515161008
2023-03-08 15:38:14 -08:00
Deanna Garcia 5476b46af3 Condition executable name on build system 2023-03-07 19:03:16 +00:00
Mike Kruskal 8a07f45293 Add release tests for statically linked binaries
For now, this only covers linux on the two architectures we have testing support for.  However, it serves as a good sanity check and can be expanded in the future.

PiperOrigin-RevId: 514449399
2023-03-06 18:30:04 +00:00
Mike Kruskal 804ec94a16 Add release tests for statically linked binaries
For now, this only covers linux on the two architectures we have testing support for.  However, it serves as a good sanity check and can be expanded in the future.

PiperOrigin-RevId: 514449399
2023-03-06 10:26:21 -08:00
deannagarcia 3b727f84f2
Fix toolchain resolution for osx x86_64 2023-03-01 15:57:05 -08:00
Mike Kruskal c9092fe0ed Internal change
PiperOrigin-RevId: 513329841
2023-03-01 21:52:19 +00:00
Mike Kruskal 5888882691 Internal change
PiperOrigin-RevId: 513329841
2023-03-01 13:46:08 -08:00
Mike Kruskal 8ad6cdd007 Modify release artifacts for protoc to statically link system libraries.
Closes #12063

PiperOrigin-RevId: 513034570
2023-02-28 23:35:46 +00: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
Deanna Garcia 340d24ce8a Add java opts file 2023-02-24 21:12:24 +00:00
zhangskz 7d1b0348f7
Update protobuf's upb dep to latest upb protobuf dep update commit (#11907) 2023-02-10 13:58:29 -05:00
Mike Kruskal 8dc14f688c Migrate daily staleness tests to GHA
PiperOrigin-RevId: 507022987
2023-02-03 16:37:59 -08:00
Mike Kruskal a9f1ea6371 Breaking change: Migrate to Abseil's logging library.
This deletes our old branches of internal Abseil code in favor of their newly open-sourced library.  Notably, this removes the ability to turn CHECK crashes into exceptions.

PiperOrigin-RevId: 504460562
2023-01-24 21:51:03 -08:00
Mike Kruskal 7930cd1f9d Upgrade to Abseil LTS 20230117 (#11622)
Closes #11622

PiperOrigin-RevId: 503588252
2023-01-20 21:40:27 -08:00
Mike Kruskal 232ecf4a6f Bump protobuf to latest upb version.
PiperOrigin-RevId: 502022138
2023-01-14 00:11:12 -08:00
Mike Kruskal f95aafde6c Migrate docker images to the new Artifact Registry location.
PiperOrigin-RevId: 501691973
2023-01-12 16:09:59 -08:00
Mike Kruskal 9baae6adcb Clean up aarch64 tests.
This bumps us to gcc 6 (rather than 4.8), which fully supports C++14, and migrates the Python tests to our Bazel-based system.  C#, PHP, and Ruby will remain on CMake + alternate build system for now.

PiperOrigin-RevId: 495501807
2022-12-14 21:52:35 -08:00
Mike Kruskal 1a238479d8 Merge tag 'refs/tags/sync-piper' into sync-stage
# Conflicts:
#	build_defs/cpp_opts.bzl
2022-10-19 16:57:04 -07:00
Mike Kruskal 407aa2d931 Sync from Piper @482325250
PROTOBUF_SYNC_PIPER
2022-10-19 16:10:10 -07:00
Kent Ross 7d1362c7ba
Do not force C++14 (#10773)
* Do not force C++14

Rather than forcing protobuf to always compile in exactly C++14, overriding all settings in .bazelrc and environment variables and commandline options, instead guard the codebase against versions that are too low. This allows for compiling in higher C++ standards, such as those that have std::string_view instead of absl::string_view without generating objects that are incompatible.

* Do not guard headers against low C++ versions

The code will break below C++14 anyway

* Attempt a different >=C++14 guard condition

* Steal the >=C++14 guard condition code from absl

* Special case C++14 guard for GCC < 5.0
2022-10-14 16:28:18 -07:00
Mike Kruskal ef0c1c618c
Adding c++14 flag to msvc builds (#10754) 2022-10-10 22:26:31 -07:00
Mike Kruskal b2e1d7d8a1 Fix some superficial issues with GCC 4.9, MSVC, and CMake 2022-10-07 10:29:32 -07:00
Mike Kruskal 32bea52ee6 Sync from Piper @mkruskal/protobuf-absl
PROTOBUF_SYNC_PIPER
2022-10-06 16:48:39 -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 ca4b0630a6 Sync from Piper @467099277
PROTOBUF_SYNC_PIPER
2022-08-11 20:55:01 -07:00
Mike Kruskal ed5c57a574
Remove all autotools usage (#10132)
* Bazelfying conformance tests

Adding infrastructure to "Bazelify" languages other than Java and C++

* Delete benchmarks for languages supported by other repositories

* Bazelfying benchmark tests

* Bazelfying python

Use upb's system python rule instead of branching tensorflow

* Bazelfying Ruby

* Bazelfying C#

* Bazelfying Objective-c

* Bazelfying Kokoro mac builds

* Bazelfying Kokoro linux builds

* Deleting all deprecated files from autotools cleanup

This boils down to Makefile.am and tests.sh and all of their remaining references

* Cleanup after PR reorganizing

- Enable 32 bit tests
- Move conformance tests back
- Use select statements to select alternate runtimes
- Add internal prefixes to proto library macros

* Updating READMEs to use bazel instead of autotools.

* Bazelfying Kokoro release builds

* First round of review fixes

* Second round of review fixes

* Third round of review fixes

* Filtering out conformance tests from Bazel on Windows (b/241484899)

* Add version metadata that was previously scraped from configure.ac

* fixing typo from previous fix

* Adding ruby version tests

* Bumping pinned upb version, and adding tests to python CI
2022-08-10 22:51:29 -07:00
Sandy Zhang 258514019f Merge 21.x into main 2022-05-28 00:06:34 +00:00
Joshua Haberman 2dc7679cc1 Fixed the Windows build of protoc by statically linking deps. 2022-05-23 20:59:31 +00:00
David L. Jones cd5cc37624
Fix some style/lint issues. (#10003)
- Starlark: ensure docstrings are present.
- python/setup.py: https://refex.readthedocs.io/en/latest/guide/fixers/superfluous_parens.html
2022-05-19 14:22:56 -07:00
David L. Jones 52655b1f5e
[Bazel] Move C++ build-related logic into //build_defs (#9921)
These are all "toolchain-y" things, like copts, link_opts, and config_settings. These are very different from what is in //toolchain, though, so I chose the somewhat common name build_defs for the package. For now, I am only using this package for purely internal things. (Most public "defs"-type things should come from rules_proto/rules_cc, anyhow.)
2022-05-06 12:11:46 -07:00