Commit Graph

92 Commits (main)

Author SHA1 Message Date
Brent Shaffer 01744cccae chore(php): conformance testing for edition (#16712)
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/16712 from bshaffer:php-editions a1c41add7d
PiperOrigin-RevId: 631824623
2024-05-08 09:23:08 -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
Tiago Quelhas 9ca36df54f Automated Code Change
PiperOrigin-RevId: 616246031
2024-03-15 14:41:10 -07:00
Mike Kruskal baa83b6b43 Enable Editions in preparation for 27.0 release.
This marks the official launch of editions, which no longer requires an --experimental_editions flag to use with supported generators.  The flag can still be used for generators that don't yet explicitly support editions.

PiperOrigin-RevId: 614729247
2024-03-11 11:14:47 -07:00
Thomas Van Lenten 6c7c5a5d2a [ObjC] Enable editions conformance tests.
PiperOrigin-RevId: 590328722
2023-12-12 14:15:09 -08:00
Mike Kruskal 571b727cb6 Make rules_ruby a dev-only dependency.
There is no canonical rules_ruby repo today, and we don't want our fork to become one.  In order to unblock inclusion of Protobuf in the bzlmod registry, we're making this a dev dependency and dropping support for Bazel/Ruby.

Fixes #14569

PiperOrigin-RevId: 584393841
2023-11-21 12:10:30 -08:00
Tiago Quelhas 80c3f95e37 Add missing mnemonic on a couple of proto compilation actions.
PiperOrigin-RevId: 502633022
2023-01-17 11:00:10 -08:00
Mike Kruskal 633e8f75d0 Bazelify ruby runtime (#10525)
This uses https://github.com/protocolbuffers/rules_ruby to fully Bazelify our ruby runtime code.  The Rakefile is left in place for now and is still used by our aarch64 tests.  With the current implementation ruby behaves similarly to our python wrapper, which selects whatever version is installed in the system.  Future enhancements will allow for more hermetic builds via Bazel flags to pin a specific version

Closes #10525

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/10525 from mkruskal-google:rules_ruby 97fa1f70ab
PiperOrigin-RevId: 499283908
2023-01-03 12:12:47 -08:00
Protobuf Team Bot 64ae02c7fe Make labels relative
Prepare protobuf for bzlmod

Self-reference to `@com_google_protobuf` doesn't work with bzlmod.

In case this is a rule attribute, no reference is needed.

When the label is a default parameter value in a macro it needs to be wrapped with `Label` call, to relativise it correctly.

PiperOrigin-RevId: 496687786
2022-12-20 10:03:54 -08:00
Mike Kruskal 23f1481386 Sync from Piper @480194141
PROTOBUF_SYNC_PIPER
2022-10-10 21:05:53 -07:00
Mike Kruskal 1595417dd3 Sync from Piper @473279986
PROTOBUF_SYNC_PIPER
2022-09-09 10:42:19 -07:00
Mike Kruskal 701dd83594
Integrate from Piper for C++, Java, and Python (#10429)
* Fixing typos

* Revert new files that were deleted by sync script

* Fix CMake breakages

* bump upb version

* Sync from Piper @468772608

PROTOBUF_SYNC_PIPER

* Adding abseil to include path for python C++ extension

* Adding abseil linkage for python C++ extension

* Fixing linkage order
2022-08-20 14:22:08 -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
David L. Jones 07303d6f54
[Bazel/C++] Factor out util library (#9987)
This change creates new Bazel packages for the C++ util libraries (similar to #9980 and #9985).
2022-05-17 18:13:22 -07:00
David L. Jones b3cbea18ea
[Bazel] Move Python rules to //python (#9952) 2022-05-12 19:48:58 -07:00
David L. Jones d60c0d2d35
Expose generated files from proto_gen via DefaultInfo, and change to new provider syntax. (#9951)
* Switch to new provider syntax instead of structs.
* Expose files via `DefaultInfo`, and use that for `py_proto_library`.
* Several changes from buildifier.
2022-05-11 19:13:56 -07:00
FaBrand 244bbd6f95
Make genrule portable for windows (#9889)
* Make genrule portable for windows

Using this does remove a user dependency on a bash under windows

* Use portable genrule for zlib dependency
2022-04-29 10:24:10 -07:00
Derek Perez b55c8e4084
include gen_dir irrespsective of sources_dir in protoc_gen (#9735) 2022-04-06 11:35:10 -07:00
Adam Cozzette faa42e900c
Revert "Use repo-relative labels wherever possible (#9187)" (#9696)
This reverts commit 11de748d66.
2022-03-29 15:50:39 -04:00
Deanna Garcia 67b74dd169 Use internal kotlin gen rule 2022-02-15 22:45:56 +00:00
Ivo List 15add1af49
Selectively add source or gen dir to includes. (#9438)
When both directories are added this results in protoc emitting a
"warning: directory does not exist.". This makes sense because when
there are no inputs from the other directory, it is also not present
n the sandbox where protoc is executed.
2022-01-28 16:44:42 -08:00
Xùdōng Yáng 11de748d66
Use repo-relative labels wherever possible (#9187)
* Use repo-relative labels wherever possible

The label `@com_google_protobuf//:foo` within the protobuf repo is often synonymous with just `//:foo`. We should prefer the latter as it allows us to use a shorter name for the module in the Bazel Central Registry (so just "protobuf" instead of "com_google_protobuf").

Note that the semantics can be subtle: in a macro, plain strings are anchored to the *calling* repo, so if we just use `//:foo` as the default value of a macro argument, it will be resolved to `@myrepo//:foo` if the macro is called from the repo `@myrepo`. In this case, it's necessary to directly call the `Label()` constructor to anchor the string label to the repo where the .bzl file lives.

See https://github.com/bazelbuild/bazel-central-registry/pull/28#issuecomment-954741081 for a bit more context.

* fix protobuf_deps.bzl
2021-11-04 07:56:32 -07:00
Charles Mita f1fe79dd12
Use cfg="exec" instead of cfg="host" in internal rules. (#8626)
Bazel has switched its protobuf rules to make them use the proto
compiler in the exec configuration instead of the host configuration.

However, if rules in protobuf still use the host configuration then
multiple copies of the compiler can end up being built.

cfg="host" is deprecated in any case and being replaced with cfg="exec"
where possible.
https://docs.bazel.build/versions/master/skylark/rules.html#configurations
2021-05-19 11:11:13 -07:00
Derek Perez bc45f92262
Bazel powered Java testing (#8506)
* Protobuf Java/Core Tests running w/ Bazel.

Also integrates rules_jvm_external and migrates existing maven deps
in place.

* Add test_suite target that maps to rule name.

* Lite tests passing in Bazel

* util tests passing with Bazel.

* Add conformance and build testing to //java:core

* Cleanup bzl style and lock down access to failure lists.

* Adding Java Lite conformance tests.

* rm newline

* parameterize conformance_test

This makes usage of failure lists more explicit.

* restrict visibility more for newly added libs and fix formatting.

* fix formatting and visibility.

* move testing.bzl to an internal package.

* fix file formatting.

* moving conformance_test to internal.bzl
2021-04-20 11:36:32 -07:00
Adam Yi 88f3ef7d1d [bazel] Add default shell env to gen_well_known_protos_java
We may need the shell environment (potentially augmented with
`--action_env`) to invoke protoc on Windows. If protoc was built with
mingw, it probably needs .dll files in non-default locations that must be
in PATH. Previously with `--compiler=mingw-gcc`,
`bazel build //:gen_well_known_protos_java` would fail on Windows. This
CL fixes the issue.

Also we have `default_shell_env` set to True for `ProtoCompile`, this makes
the behavior consistent.

See #2933, and
585a27ad0a/proto/compiler.bzl (L130)
2020-08-19 17:01:40 -07:00
Harvey Tuch e492e5a4ef Fix depset/list confusion in #7458.
See
https://github.com/protocolbuffers/protobuf/pull/7458#issuecomment-633147682.

release notes: no

Signed-off-by: Harvey Tuch <htuch@google.com>
2020-05-29 13:05:58 -07:00
Harvey Tuch 9482bfd22b Fix depset/list confusion for ctx.attr.deps.
Signed-off-by: Harvey Tuch <htuch@google.com>
2020-05-14 07:45:57 -07:00
Harvey Tuch 7cf3f7a649 Fix CLI "too long" issues in py_proto_library.
Envoy was experiencing failed builds due to lots of duplicate -I in the
CLI. The solution is to generally use depset() as per Starlark best
practice for this sort of thing.

Might fix other issues beyond py_proto_library, anything that depends on
proto_gen.

release notes: no

Signed-off-by: Harvey Tuch <htuch@google.com>
2020-05-14 07:45:57 -07:00
Leo 12236c6977 Fix typo on py_proto_library 2020-05-08 09:34:26 -07:00
Yannic Bonenberger 723a85f797 [bazel] Remove bootstrap hack from cc_proto_library and add interop with proto_library
Bazel had a native `cc_proto_library` for more than 2 years now.
This is the first step towards removing that rule from the Protobuf
repo.
2020-03-04 09:25:41 -08:00
Yannic f0cb9cdb95
[bazel] Move Java runtime/toolchains into //java (#7190)
* [bazel] Move Java runtime/toolchains into //java

This change moves `java_library` targets from the top-level BUILD file
into `//java/{core,lite,util}` and declares `alias` targets to point to
their new locations (hence, this is not a breaking change).

This will allow users that don't use Java to stop depending on
`@rules_java` (e.g. as requested in
https://github.com/bazelbuild/rules_scala/pull/989#issuecomment-583405161).

Note that there is no intention to deprecate + remove the top-level
targets in the foreseeable future.

* Add BUILD files in //java to java_EXTRA_DIST
2020-02-13 13:04:14 -08:00
Brian Wignall a104dffcb6 Fix typos (#7050)
Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos, with https://github.com/bwignall/typochecker to help automate the checking.
2020-01-08 10:18:20 -08:00
Yannic Bonenberger d2d6ff51a8 [bazel] Load python rules from @rules_python 2019-08-06 16:50:32 -07:00
Yannic Bonenberger bf0c69e130 [bazel] Add fixes for --incompatible_load_{cc,java,proto}_rules_from_bzl (Part 2)
This change adds the required loads to examples and zlib.
For full compatibility with --incompatible_load_{cc,java,proto}_rules_from_bzl,
we will need to roll gtest to a newer version.
2019-07-29 14:14:04 -07:00
Benjamin Peterson 6153f80876 Treat plugins as host tools.
As a followup to ca3ead7745, treat plugin executables as well as protoc as host tools.
2019-06-06 12:48:55 -07:00
Keith Smiley ca3ead7745 Move tool out of inputs in bazel config
This fixes compatibility with bazel when passing `--incompatible_no_support_tools_in_action_inputs` which will be flipped in an upcoming release.
2019-05-28 10:46:14 -07:00
Paul Yang cecba296b8
Down-integrate internal changes (#5467)
* Down-integrate internal changes

* Update generated code for php, objc and csharp.

* Add missing dependency in conformance_php
2018-12-14 16:05:03 -08:00
Jon Brandvein 7b28271a61 Migrate to new `ctx.actions` API (#5367)
* Migrate to new `ctx.actions` API

This allows building with --incompatible_new_actions_api.

* Fix typo
2018-11-15 18:19:06 -08:00
Roger Chen 7492b56812 Import versions from @bazel_skylib//lib:versions.bzl
@bazel_skylib//:lib is supposedly deprecated. The 'versions' struct in lib.bzl was committed to bazel-skylib at the same time as //lib:versions.bzl, so there should be no backward incompatibility.
2018-11-02 23:13:17 -07:00
James Judd d5f0dac497 Change deprecated Bazel single file attr param
This removes the need for --incompatible_disable_deprecated_attr_params
when using Protobuf
2018-08-14 21:55:35 -06:00
Adam Cozzette 2c30fa71e7
Merge pull request #3981 from fahhem/patch-3
Handle srcs in generated files by cd'ing in and out
2018-07-02 15:08:12 -07:00
Feng Xiao 91707246eb
Merge pull request #4168 from jin/master
Use versions module from Skylib for version checking
2018-06-22 17:47:17 -07:00
Ittai Zeidman 4fcb36c51c remove PACKAGE_NAME and REPOSITORY_NAME deprecated usage (#4650) 2018-05-21 13:48:10 -07:00
Fahrzin Hemmati 2cfa7612b2 Fix moving generated files onto themselves 2018-05-07 15:40:31 -07:00
Fahrzin Hemmati d1403e58d8 Only use realpath when in gendir, and use the original ctx.action if not in gendir 2018-05-07 15:40:31 -07:00
Fahrzin Hemmati ae638966e5 Track outputs correctly 2018-05-07 15:40:31 -07:00
Fahrzin Hemmati b3c2ec7073 Handle multiple outs per input (for plugins) 2018-05-07 15:40:31 -07:00
Fahrzin Hemmati a6501e4a2b Strip trailing / from path 2018-05-07 15:40:31 -07:00
Fahrzin Hemmati 800f8d66bf Handle srcs in generated files by cd'ing in and out 2018-05-07 15:40:31 -07:00
Mateusz Matejczyk 294b5758c3
Output *_pb2_grpc.py when use_grpc_plugin=True
Start outputting missing *_pb2_grpc.py files when  use_grpc_plugin is set to True for py_proto_library.
2018-03-11 17:48:10 -04:00