Commit Graph

518 Commits

Author SHA1 Message Date
Jisi Liu
86975301f1 Update csharp and php descriptor 2017-07-18 15:44:24 -07:00
Bo Yang
6ec0b7e4d1 Merge 3.3.x into master 2017-07-18 11:06:16 -07:00
Matt A
9e745f771b Support PHP generic services (#3269)
* Add php_generic_services option

* Generate PHP generic services

* Respect namespaces for generated PHP services

* Test PHP generated services

* Rename PHP generator service method doc comment function

* Correct phpdoc service method case

* Test namespaced PHP generic services

* Always use the FQCN for PHP generic service input/output

* Add generated_service_test to php test.sh

* Add php service test protos to CI

* Add php service files to php_EXTRA_DIST

* Use Interface suffix for php generic services
2017-07-18 07:45:18 -07:00
Jon Skeet
71f2f0d76c Fix repository URL in C# project file 2017-07-13 14:03:56 +01:00
Jean-Rémy Bancel
727c0dc1fa C#: Implement IReadOnlyDictionary<K,V> in MapField<K,V> 2017-07-12 09:28:43 +01:00
Yilun Chong
7339c25d12 delete backup files 2017-07-05 09:49:11 -07:00
Yilun Chong
cbf7dfb323 fix php failing list and csharp generated proto 2017-07-05 09:48:40 -07:00
Jon Skeet
cdd524a0bd Ensure leaveOpen is true when writing to a buffer
Note that the compatibility tests have had to cahnge as well, to
cope with internal changes. (The test project has access to
internals in the main project.)

Fixes #3209.
2017-07-04 06:42:45 +01:00
Jon Skeet
62d7fe5697 Make Any easier to work with in C#
- Add a TryUnpack method which doesn't throw if the type is wrong
- Make GetTypeName public for easier determination of the message type

Fixes #3294.
2017-07-03 12:16:40 +01:00
Yilun Chong
3adb054bbf add some test proto2 supported, add js proto2 supported, fixed some error 2017-06-30 17:22:32 -07:00
Yilun Chong
a7d5be6a91 change php objc nodejs csharp ruby 2017-06-29 15:04:50 -07:00
Yilun Chong
467c1ccd25 fix csharp conformance test 2017-06-28 15:44:14 -07:00
Yilun Chong
db379e6e69 fix csharp conformance test 2017-06-28 15:32:59 -07:00
Yilun Chong
ff773c1aaf fix csharp 2017-06-28 14:55:30 -07:00
Yilun Chong
cd1dc3f0df add csharp support 2017-06-28 14:51:56 -07:00
Bo Yang
e7bcfc4241 Update version number to 3.3.2 2017-06-21 10:20:34 -07:00
Paul Yang
6f325805c0 Add new file option php_namespace. (#3162)
* Add new file option php_namespace.

Use this option to change the namespace of php generated classes.
Default is empty. When this option is empty, the package name will be
used for determining the namespace.

* Uncomment commented tests

* Revert gdb test change

* Update csharp descriptor.

* Add test for empty php_namespace.
2017-06-05 00:10:18 -07:00
John Brock
95749d5af6 update csharp README and fix .NET 3.5 build error 2017-05-25 20:20:31 +01:00
Jon Skeet
0b07d7eb9e Add IncludeSource in csproj as per review comments 2017-05-24 09:07:33 +01:00
Jon Skeet
f26e8c2ae0 Convert C# projects to MSBuild (csproj) format
This has one important packaging change: the netstandard version now
depends (implicitly) on netstandard1.6.1 rather than on individual
packages. This is the preferred style of dependency, and shouldn't
affect any users - see http://stackoverflow.com/questions/42946951
for details.

The tests are still NUnit, but NUnit doesn't support "dotnet test"
yet; the test project is now an executable using NUnitLite. (When
NUnit supports dotnet test, we can adapt to it.)

Note that the project will now only work in Visual Studio 2017 (and
Visual Studio Code, and from the command line with the .NET Core
1.0.0 SDK); Visual Studio 2015 does *not* support this project file
format.
2017-05-24 09:07:33 +01:00
Feng Xiao
58538ea919 Update version number to 3.3.1 2017-05-08 16:02:08 -07:00
Feng Xiao
80f0c0ac40 Update version number and changelog for 3.3.0 2017-04-05 17:32:17 -07:00
Feng Xiao
32d7830e4b Fix C++ build for down-integration. 2017-03-29 14:52:33 -07:00
Jie Luo
7610f101e8 Merge pull request #2884 from anandolee/master
Add FormatEnumsAsIntegers support for Json Format. Scale JsonFormatter.Settings for multi options.
2017-03-27 11:05:38 -07:00
Jie Luo
689e4bf5f4 Add FormatEnumAsInt support for Json Format. And scale JsonFormatter.Settings to multiple options. 2017-03-24 12:05:52 -07:00
Paul Yang
6b27c1f981 Add file option php_class_prefix (#2849)
This option will be prepended to generated classes of all messages in
the containing file.
2017-03-17 11:08:06 -07:00
Jie Luo
606cb7ed2c There might be duplicated enum values when allow_alias is true. Add PreferredAlias into OriginalNameAttribute to remove the duplication (#2727) 2017-02-28 10:51:19 -08:00
John Brock
17174b54dd Updating README
- Adding more detail on running tests
- Adding info about the status of .NET 3.5 support and how to enable .NET 3.5
2017-02-23 10:51:52 +00:00
John Brock
f83d129555 Upgrading test-related libraries
NUnit 3.4.0 —> 3.6.0
dotnet-test-nunit 3.4.0-alpha-2 —> 3.4.0-beta-3
2017-02-23 10:51:52 +00:00
John Brock
c9b2c8f327 Fixes for .NET 3.5 compatibility
* Changing DOTNET35 framework symbols in preprocessor directives to the default built-in value of NET35.
* Adding extension method StreamExtension.CopyTo for .NET 3.5 because it didn’t exist until .NET 4, and adding associated unit tests.
2017-02-23 10:51:52 +00:00
Jie Luo
3f6f73b796 Merge pull request #2701 from anandolee/master
Add csharp compatibility tests against v3.0.0
2017-02-13 10:54:34 -08:00
Jie Luo
7288689d8c Add csharp compatibility tests against v3.0.0 and run on Travis. 2017-02-10 13:40:16 -08:00
Jie Luo
9f09d1804a Add proto and test files for csharp compatibility tests against v3.0.0.
All the files are copied from 3.0.0 (JosnFormaterTest was deleted)
2017-02-09 16:43:18 -08:00
Jon Skeet
bd29f86804 Fix CopyTo argument validation
Fixes #2669.
2017-02-06 18:24:19 +00:00
Paul Yang
7f3e237071 Merge 3.2.x branch into master (#2648)
* Down-integrate internal changes to github.

* Update conformance test failure list.

* Explicitly import used class in nano test to avoid random test fail.

* Update _GNUC_VER to use the correct implementation of atomic operation
on Mac.

* maps_test.js: check whether Symbol is defined before using it (#2524)

Symbol is not yet available on older versions of Node.js and so this
test fails with them. This change just directly checks whether Symbol is
available before we try to use it.

* Added well_known_types_embed.cc to CLEANFILES so that it gets cleaned up

* Updated Makefile.am to fix out-of-tree builds

* Added Bazel genrule for generating well_known_types_embed.cc

In pull request #2517 I made this change for the CMake and autotools
builds but forgot to do it for the Bazel build.

* Update _GNUC_VER to use the correct implementation of atomic operation on Mac.

* Add new js file in extra dist.

* Bump version number to 3.2.0

* Fixed issue with autoloading - Invalid paths (#2538)

* PHP fix int64 decoding (#2516)

* fix int64 decoding

* fix int64 decoding + tests

* Fix int64 decoding on 32-bit machines.

* Fix warning in compiler/js/embed.cc

embed.cc: In function ‘std::string CEscape(const string&)’:
embed.cc:51:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < str.size(); ++i) {
                                ^

* Fix include in auto-generated well_known_types_embed.cc

Restore include style fix (e3da722) that has been trampled by
auto-generation of well_known_types_embed.cc

* Fixed cross compilations with the Autotools build

Pull request #2517 caused cross compilations to start failing, because
the js_embed binary was being built to run on the target platform
instead of on the build machine. This change updates the Autotools build
to use the AX_PROG_CXX_FOR_BUILD macro to find a suitable compiler for
the build machine and always use that when building js_embed.

* Minor fix for autocreated object repeated fields and maps.

- If setting/clearing a repeated field/map that was objects, check the class
  before checking the autocreator.
- Just to be paranoid, don’t mutate within copy/mutableCopy for the autocreated
  classes to ensure there is less chance of issues if someone does something
  really crazy threading wise.
- Some more tests for the internal AutocreatedArray/AutocreatedDictionary
  classes to ensure things are working as expected.
- Add Xcode 8.2 to the full_mac_build.sh supported list.

* Fix generation of extending nested messages in JavaScript (#2439)

* Fix generation of extending nested messages in JavaScript

* Added missing test8.proto to build

* Fix generated code when there is no namespace but there is enum definition.

* Decoding unknown field should succeed.

* Add embed.cc in src/Makefile.am to fix dist check.

* Fixed "make distcheck" for the Autotools build

To make the test pass I needed to fix out-of-tree builds and update
EXTRA_DIST and CLEANFILES.

* Remove redundent embed.cc from src/Makefile.am

* Update version number to 3.2.0-rc.1 (#2578)

* Change protoc-artifacts version to 3.2.0-rc.1

* Update version number to 3.2.0rc2

* Update change logs for 3.2.0 release.

* Update php README

* Update upb, fixes some bugs (including a hash table problem). (#2611)

* Update upb, fixes some bugs (including a hash table problem).

* Ruby: added a test for the previous hash table corruption.

Verified that this triggers the bug in the currently released
version.

* Ruby: bugfix for SEGV.

* Ruby: removed old code for dup'ing defs.

* Reverting deployment target to 7.0 (#2618)

The Protobuf library doesn’t require the 7.1 deployment target so
reverting it back to 7.0

* Fix typo that breaks builds on big-endian (#2632)

* Bump version number to 3.2.0
2017-01-31 09:17:32 -08:00
Jon Skeet
afc59ab55a C#: Implement IReadOnlyList<T> in RepeatedField<T>
We explicitly don't do this when targeting .NET 3.5, where the
interface doesn't exist.

No implementation is required, as we're already implementing
everything we need for IList<T>.
2017-01-30 18:58:56 +00:00
Jie Luo
ccb76fff44 Add Oneof custom options test 2017-01-27 11:52:32 -08:00
Jon Skeet
047575f20c Support custom options in C#
This consists of:
- Changing the codegen for the fixed set of options protos, to parse unknown fields instead of skipping them
- Add a new CustomOptions type in the C# support library
- Expose CustomOptions properties from the immutable proto wrappers in the support library

Only single-value options are currently supported, and fetching options values requires getting the type right
and knowing the field number. Both of these can be addressed at a later time.

Fixes #2143, at least as a first pass.
2017-01-19 06:46:04 +00:00
Jon Skeet
fb71df9f0b Add ByteString.FromStream and ByteString.FromStreamAsync in C#
Fixes #2088.

We now have separate tests for netcoreapp and net45 to test the two branches here.
(netstandard10 doesn't have MemoryStream.GetBuffer)

Although most of this library doesn't have any async functionality,
this feels like a natural place to locally add it.
2017-01-10 13:05:27 +00:00
Jon Skeet
e76d91a9d1 Add global.json file to pick dotnet core SDK version. 2017-01-10 13:05:27 +00:00
Jon Skeet
b18bc9b944 Give C# ByteString a sensible GetHashCode implementation.
Fixes #2511.
2016-12-16 12:04:40 +00:00
Jan Tattermusch
9d709f446f Merge pull request #2487 from jtattermusch/csharp_leading_whitespace
remove leading whitespace in C# xml comments
2016-12-13 13:42:23 +01:00
Jan Tattermusch
fda9049ead remove leading whitespace in C# xml comments 2016-12-12 12:41:26 +01:00
Michael Darakananda
bb77cbf05a update descriptor.proto's go_package
This change has already been made in google's repo.
Replicating the change here to unblock work on genproto.
2016-12-07 18:15:17 +11:00
Joshua Haberman
f1ce60e7b4 Factored Conformance and Benchmark test messages into shared test schema. (#1971)
* Factored Conformance test messages into shared test schema.

* Updated benchmarks to use new proto3 message locations.

* Fixed include path.

* Conformance: fixed include of Python test messages.

* Make maven in Rakefile use --batch-mode.

* Revert changes to benchmarks.

On second thought I think a separate schema for
CPU benchmarking makes sense.

* Try regenerating C# protos for new test protos.

* Removed benchmark messages from test proto.

* Added Jon Skeet's fixes for C#.

* Removed duplicate/old test messages C# file.

* C# fixes for test schema move.

* Fixed C# to use the correct TestAllTypes message.

* Fixes for Objective C test schema move.

* Added missing EXTRA_DIST file.
2016-12-03 11:51:25 -05:00
Thomas Van Lenten
f813bd9f8f Add a swift_prefix file option.
Swift generators should default to CamelCasing the proto package and prefixing
symbols with that, but this option allows developers to override that behavior
with something custom if they desire.

Fixes https://github.com/google/protobuf/issues/1833
2016-11-30 13:48:16 -05:00
Adam Cozzette
db35fe735a Add a "u" suffix to tag numbers in generated code
This seems to be necessary to prevent warnings in some compiler
configurations, particularly for tag numbers that are too large to fit
in a signed 32-bit int.
2016-11-22 16:23:55 -08:00
Julien Brianceau
3c0e0ce2b0 Fix csharp/src/Google.Protobuf.Test/project.json
This change fixes the following Chromium presubmit error:

  third_party/protobuf/csharp/src/Google.Protobuf.Test/project.json could
  not be parsed: Expecting property name: line 25 column 3 (char 482)
2016-11-14 22:32:15 +01:00
Msp
089aaa996a Fix message for InvalidProtocolBufferException 2016-11-04 23:54:34 +05:30
Jon Skeet
50a37e0135 Change JSON field name formatting
This affects cases with leading capital letters.

This breaks compatibility with previous C# releases, but
fixes compatibility with other implementations.

See #2278 for details.
2016-11-03 18:05:59 +00:00
Bo Yang
89db7ce02b Add script to build Google.Protobuf.Tools for csharp. 2016-10-10 11:44:21 -07:00
Bo Yang
e62d1f13f2 Add back removed descriptor field. 2016-10-10 11:44:21 -07:00
Feng Xiao
f933d10fbe Update version number.
[skip ci]

Change-Id: I1ba6f6372a08b5796570851336e1a548602f60da
2016-10-10 11:44:21 -07:00
Bo Yang
93007e15ff Bump library veriosn to 3.1 2016-10-10 11:43:48 -07:00
Bo Yang
15f4db6cb1 Bump version number to 3.1.0-alpha-1. 2016-10-10 11:24:31 -07:00
Jan Tattermusch
da7c026ce1 Update README.md 2016-09-22 11:07:37 +02:00
Jisi Liu
58860c021f Merge remote-tracking branch 'origin/3.0.x' into merge 2016-09-14 09:37:48 -07:00
Guillaume Turri
9b8da104c1 Rm check on dependency in the C# reflection API (#2051)
This check adds a few constraints on the way to build a project when we have
a proto file which imports another one. In particular, on projects which
build both C# and Java, it's easy to end up with exceptions like

    Expected: included.proto but was src/main/protobuf/included.proto

A user may work around this issue, but it may add unnecessary constraints
on the layout of the project.

According to f3504cf3b1 (diff-ecb0b909ed572381a1c8d1994f09a948R309)
it has already been considered to get rid of this check, for
similar considerations, and because it doesn't exist in the Java code
2016-09-05 09:29:03 +01:00
Jisi Liu
6e11540b32 Bump version number to 3.0.2 2016-09-02 11:57:49 -07:00
Thomas Van Lenten
e389165586 Add more JSON tests around underscores (#1963)
Add more JSON tests around underscores
2016-08-16 09:02:27 -04:00
Jon Skeet
f9d93f358d Regenerate conformance files to include extra oneof fields.
This should fix the failures in the conformance tests - although
it highlights the problem that we need to do this when changing
the conformance.proto file...
2016-08-15 16:45:27 +01:00
Jisi Liu
169d0ca43c Merge pull request #1893 from google/3.0.0-GA
Merge 3.0.0-GA into master
2016-07-29 14:27:53 -07:00
Jon Skeet
4e169bf0e5 Bring C#'s ToPascalCase method in line with C++.
(This still doesn't fix the conformance tests, but at least
we're now consistent with the C++ code.)
2016-07-27 10:51:12 -07:00
Jon Skeet
a8aae8989c Bring C#'s ToPascalCase method in line with C++.
(This still doesn't fix the conformance tests, but at least
we're now consistent with the C++ code.)
2016-07-27 10:49:13 +01:00
Jisi Liu
fb7a7c5f1f Bump version number for GA 2016-07-25 12:07:56 -07:00
Jon Skeet
b5ce5251fd Move to dotnet cli for building, and .NET Core (netstandard1.0) as target platform (#1727)
This also updates the version number to 3.0.0-beta4
2016-07-14 22:16:35 +01:00
Jon Skeet
5e0de1ebee Remove the overload for Add(RepeatedField<T>)
We now just perform the optimization within AddRange itself.

This is a breaking change in terms of "drop in the DLL", but is
source compatible, which should be fine.
2016-07-14 22:14:51 +01:00
Jon Skeet
2ee1e52380 Optimize AddRange for sequences implementing ICollection
(Also fix a few more C# 6-isms.)
2016-07-14 22:14:51 +01:00
Jon Skeet
b053b9211b Implement RepeatedField.AddRange.
This fixes issue #1730.
2016-07-14 22:14:51 +01:00
Jon Skeet
d9334ea8d9 Improve exception throwing implementation in collections 2016-07-14 22:14:51 +01:00
Feng Xiao
c2ebdec355 Update version number in AssemblyInfo.cs. 2016-07-14 10:46:24 -07:00
Feng Xiao
932f94e16e Update version number to 3.0.0-beta-4 2016-07-13 16:08:47 -07:00
Feng Xiao
443eb27c7c Update generated files. 2016-07-13 15:37:29 -07:00
Jos Hickson
790e6afb72 Fixed out-of-date documentation for CodedInputStream.ReadEnum. (#1581) 2016-07-10 21:31:35 +01:00
Jon Skeet
3560cc9ede Merge pull request #1702 from lukebakken/csharp-nuget-doc-update
Modify csharp README since there are now two NuGet packages
2016-07-10 21:30:31 +01:00
Jon Skeet
3df146e198 Remove unnecessary reflection call
This is the only call to TypeExtensions.IsValueType, so we can remove
that method, making the whole type conditionally compiled out for .NET 3.5
2016-07-08 18:21:25 +01:00
Jon Skeet
c53484539c Changes to generated code from previous commit 2016-07-04 08:22:18 +01:00
detlevschwabe
dc0aeaa903 Adding conditional compiler symbol to support .NET 3.5 (#1713)
* Adding condition compiler symbol to support .NET 3.5
2016-06-28 06:31:42 +01:00
Jon Skeet
0421238cc1 Expose JsonFormatter.WriteValue.
This isn't useful to most users, but can be handy in advanced use cases,
as requested in #1465.
2016-06-23 12:31:10 +01:00
Luke Bakken
80694669e4 Modify csharp README since there are now two NuGet packages 2016-06-22 07:39:05 -07:00
Jon Skeet
e3f6e2b870 Remove ordering guarantees in the MapField documentation
This doesn't currently change the ordering in the implementation, but allows us to do so in the future.
We also need to change
https://developers.google.com/protocol-buffers/docs/reference/csharp-generated#singular
which states "Finally, unlike Dictionary<TKey, TValue>, MapField<TKey, TValue> preserves insertion order of entries."
(We can just remove that sentence, I think.)
2016-06-21 07:22:48 +01:00
Jisi Liu
c8be6ee00c Merge pull request #1542 from google/beta-3
Merge Beta 3 release branch into master
2016-05-16 13:46:16 -07:00
Jisi Liu
017d390d65 Fix csharp version 2016-05-11 15:09:43 -07:00
Jon Skeet
7cc9cb407b Move test for standalone BoolValue to JsonParserTest
Also added a standalone formatter test, for confidence.
Have validated that undoing the change in 835fb947 breaks the tests
(i.e. we are still testing that the change is required).
2016-05-11 18:07:03 +01:00
Jos Hickson
835fb947cc Fixed parsing of BoolValue. 2016-05-11 15:36:02 +01:00
Jisi Liu
5dea2017db Update version numbers for other languages 2016-05-10 15:43:39 -07:00
Jon Skeet
5b5e369b18 Merge pull request #1471 from jskeet/any-host
Allow custom type URL prefixes in Any.Pack
2016-05-06 06:29:03 +01:00
Jon Skeet
61307b86f5 Allow custom type URL prefixes in Any.Pack
(And likewise ignore the prefix in unpack.)

Fixes issue #1459.
2016-04-29 10:20:03 +01:00
Jisi Liu
12fdeb9b41 Merge branch 'master' of github.com:google/protobuf 2016-04-28 14:43:08 -07:00
Jon Skeet
c588ac42a2 Regenerate well-known types for C#
(There are documentation changes and new fields in descriptor.proto that have resulted
in changes to the serialized descriptor, but no breaking changes for C#.)
2016-04-20 17:19:42 +01:00
Jon Skeet
790f4c8e37 Use the original name in JSON formatting.
(JSON parsing already does the right thing.)
2016-04-20 03:46:02 +01:00
Jon Skeet
84ea2c7a81 Regenerate all C# code and make it compile
JSON tests fail, as we're not using OriginalNameAttribute yet.
2016-04-20 03:46:00 +01:00
Jon Skeet
75626ed79c Add C# codegen changes to enum value names (mostly C++)
Overview of changes:
- A new C#-specific command-line option, legacy_enum_values to revert to the old behavior
- When legacy_enum_values isn't specified, we strip the enum name as a prefix, and PascalCase the value name
- A new attribute within the C# code so that we can always tell the original in-proto name

Regenerating the C# code with legacy_enum_values leads to code which still compiles and works - but
there's more still to do.
2016-04-20 03:45:59 +01:00
Jon Skeet
46e088e2b6 Remove duplicate test cases.
(NCrunch noticed these.)
2016-04-01 17:18:45 +01:00
Jan Tattermusch
099ff1ea14 Merge pull request #1369 from jskeet/tools-nuspec
Introduce a new nuget package, Google.Protobuf.Tools, basically to contain protoc on multiple platforms.
2016-03-31 17:44:40 -07:00
Jon Skeet
dfd47600d1 Remove duplicate line 2016-03-31 10:46:55 +01:00
Jon Skeet
ca0461c186 Introduce a new nuget package, Google.Protobuf.Tools, basically to contain protoc on multiple platforms.
I've moved both protoc.exe and the proto files out of Google.Protobuf.
The .proto files aren't a slam-dunk, but it feels like they belong with protoc as you'd *use* them with protoc.
It's not clear to me whether we really need both an x86 and x64 version of protoc.exe, as x86 would work on 64-bit Windows anyway. Discuss :)
2016-03-31 07:12:17 +01:00
Jon Skeet
71e8dca083 Refactoring of FieldDescriptor
This makes no externally visible behavioral changes. Internally and non-behaviorally:

- We use a field (compiler-generated) to store the JsonName to avoid recomputing it repeatedly
- The documentation for JsonName is updated to reflect the meaning better
- Readonly autoprops and expression-bodied properties used where possible
2016-03-30 09:42:37 +01:00
alien
6f8dd2115b Code review fixes 2016-03-29 20:56:32 +03:00
alien
0d32ab37fa csharp: add support for the json_name option
Conflicts:
	csharp/src/Google.Protobuf/JsonFormatter.cs
2016-03-18 22:59:50 +03:00