Commit Graph

241 Commits

Author SHA1 Message Date
Jon Skeet
0f370b468b Remove a redundant layer of directory hierarchy. 2015-08-03 11:29:59 +01:00
Jon Skeet
bf1cc9217a Merge pull request #675 from jtattermusch/signing
Add ReleaseSigned configuration for C#
2015-08-03 11:16:31 +01:00
Jon Skeet
e7caf15577 Initial pass at formatting Struct as JSON.
This seems remarkably little code, but it appears to work. I can add tests for invalid structs at some point, once the general approach is approved.
2015-08-03 09:32:36 +01:00
Jon Skeet
801b169bce Addressed issues raised in code review. Will merge when green. 2015-08-03 09:26:05 +01:00
Jon Skeet
16e272e0c4 Format JSON for Duration and Timestamp.
This is taking an approach of putting all the logic in JsonFormatter. That's helpful in terms of concealing the details of whether or not to wrap the value in quotes, but it does lack flexibility. I don't *think* we want to allow user-defined formatting of messages, so that much shouldn't be a problem.
2015-08-03 09:26:04 +01:00
Jan Tattermusch
d331d2f60f make changes and fixes in signing 2015-08-02 01:24:27 -07:00
Jan Tattermusch
0df900f0dc added protoc.exe and well known protobuf files to the nuspec file 2015-08-02 01:20:42 -07:00
Jan Tattermusch
538ef54f1e build signed assemblies 2015-08-02 01:20:40 -07:00
Jon Skeet
6cf5f660e5 Simplify the JSON tests for readability
Use ' instead of " in the expected JSON, then replace it before asserting.
2015-07-31 10:46:24 +01:00
Jon Skeet
4fed0b515f Fix JSON formatting to always emit fields in field order, including oneofs 2015-07-31 10:34:20 +01:00
Jon Skeet
fd02e45b2a Fix trivial bug in field orderings.
(Shows the benefit of unit testing even code "too simple to fail"...)
2015-07-31 10:34:04 +01:00
Jon Skeet
9629797331 Well-known type operations for Timestamp and Duration (but not JSON formatting).
While I've provided operators, I haven't yet provided the method equivalents. It's not clear to me that
they're actually a good idea, while we're really targeting C# developers who definitely *can* use the user-defined operators.
2015-07-31 08:14:11 +01:00
Jon Skeet
f994cfe808 Handle field names of "descriptor" and "types". 2015-07-31 07:00:25 +01:00
Jon Skeet
d18cc08456 Generated code for previous commit. 2015-07-30 13:50:02 +01:00
Jon Skeet
3980cf9df1 Prohibit null values for string/bytes fields in generated code. 2015-07-30 13:36:46 +01:00
Jon Skeet
68380f0f66 Rename ThrowHelper to Preconditions and make it public - we'll want to use it from the generated code soon.
Additionally, change it to return the value passed, and make it generic with a class constraint.
A separate method doesn't have the class constraint, for more unusual scenarios.
2015-07-30 13:36:45 +01:00
Jon Skeet
dea15a7ca4 Generated code from previous commit. 2015-07-30 13:16:00 +01:00
Jon Skeet
f03271665f More freezing tidy-up; generated code in next commit. 2015-07-30 13:15:45 +01:00
Jon Skeet
3b2fe97b6f Minor bits of left-over frozenness. 2015-07-30 13:07:50 +01:00
Jon Skeet
7a0effb9e9 Merge pull request #654 from jtattermusch/csharp_hide_freeze
Remove the C# Freeze API
2015-07-30 09:47:38 +01:00
Jan Tattermusch
7ec023acf4 regenerate code 2015-07-29 20:26:20 -07:00
Jan Tattermusch
3783d9a8ad remove the freeze API 2015-07-29 20:26:20 -07:00
Jan Tattermusch
fa29148137 add IsClientStreaming and IsServerStreaming to MethodDescriptor 2015-07-29 18:48:54 -07:00
Jon Skeet
d82ebe48e1 Update the readme file to indicate supported platforms 2015-07-28 10:23:11 +01:00
Jon Skeet
9ccc83990d Humbug - previous commit didn't include project file changes :( 2015-07-28 09:01:13 +01:00
Jon Skeet
0802d56fcd Tweaks to Profile259 support
- Fix nupec paths
- Remove an obsolete part of the JSON build
- Add documentation and tests to reflection extension methods, and improve implementations
2015-07-28 08:16:50 +01:00
Jon Skeet
0dbd5ec80d First attempt at using profile 259 for Google.Protobuf.
This requires .NET 4.5, and there are a few compatibility changes required around reflection.
Creating a PR from this to see how our CI systems handle it. Will want to add more documentation,
validation and probably tests before merging.

This is in aid of issue #590.
2015-07-27 07:47:50 +01:00
Jan Tattermusch
3b8c83eff1 expose original binary data for filedescriptor 2015-07-24 20:27:35 -07:00
Jon Skeet
c1c6b2d0d5 Implemented Jan's suggestion of FieldCollection, replacing FieldAccessorCollection.
I think Jan was actually suggesting keeping both, but that feels redundant to me. The test diff is misleading here IMO, because I wouldn't expect real code using reflection to use several accessors one after another like this, unless it was within a loop. Evidence to the contrary would be welcome :)

This change also incidentally goes part way to fixing the issue of the JSON formatter not writing out the fields in field number order - with this change, it does except for oneofs, which we can fix in a follow-up change.

I haven't actually added a test with a message with fields deliberately out of order - I'm happy to do so though. It feels like it would make sense to be in google/src/protobuf, but it's not entirely clear what the rules of engagement are for adding new messages there. (unittest_proto3.proto?)
2015-07-22 20:13:38 +01:00
Jon Skeet
5e0cfc9a47 Added newlines 2015-07-22 20:13:37 +01:00
Jon Skeet
20bf6a563a First pass at making field access simpler.
This is definitely not ready to ship - I'm "troubled" by the disconnect between a list of fields in declaration order, and a mapping of field accessors by field number/name. Discussion required, but I find that easier when we've got code to look at :)
2015-07-22 20:13:37 +01:00
Jon Skeet
e2368c9022 Fix attribute mistake and regenerate code. 2015-07-22 13:47:16 +01:00
Jon Skeet
47bf49b9fa Generated code for previous commit. 2015-07-22 11:39:38 +01:00
Jon Skeet
4668c3dc39 Remove the usage of attributes for field/method discovery.
Instead, introduce GeneratedCodeInfo which passes in what we need, and adjust the codegen to take account of this.
2015-07-22 11:38:22 +01:00
Jon Skeet
8d115298c7 Fix comment typo 2015-07-21 12:59:42 +01:00
Jon Skeet
96cffaa8e3 Generated code changes following previous commit. 2015-07-21 12:59:41 +01:00
Jon Skeet
53c399a1d6 Revamp to reflection.
Changes in brief:
1. Descriptor is now the entry point for all reflection.
2. IReflectedMessage has gone; there's now a Descriptor property in IMessage, which is explicitly implemented (due to the static property).
3. FieldAccessorTable has gone away
4. IFieldAccessor and OneofFieldAccessor still exist; we *could* put the functionality straight into FieldDescriptor and OneofDescriptor... I'm unsure about that.
5. There's a temporary property MessageDescriptor.FieldAccessorsByFieldNumber to make the test changes small - we probably want this to go away
6. Discovery for delegates is now via attributes applied to properties and the Clear method of a oneof

I'm happy with 1-3.
4 I'm unsure about - feedback welcome.
5 will go away
6 I'm unsure about, both in design and implementation. Should we have a ProtobufMessageAttribute too? Should we find all the relevant attributes in MessageDescriptor and pass them down, to avoid an O(N^2) scenario?

Generated code changes coming in the next commit.
2015-07-21 12:59:40 +01:00
Jan Tattermusch
43b17376f7 update addressbook example 2015-07-20 16:00:26 -07:00
Jan Tattermusch
352690efc7 regenerate Addressbook.cs 2015-07-20 15:53:19 -07:00
Jon Skeet
c9fd53a3b7 First part of JSON formatting for well-known types. I think we need a reflection API rethink before doing the rest. 2015-07-20 11:48:24 +01:00
Jan Tattermusch
9b28d4b12c Fix typo in buildall.sh 2015-07-17 12:19:20 -07:00
Jon Skeet
59eeebee87 First pass at the big rename from ProtocolBuffers to Google.Protobuf.
We'll see what I've missed when CI fails...
2015-07-17 08:26:04 +01:00
Jon Skeet
34878cb14e Fixes from PR review. 2015-07-17 06:41:46 +01:00
Jon Skeet
3da90e9f54 Make the map test actually test the code... 2015-07-16 21:34:10 +01:00
Jon Skeet
8a0312b201 First pass at wrapper types.
- We do still generate the message types, as otherwise reflection breaks, even though it doesn't actually use those types.
- JSON handling hasn't been implemented yet
2015-07-16 17:03:06 +01:00
Jon Skeet
8d47ec4f3e Fixes to ByteString's equality handling. 2015-07-16 09:36:31 +01:00
Jon Skeet
b2ac868493 First part of implementing wrapper types. Not ready yet! 2015-07-16 09:36:30 +01:00
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
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