Commit Graph

101 Commits (main)

Author SHA1 Message Date
Alex Eagle 71e4061ace feat: test bzlmod usage on CI (#16319)
Closes #16319

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/16319 from protocolbuffers:bcr d66845cfcb
PiperOrigin-RevId: 619939078
2024-03-28 08:33:48 -07:00
KJ Tsanaktsidis 2082ee8bb5 Implement service & method descriptor lookup in Ruby (#15817)
This PR implements lookup of service descriptor and method descriptor objects in Ruby as described in issue https://github.com/protocolbuffers/protobuf/issues/14891.

It contains three implementations - one for the CRuby extension API, one for JRuby, and one for FFI.

With this patch,

* `DescriptorPool#lookup('fully.qualified.service.name')` works and returns a `Google::Protobuf::ServiceDescriptor` object
* You can call `#options` on that to get the service options
* You can call `#methods` on that to get the services' methods as `Google::Protobuf::MethodDescriptor` objects,
* You can call `MethodDescriptor#options` to get method options
* You can also get the streaming flags & input/output types of the method with `#input_type`, `#output_type`, `#client_streaming`, and `#server_streaming`.

In order to make the FFI implementation work, I had to mark some more methods in the UPB header as exported - I guess that's something which will have to be done on the UPB side, like this 01fed1cc1b

CC @dazuma & @haberman from the original issue, and @JasonLunn (since you work on protobuf it seems - small world!)

I apologies for the large volume of copy-pasta'd code from the existing descriptor class implementations into the new ones - I felt this was probably better than designing new abstractions to reduce it off the bat though; this feels like it "fits in" with the existing implementation.

Closes #15817

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/15817 from KJTsanaktsidis:ktsanaktsidis/add_service_method_descriptors 54d7218431
PiperOrigin-RevId: 618221016
2024-03-22 10:35:56 -07:00
Matt Fowles Kulukundis a01d047456 Refactor the object cache to better account for race conditions (#13204)
Supersedes  #13075

Closes #13204

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13204 from fowles:main 9b6aad673d
PiperOrigin-RevId: 546579459
2023-07-08 16:18:44 -07:00
Mike Kruskal 2b4e4260f0 Migrate to composite GHA actions (#11718)
This migrates from reusable workflows to composite GHA actions.  This has the following advantages:
1) We can split them into smaller, easier to reason about chunks
2) We can reuse them more freely between each other and workflows
3) They don't complicate the job names
4) In theory they'll be easier to test in isolation.  While composite actions can't be unit-tested, we can easily break them up into nodejs or docker actions that can be.

As a proof of concept, some of our non-Bazel tests are migrated to GHA as well (CMake + Composer)

Closes #11718

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/11718 from protocolbuffers:gha-actions 5403307bc00616e94816aa460813939d8f37a1bd
PiperOrigin-RevId: 506375417
2023-02-01 11:34:03 -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
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
Mike Kruskal 78efa76172
Add CMake Ninja test (#10314)
* Initial implementation of cmake tests for linux

* Reverting accidental distcheck changes

* Updating gitignore file to include cmake generated files

* Updating existing cmake tests to use newer docker image

* Adding CMake build that uses Ninja as the generator

* Updating CMake documentation to cover Linux support

* Updating to latest cmake image
2022-07-26 13:53:51 -07:00
Elliotte Rusty Harold 0a16bdfbe6
Ignore configure~ (#10117)
fixes #9974
@acozzette
2022-06-08 14:59:30 -04:00
Adam Cozzette 860f8ad171
Remove the JavaScript implementation (#9874)
This implementation is about to be split out into a separate Git repo.
2022-04-28 12:08:26 -07:00
Jon Skeet d7ef9cd2ba Make it easier to follow cmake/README.md instructions
When following the instructions directly (for developing on Windows) we should end up with a generator that's easy to run for csharp/generate_protos.sh, and we shouldn't end up trying to stage the build output.
2022-03-30 16:33:00 +01:00
David L. Jones 75418a54ae Update ignored file paths after renaming. 2022-03-23 18:11:56 -07:00
Adam Cozzette 76398dab31 Sync from Piper @431959314
PROTOBUF_SYNC_PIPER
2022-03-02 17:37:55 +00:00
David L. Jones 1ba1d73e0d Sync from Piper @429333699
PROTOBUF_SYNC_PIPER
2022-02-17 09:53:51 -08:00
Josh Haberman 624d29d833 Sync from Piper @399250367
PROTOBUF_SYNC_PIPER
2021-09-27 19:18:41 +00:00
Elliotte Rusty Harold 7924f6d7ff
same directory ignore
fixes #8745  @acozzette
2021-08-26 17:28:49 +00:00
Adam Cozzette 562fc946c7 Sync from Piper @388508285
PROTOBUF_SYNC_PIPER
2021-08-03 11:58:05 -07:00
Joshua Haberman b4b5c89c31 Merge branch 'master' into rubybuilder 2021-07-30 15:04:53 -07:00
Deanna Garcia 380e352b0b Sync from Piper @373820256
PROTOBUF_SYNC_PIPER
2021-05-14 17:50:31 +00:00
Adam Cozzette a4866d34f9 Updated .gitignore to include Kotlin directories 2021-05-12 09:58:30 -07:00
Derek Perez 4008d229aa Sync from Piper @366297034
PROTOBUF_SYNC_PIPER
2021-04-01 18:49:52 +00:00
aaron ai 62c402ae37
Add 'java/lite/target' to .gitignore (#8439) 2021-03-31 11:03:01 -07:00
Deanna Garcia a00125024e Sync from Piper @353127564
PROTOBUF_SYNC_PIPER
2021-01-22 00:24:30 +00:00
Rob Widmer 48234f5f01 Make the new multi-level ruby tests fit the existing structure better and add them to the makefile 2021-01-14 12:26:04 -08:00
Paul Yang 823f351448
Port for php8 (#8105)
* Port for php8

* Port php c extension for php8

* Update composer.json

* Drop php7.0 support

* Update phpunit for php7.1 in c extension test

* Add back support for php7.0

* Add badge for php8 continuous build
2020-12-04 13:46:34 -08:00
Joshua Haberman 95e6c5b474 Sync from Piper @327110949
PROTOBUF_SYNC_PIPER
2020-08-17 15:26:13 -07:00
Adam Cozzette 58f4260e8e Merged 3.13.x into master 2020-08-17 11:06:11 -07:00
Paul Yang d4ca92962c
Port php c extension to php8 (#7793)
* Only ported c extension to php8.
* Didn't fixed the issue of throwing warnings for missing arginfo in bundled files.
* Tests not fixed, because syntax of phpunit (<7 vs >9.3) are not compatible.
* In next release, needs to drop php5 and php7.0 support (in order to use phpunit > 7)
2020-08-11 19:30:46 -07:00
Peter Newman e2cc2de304
Fix lots of spelling errors (#7751)
* Fix a typo

* Fix lots of spelling errors

* Fix a few more spelling mistakes

* s/parsable/parseable/

* Don't touch the third party files

* Cloneable is the preferred C# term

* Copyable is the preferred C++ term

* Revert "s/parsable/parseable/"

This reverts commit 534ecf7675.

* Revert unparseable->unparsable corrections
2020-08-10 11:08:25 -07:00
Paul Yang 0929596575 Check realoneof in json parsing (#7763)
* Check realoneof in json parsing

* Fix whichoneof to also work for synthetic oneof
2020-08-07 14:44:49 -07:00
James Newton-King d4abad8731
Optimize reading strings across segments 2020-07-01 20:32:29 +12:00
Joshua Haberman 2adea4c64a Some preliminary work towards a ruby builder. 2020-04-19 11:40:59 -07:00
Tim Swast 29c83baecc
python: add sphinx docs (#6525)
* python: generate documentation with Sphinx and Read the Docs

Background:

Formerly, the Python protobuf reference documentation was built with
[Epydoc](http://epydoc.sourceforge.net/). This package has not been
updated since 2008, and it has inconsistent formatting (see internal
issue 131415575) with most Python documentation. Sphinx is used for the
official docs.python.org docs as well as most other Python packages,
including the Google client libraries and related packages, such as
https://googleapis.dev/python/google-api-core/latest/

To build the docs with Sphinx:

1. Install the needed packages (`sphinx`, `sphinxcontrib-napoleon` for
Google-style docstring support). I've created a conda environment file
to make this easier:

```
conda env create -f python/docs/environment.yml
```

2. (Optional) Generate reference docs files and regenerate index:

```
cd python
python generate_docs.py
cd ..
```

3. Run Sphinx.

```
cd python/docs
make html
```

About this change:

The script at `python/generate_docs.py` creates a ReStructured Text file
for each public module in the protobuf Python package. The script also
updates the table of contents in `python/docs/index.rst` to point to
these module references.

Future work:

Testing the docs build on PRs requires contributors to actually do some
setup work to configure builds on their fork. It'd be better if CI had a
docs build session to verify that the Sphinx docs generation at least
runs.

There are many warnings due to not-quite-correct docstrings in the
actual Python code itself. I'm choosing to ignore these errors to keep
the PR small, but I recommend you fix these and then enable "fail on
warnings" in the docs build on CI.

* add docs to EXTRA_DIST

* add instructions to build documentation to generate_docs.py

* exclude python/odcs from cpp_distcheck
2020-02-11 11:40:17 -08:00
Paul Yang fe1790ca0d
Fix Multiple Request for PHP (#7008)
* Add scripts to test multirequest

* chmod ug+x multirequest.sh

* Add continuous test

* Compile c extension

* Class entry is obsolete in the second request
1) Needes to use class name in persistent map
2) Invalidate class entry stored in descriptor

* Add new files to dist

* Fix compile_extension

* Cleanup outputs for phpize
2019-12-12 13:59:51 -08:00
Paul Yang c53e5b8e11
Avoid too much overhead in layout_init (#6716)
* Avoid initializing primitive fields in layout_init

* Avoid initializing string/bytes/message fields in layout_init

* Lazily create map when needed

* Lazily create repeated fields

* Change layout_init to only do memcpy

* Fix test for php-7.0

* Fix conformance test where default value of string/message map is not encoded

* Fix test for zts

* Clean up

* Fix comments
2019-10-29 12:48:24 -07:00
Paul Yang ce942bcae1
Add binary conformance tests for map fields (#6560)
* Add binary conformance tests for map fields

* Update failure list

* Fix php conformance test

* Fix php conformance test

In 32-bit platform, int64 should be string. However, map iterator returns string key as integer.

* Add more test cases for map

* Update failure list
2019-09-03 10:47:32 -07:00
ST-DDT 5af81a442b
Use parameter name comment 2019-06-26 20:39:03 +02:00
Paul Yang d7c4409589
Php 7.3 fix (#5434)
* Inherit from message instead of implement

When regestering class (implmenets other class) during MINIT, zend_class_implements
would call zend_class_entry->interface_gets_implemented(). In PHP-7.3 interface_gets_implemented shares the same location with create_object.
However, during MINIT, the global object storeage hasn't been initialized. And thus, caused segment fault in php 7.3.

* Use zend_string_init where interned string may be the value.
zend_string_dup will keep using the existing interned string.
In php 7.3, interned string cannot be destroyed from user's code.

* Uncommment debug code

* Use latest phpunit for each php versions

* Revert change in Dockerfile

* Update php test to use the new docker image

* Update composer

* Change docker organization

* Update phpunit

* Debug phpunit

* Store phpunit into bin dir in docker image

* Install valgrind to docker

* Fix compatibility test

* Remove generated_service_test from compatibility c extension test

* Update 32bit php test to the new docker image

* Install bison

* Fix build.sh

* Fix DOCKERIMAGE_PREFIX

* Fix basename

* Add comment to build_and_run_docker2.sh

* Remove commented code

* Fix comments
2018-12-18 10:57:03 -08:00
michaelbausor 6a51c03823 PHP: Add support for primitive types in setters (#5126)
* Add support for primitive types in setters

* Update to address PR feedback

* Add tests and fixes for repeated fields

* Remove repeated field code, add getters

* Cleanup, test getters and oneofs

* Move boxing logic into separate class

* Add tests for wrapper type constructor args

* Update to add new setXXXValue methods

* Fix tests for invalid values

* Fix c extension for wrapper accessors

* Fix the bug that well known types didn't call Message_construct

* Address PR comments

* Refactoring init message with array logic

* Add include path to protoc

* Add missing TSRM_LS defintion

* Fix TSRM_LS

* Fix dist check
2018-10-07 16:56:41 -07:00
Joshua Haberman 19ef4ab1c2
Merge pull request #4816 from hrsht/hrsht/zanker-proto2
Basic Proto2 support for Ruby gem
2018-09-27 15:23:10 -07:00
Harshit Chopra d0535cc09e Adds support for proto2 syntax for Ruby gem.
This change only adds basic proto2 support without advanced features
like extensions, custom options, maps, etc.

The protoc binary now generates ruby code for proto2 syntax.
However, for now, it is restricted to proto2 files without advanced features
like extensions, in which case it still errors out.

This change also modifies the DSL to add proto messages to the DescriptorPool.
There is a new DSL Builder#add_file to create a new FileDescriptor. With this,
the generated ruby DSL looks something like:

Google::Protobuf::DescriptorPool.generated_pool.build do
  add_file "test.proto" do
    add_message "foo" do
      optional :val, :int32, 1
    end
  end
end
2018-09-27 14:21:16 -04:00
Yuzhang Hu 9c7655c9fc Ignore python .egg file to make git status clean #5004 2018-08-05 02:58:30 -07:00
mkosieradzki d6775fa8d6
Added support for Visual Studio 2017 in gitignore 2018-07-22 11:00:35 +02:00
Feng Xiao 143851ed25
Remove js_embed binary. (#4709)
* Remove js_embed binary.
2018-06-01 11:00:04 -07:00
Paul Yang 9ccc3e536c
Adopt ruby_package in ruby generated code. (#4627)
* Adopt ruby_package in ruby generated code.

* Add test for ruby_package
2018-05-17 17:11:06 -07:00
Thomas Hisch 451e0446ab Add __init__.py files to compiler and util subpackages (#4117)
The compiler and util subpackages are created by the build_py class in
setup.py. This has caused an issue in the protobuf package in
conda-forge (https://github.com/conda-forge/protobuf-feedstock/issues/40),
which is fixed by this commit.
2018-04-09 12:43:10 -07:00
Adam Cozzette 612b670086 Updated .gitignore to exclude downloaded gmock/ directory 2018-03-27 09:54:33 -07:00
Carlos O'Ryan 3c5442a95d Include googletest as a submodule (#3993)
Add googletest as a submodule in third_party/googletest.
2018-03-26 13:54:32 -07:00
Paul Yang 23adfeb003 Reserve unknown in Ruby (#3763)
* Reserve unknown in ruby

* Revert ruby tests. Wait for cpp impl for conformance test

* Add conformance test for preserving unknown

* Add unknown field conformance test to csharp failure list.

* Fix comments

* Fix comment

* Fix comments

* Fix typo

* Use stringsink_string directly

* Mark hd unused

* Remove unused encodeunknown_handlerfunc
2017-10-26 14:41:43 -07:00
Paul Yang cd5f49d094 Fix ruby segment fault (#3708)
* Fix ruby segment fault

1) rb_ary_new cannot be called during allocate function. During allocate
fucntion, the containing object hasn't been marked and rb_ary_new may
invoke gc to collect containing object.
2) The global map should be marked before allocating it. Otherwise it
may be garbage collected.

* Add test

* Remove commented code

* Fix grammer error
2017-10-03 17:28:49 -07:00
Yilun Chong 91da852c50 update .gitignore 2017-06-28 11:39:05 -07:00