Commit Graph

2579 Commits

Author SHA1 Message Date
Jon Skeet
78b452b7ac Remove the struct-based iterator for RepeatedField.
We don't use it in the runtime or generated code anywhere now, so the extra small performance boost isn't as critical, and it has some undesirable consequences.

The tests have needed to change as iterator block enumerators don't throw when we might expect them to.
2015-07-16 09:26:10 +01:00
Jon Skeet
3bf74a91bb Merge pull request #605 from jtattermusch/csharp_cleanup
Assorted nits from C# code.
2015-07-16 08:08:45 +01:00
Jan Tattermusch
d4794c56b5 add C# build and tests to appveyor 2015-07-15 23:34:19 -07:00
Jan Tattermusch
b4a24aa5fa added comment for ByteString.CopyFrom 2015-07-15 23:29:45 -07:00
Jan Tattermusch
ab5fffcc9e C# cleanup - assorted nits 2015-07-15 23:29:45 -07:00
Jon Skeet
19cf9d1e00 Merge pull request #606 from jtattermusch/csharp-experimental-merged
Update csharp-experimental with changes from upstream/master
2015-07-16 07:11:40 +01:00
Jan Tattermusch
11002e70c6 Merge remote-tracking branch 'upstream/master' into csharp-experimental 2015-07-15 20:33:59 -07:00
Jon Skeet
385baaa87c Merge pull request #599 from jskeet/no-map-entries
Don't generate types for map entry messages
2015-07-15 22:05:17 +01:00
Jon Skeet
db52c9dd58 Address requested change from code review. 2015-07-15 22:04:45 +01:00
Jon Skeet
541b442b99 Don't create nested types (or field accessors) for map types.
I'm sure I've implemented this before, but somehow it's been lost in a maze of twisty little branches, all alike.
2015-07-15 22:04:45 +01:00
Jan Tattermusch
f828160454 Merge pull request #594 from jskeet/csharp-wellknowntypes
Introduce C# well-known types
2015-07-15 13:55:00 -07:00
Rob Earhart
2f4fb642a3 Install missing headers
Install google/protobuf/stubs/status.h, and google/protobuf/stubs/stringpiece.h -- these are required in order to include google/protobuf/util/type_resolver.h.

Install google/protobuf/stubs/bytestream.h -- this is required in order to include google/protobuf/util/json_util.h.
2015-07-14 17:17:52 -07:00
Jon Skeet
62a4aa56d4 Generated code for well-known types 2015-07-14 14:26:49 +01:00
Jon Skeet
739d13d5d1 Generate the well-known types in C#
This involves:
- Specifying a namespace in each proto (including ones we'd previously missed)
- Updating the generation script
- Changing codegen to implement IReflectedMessage.Fields explicitly (a good thing anyway)
- Changing reflection tests to take account of the explicit interface implementation

Non-generated code in this commit; generated code to follow
2015-07-14 14:26:31 +01:00
Jon Skeet
f30c3d35c6 Merge pull request #593 from jskeet/reflection-namespace
Change the reflection namespace in C#
2015-07-14 13:22:05 +01:00
Jon Skeet
1660c5631e Changing reflection namespace (part 4)
Update code already within Google.Protobuf.Reflection which was importing Google.Protobuf.DescriptorProtos
2015-07-14 11:38:06 +01:00
Jon Skeet
9c888fa3a2 Changing reflection namespace (part 3)
Change the C# namespace in descriptor.proto to Google.Protobuf.Reflection.
This then means changing where the generated code lives, which means updating the project file...

It also involves regenerating the C++ - which has updated the well-known types as well,
for no terribly obvious reason...
2015-07-14 11:13:52 +01:00
Jon Skeet
76940942cf Changing reflection namespace (part 2)
Generated code changes from previous commit
2015-07-14 10:25:40 +01:00
Jon Skeet
9f37de960f Changing reflection namespace (part 1)
- Move types into Google.Protobuf.Reflection
- Change codegen to reflect that in generated types

Generated code changes coming in part 2
2015-07-14 10:24:52 +01:00
Jon Skeet
24f8626cc9 Merge pull request #583 from jskeet/issue312
Pascal-case namespace automatically in C# codegen
2015-07-14 09:53:35 +01:00
Jon Skeet
8482b6c462 Convert package name to PascalCase for C# namespace
Fixes issue 312.
2015-07-14 09:52:35 +01:00
Jon Skeet
9440a2abe3 Merge pull request #582 from jskeet/csharp-json
JSON formatting in C#
2015-07-14 09:50:57 +01:00
Jon Skeet
0f34daad07 Changes suggested during review.
- Remove the indexers in FieldAccessorTable
- Add a TODO for field ordering in oneof
2015-07-14 09:41:28 +01:00
Jisi Liu
fde6e89f99 Merge pull request #591 from pherl/fixbuild
remove pbconfig from extract script
2015-07-13 11:28:25 -07:00
Jisi Liu
bd4bc9e72c remove pbconfig from extract script
Change-Id: I5049da7449cbada781aa1e23485a336b584802cb
2015-07-13 10:41:18 -07:00
Joshua Haberman
a3ca1fa4bf Merge pull request #588 from haberman/conformance-json
Added support for JSON and valid input to conformance tests.
2015-07-13 09:50:01 -07:00
Jon Skeet
b918dc1b17 Merge pull request #587 from jtattermusch/nuget_pkg
enable building nuget package
2015-07-12 20:53:14 +01:00
Jan Tattermusch
6c8c5b402b Update Google.Protobuf.nuspec 2015-07-12 11:51:08 -07:00
Josh Haberman
b0500b37b2 Added support for Json and valid input to conformance tests.
This was enabled by the recent open-sourcing of JSON
support and MessageDifferencer.

MessageDifferencer allows the conformance suite to expand
because it allows us to write tests for payloads that parse
successfully.  To verify the testee's output payload, we
need to parse it back into a message and compare the message
instances.  Comparing output bytes vs. a golden message is
*not* valid, because protobufs do not have a canonical
encoding (especially in the presence of maps, which have
no prescribed serialization order).

We only add one small JSON test for now, but with the
framework in place we now have the foundation to dramatically
expand the coverage of the conformance test suite.

Also added the ability for the testee to skip tests that
exercise features that are unimplemented.  This allows
Java (which currently has no JSON support) to skip tests
involving JSON.

Change-Id: I697b4363da432b61ae3b638b4287c4cda1af4deb
2015-07-10 16:36:59 -07:00
Jan Tattermusch
46feed023d enable building nuget package 2015-07-10 15:23:28 -07:00
Jan Tattermusch
cacbedf04e export c# naming routines publicly 2015-07-10 13:40:34 -07:00
Josh Haberman
a1daeaba80 Conform to C89/C90 variable declaration rules.
While we are C99 in general, the Ruby build system
for building C extensions enables several flags that
throw warnings for C89/C90 variable ordering rules.
To avoid spewing a million warnings (or trying to
specifically override these warnings with command-line
flags, which would be tricky and possibly fragile)
we conform to Ruby's world of C89/C90.

Change-Id: I0e03e62d95068dfdfde112df0fb16a248a2f32a0
2015-07-10 12:05:14 -07:00
Jon Skeet
6ea9bc7aa3 Fixes to JsonFormatter
- Handle oneof properly
- Omit unknown enum values
2015-07-10 14:05:52 +01:00
Jon Skeet
68fc689e52 Generated code changes for previous submit 2015-07-10 14:05:17 +01:00
Jon Skeet
ef3464dff6 Oneof reflection support. (Generated code changes in next commit.) 2015-07-10 14:04:53 +01:00
Jon Skeet
5b9288e47d Use the new JsonFormatter to implement ToString on generated messages. 2015-07-10 11:42:56 +01:00
Jon Skeet
f8c151f21e Initial implementation of JSON formatting
- No parsing
- Reflection based, so not hugely efficient
- No line breaks or indentation
2015-07-10 11:42:56 +01:00
Jon Skeet
94878b3080 Merge pull request #566 from jskeet/csharp-reflection
Improve C# reflection support
2015-07-10 09:08:44 +01:00
Paul Yang
fe50044041 Merge pull request #570 from google/internal-third-party
Internal local modifications.
2015-07-09 15:13:12 -07:00
Bo Yang
9f563bd0d8 Internal local modifications. 2015-07-09 12:39:52 -07:00
Jan Tattermusch
db552c9297 Merge pull request #577 from jskeet/csharp-fixup
Fix-ups suggested in PR #560
2015-07-09 12:25:04 -07:00
Jon Skeet
0da4a89c97 Knock-on effects of moving GetSampleMessage. 2015-07-09 08:26:07 +01:00
Jon Skeet
14f2222a50 Lots more tests for FieldCodec, MapField, RepeatedField
... and some implementation changes to go with them.
2015-07-09 08:26:07 +01:00
Jon Skeet
af259b77bf Fix descriptor reflection in various ways
- The protos are no longer publicly exposed at all
- Oneof detection now works (as we default to -1, not 0)
- OneofDescriptor exposes the fields in the oneof
- Removed unnecessary code for replacing protos - remnant of extensions
- There's now just the non-generic form of IDescriptor
2015-07-09 08:26:06 +01:00
Jon Skeet
5350822b0a Regenerated code due to previous commit.
Note that now we need a proto3 version of addressbook.proto. This may affect other platforms, and could do with an overhaul to follow proto3 conventions anyway (e.g. repeated field names). Will need to think about that carefully before merging into master. Raised issue #565 for this.
2015-07-09 08:26:05 +01:00
Jon Skeet
493e3db985 Codegen changes to support descriptor runtime changes
- Add a partial method called by all constructors
- Generate internal classes for descriptor.proto (only)
- Forbid proto2 descriptors except for descriptor.proto
2015-07-09 08:26:04 +01:00
Jon Skeet
462d569ec0 Changes to generated code due to previous commit. 2015-07-09 08:24:50 +01:00
Jon Skeet
78ea98f56f Implement reflection properly for fields.
- FieldAccessorTable is now non-generic
- We don't have a static field per message type in the umbrella class. (Message descriptors are accessed via the file descriptor.)
- Removed the "descriptor assigner" complication from the descriptor fixup; without extensions, we don't need it
- MapField implements IDictionary (more tests would be good...)
- RepeatedField implements IList (more tests would be good)
- Use expression trees to build accessors. (Will need to test this on various platforms... probably need a fallback strategy just using reflection directly.)
- Added FieldDescriptor.IsMap
- Added tests for reflection with generated messages

Changes to generated code coming in next commit.
2015-07-09 08:24:49 +01:00
Jon Skeet
3805b43009 Merge branch 'csharp-remove-extensions' into csharp-fixup 2015-07-09 08:24:25 +01:00
Jon Skeet
3cce11ce1c Minor fix-ups as suggested in PR #560.
- Added new line at the end of SampleEnum
- Moved GeneratedMessageTest.GetSampleMessage to a new class, SampleMessages, and renamed it to CreateFullTestAllTypes.
2015-07-09 08:12:44 +01:00