Commit Graph

413 Commits

Author SHA1 Message Date
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
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
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
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
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
Jan Tattermusch
6c8c5b402b Update Google.Protobuf.nuspec 2015-07-12 11:51:08 -07:00
Jan Tattermusch
46feed023d enable building nuget package 2015-07-10 15:23:28 -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
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
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
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
Jon Skeet
ee835a3fe4 Fix copyright lines for all C# code.
Everything should now be consistent - the only difference between files is the year (aside from generated files).

Fixes issue #531.
2015-06-30 17:22:26 +01:00
Jon Skeet
f34d37a3d4 Tidying up and extra tests.
This is mostly just making things internal instead of public, removing and reordering a bunch of code in CodedInputStream/CodedOutputStream, and generally tidying up.
2015-06-30 13:20:31 +01:00
Jon Skeet
b9d1d3891f Tests changed enough to build 2015-06-30 13:20:30 +01:00
Jon Skeet
f2a27cc2c7 First pass (not yet compiling) at removing all the array handling code from Coded*Stream.
Prod code works, but some tests are broken. Obviously those need fixing, then more tests,
and review benchmarks.
2015-06-30 13:20:30 +01:00
Jon Skeet
8d83f8d13e Fix for doubly-nested types - issue #307.
No specific test case - if the generated code compiles, the issue is fixed :)
2015-06-29 09:27:54 +01:00
Jon Skeet
fb77cc9d9f More cleanup, based around searches for "Google.ProtocolBuffers"
- Remove some old proto2-based C#-only messages
- Remove the "build" directory which only contained out-of-date files
- Remove the csharp_namespace option from proto2 messages
- Change "Google.ProtocolBuffers" to "Google.Protobuf" in other messages
2015-06-26 20:13:07 +01:00
Jon Skeet
aa5104143c Remove a lot of code which wasn't needed any more. 2015-06-26 20:13:06 +01:00
Jon Skeet
e75a10d8ff Fix or delete old projects.
ProtoDump isn't currently useful, but will be when ToString emits JSON: fixed.
ProtoBench: deleted; we should reinstate when there's a common proto3 benchmark.
ProtoMunge: delete; not useful enough to merit fixing up.

Removed the [TestFixture] from ByteStringTest as Travis uses a recent enough version of NUnit.
2015-06-26 20:13:05 +01:00
Jon Skeet
286edc0fc2 Tests for FieldCodec, along with a fix. 2015-06-26 20:11:34 +01:00
Jon Skeet
e6fc9778f5 Generated code changes for previous commit. 2015-06-26 10:32:50 +01:00
Jon Skeet
c12833104f Tweaks and more tests for maps
- Change the default message hash code to 1 to be consistent with other code
- Change the empty list/map hash code to 0 as "empty map" is equivalent to "no map"
- Removed map fields from unittest_proto3.proto
- Created map_unittest_proto3.proto which is like map_unittest.proto but proto3-only
- Fixed factory methods in FieldCodec highlighted by using all field types :)
- Added tests for map serialization:
  - Extra fields within entries
  - Entries with value then key
  - Non-contiguous entries for the same map
  - Multiple entries for the same key

Changes to generated code coming in next commit
2015-06-26 10:32:23 +01:00
Jon Skeet
c06226354d Make map test keys even more different to avoid odd hash collisions 2015-06-25 13:45:53 +01:00
Jon Skeet
3e7d70cb69 Generated code changes due to map changes.
(Primarily this is starting the hash code of messages at a non-zero value...)
2015-06-25 12:08:55 +01:00
Jon Skeet
df44ae4413 More map tests, and various production code improvements.
Generated code in next commit.
2015-06-25 12:08:18 +01:00
Jon Skeet
e36e601a39 Generated map code. 2015-06-25 09:39:29 +01:00
Jon Skeet
0d684d3420 First pass at map support.
More tests required. Generated code in next commit.
2015-06-25 09:39:28 +01:00
Jon Skeet
0698aa9737 Get the Mono build script working again.
The solution as a whole doesn't build yet - we probably want to remove
ProtoDump and ProtoMunge entirely, and ProtoBench should use Jan's new
benchmarks for parity with Java.

The version of NUnit on my machine, packaged with Mono 3.12.1, is
only NUnit 2.4.2, which is extremely old - it still requires an explicit
[TestFixture] attribute on test fixtures. I've added one just for ByteStringTest
for the moment so that we can see some tests passing in Travis, but as part of
a separate PR we should work on making sure we're using a recent NUnit version.
(It may already be doing so, but we can check that once it's working and merged.)
2015-06-25 08:59:35 +01:00
Jon Skeet
bfee2dfe13 Implement freezing for messages and repeated fields.
Fixes issue #523.
2015-06-24 17:56:22 +01:00
Jon Skeet
785e13e3c0 Generated code changes from previous commit. 2015-06-23 20:05:04 +01:00
Jon Skeet
8c896b259e Implement requested changes for IMessage<T>
1) New line at end of file
2) Make IMessage<T> itself extend IEquatable<T> and IDeepCloneable<T>
2015-06-23 20:04:39 +01:00
Jon Skeet
6c1fe6ea3e Implement Clone.
Fixes issue #527.
2015-06-23 12:42:20 +01:00
Jon Skeet
8e9dd12b3a Update the readme to give more context of what's going on. 2015-06-19 17:33:20 +01:00
Jon Skeet
cdeda4b876 Minor cleanup.
- Make some members internal
- Remove a lot of FrameworkPortability that isn't required
- Start adding documentation comments
- Remove some more group-based members
- Not passing in "the last tag read" into Read*Array, g
2015-06-19 17:30:13 +01:00
Jon Skeet
d7dda2fed8 Use an empty array instead of a null reference for an empty repeated field. 2015-06-19 08:38:21 +01:00
Jon Skeet
a0f956932d Use our "local" copy of Encoding.UTF8 in CodedInputStream too. 2015-06-17 15:34:29 +01:00
Jon Skeet
a09b491080 Delete "lite" project and serialization project+code
We'll probably want a lot of the code from the serialization project when we do JSON, but enough of it will change that it's not worth keeping in a broken state for now.
2015-06-17 15:25:15 +01:00
Jon Skeet
d1b88f4310 Regenerated files. 2015-06-17 15:16:31 +01:00
Jon Skeet
09f3f4eec3 Updates to handle use of cmake for Windows builds. 2015-06-17 15:16:14 +01:00
Jon Skeet
d9dc05e500 Remove a lot of projects which are effectively dead from the solution - files to be killed later. 2015-06-17 14:59:49 +01:00
Jon Skeet
828b7e61d0 Use the fact that we know the tag size and bytes at codegen time to optimize. 2015-06-17 14:59:10 +01:00
Jon Skeet
fb1547b388 Regenerate proto files 2015-06-12 13:11:54 +01:00
Jon Skeet
7532f0256f Reimplement RepeatedField<T> using an array as the backing store.
This is effectively reimplementing List<T>, but with a few advantages:
- We know that an empty repeated field is common, so don't allocate an array until we need to
- With direct access to the array, we can easily convert enum values to int without boxing
- We can relax the restrictions over what happens if the repeated field is modified while iterating, avoiding so much checking

This is somewhat risky, in that reimplementing a building block like this is *always* risky, but hey...
(The performance benefits are significant...)
2015-06-12 13:07:51 +01:00
Jon Skeet
5685e98711 Simplify ComputeInt32Size to call ComputeInt32SizeNoTag. 2015-06-12 11:47:47 +01:00
Jon Skeet
9b66768e25 Optimization to avoid foreach over empty lists. 2015-06-12 11:19:16 +01:00
Jon Skeet
ca2adbd560 Fix incorrect handling of non-seekable streams.
This mirrors commit 7c86bbbc7a in the pull request to
the main protobuf project, but also reduces the size of the buffer created. (There's no point in
creating a 1024-byte buffer if we're only skipping 5 bytes...)
2015-06-12 09:57:04 +01:00
Jon Skeet
eb70bd0b60 Update the AddressBook tutorial to reflect the mutable design. 2015-06-12 09:53:44 +01:00
Jon Skeet
96ddf01aed Coded*Stream streamlining.
Remove ICodedInputStream and ICodedOutputStream, and rewrite CodedInputStream and CodedOutputStream to be specific to the binary format. If we want to support text-based formats, that can be a whole different serialization mechanism.
2015-06-12 09:53:12 +01:00
Jon Skeet
39aaf21d51 Reimplement enums as int values, and get rid of EnumHelper.
This makes repeated fields really awkward at the moment - but when we reimplement RepeatedField<T> to be backed by an array, we can cast the array directly...
2015-06-11 21:15:36 +01:00
Jon Skeet
ce0e348ded Optimize WriteRawInt32 for the common case of a value < 128, which is a single byte.
Aside from anything else, this will be used for all tags for fields 1-15.
2015-06-11 14:32:19 +01:00
Jon Skeet
35e4dbd518 Improve string encoding times.
Cache a reference to Encoding.UTF8 - the property access is (rather surprisingly) significant.
Additionally, when we detect that the string is all ASCII (due to the computed length in bytes being the length in characters), we can perform the encoding very efficiently ourselves.
2015-06-11 14:19:30 +01:00
Jon Skeet
954e720837 Use expression trees to avoid boxing when converting enums. 2015-06-09 19:44:24 +01:00
Jon Skeet
e38294a62d First pass at the mutable API. Quite a bit more to do - in particular, it's pretty slow right now. 2015-06-09 19:30:44 +01:00
Jie Luo
90da3514cd Migrate writer to io::Printer for C# 2015-06-04 11:39:13 -07:00
Jie Luo
a21a2cf7d3 Change the C# enum generator inherit from primitive generator 2015-05-29 18:07:18 -07:00
Jie Luo
f7b417ddfe Add oneof support for C# 2015-05-29 13:29:30 -07:00
Jan Tattermusch
3668a224f3 Merge pull request #394 from ironhidegames/csharp-aot-ios
Solves AOT compilation issue for Unity - iOS
2015-05-21 08:48:27 -07:00
Ruben Garat
83bcfefb0b added concrete IEqualityComparer<ExtensionIntPair> implementation in ExtensionRegistryLite.cs to prevent AOT compilation issue with unity in iOS 2015-05-20 18:07:09 -03:00
Jon Skeet
b1a395ce07 Generate *all* protos in the script, applying fixups.
We still have some protos which aren't generated how we want them to be:

- Until we have an option to specify the "umbrella" class, DescriptorProtoFile
  will be broken. (The change of name here affects the reflection descriptor,
  which accounts for most of the change. That's easier than trying to work out
  exactly which occurrences of Descriptor need changing though.)
- That change affects UnittestCustomOptions
- Issue #307 breaks Unittest.cs

After this commit, we don't have the record of the fixups in the files themselves
any more, but one centralized record in the shell script.
2015-05-16 11:38:27 +01:00
Jon Skeet
734393d0f9 Make generate_protos.sh Windows-friendly.
To my surprise, executing generate_protos.sh used the version of Bash installed with Git for Windows by default.
After a few modifications to detect the most appropriate protoc to use, this worked pretty simply.
This change also:
- adds generation of the address book tutorial proto,
- fixes the addressbook.proto to specify proto2 explicitly (to avoid a warning from protoc; I don't think we want warnings...)
- fixes the addressbook.proto C# namespace (which I thought I'd done before, but apparently hadn't)
- includes the regenerated UnittestCustomOptions.cs apart from the DescriptorProtoFIle => Descriptor change
2015-05-14 09:11:57 +01:00
Jie Luo
2d9b1c592f Merge pull request #382 from jtattermusch/integrate_from_master
Integrate changes from latest master branch into csharp branch.
2015-05-13 15:24:42 -07:00
Jan Tattermusch
38da6583b1 Regenerate UnittestDropUnknownFields.cs 2015-05-13 13:38:54 -07:00
Jan Tattermusch
ff172ca8eb Update README.md for C# 2015-05-13 11:44:17 -07:00
Jon Skeet
fd1693a3fb Update C# code generation script 2015-05-13 17:56:52 +01:00
Jon Skeet
998b5ba20d Remove the C#-specific field_presence_test.proto, using unittest_no_field_presence.proto instead.
This is the start of establishing a C# namespace of "Google.ProtocolBuffers.TestProtos.Proto3" for proto3-syntax protos.
We could optionally split the directory structure as well into Proto2 and Proto3 for clarity.
2015-05-13 17:34:02 +01:00
Jan Tattermusch
881995352d regenerated UnittestImportLite.cs 2015-05-12 22:00:38 -07:00
Jan Tattermusch
4083104aa4 regenerated UnittestImportPublicLite 2015-05-12 21:58:59 -07:00
Jan Tattermusch
3aa5808557 Regenerated UnittestExtrasLite.cs 2015-05-12 21:56:40 -07:00
Jan Tattermusch
6f7a782934 Regenerated UnittestDropUnknownFields.cs 2015-05-12 21:54:23 -07:00
Jan Tattermusch
766036f231 remove C# files not referenced in any project 2015-05-12 21:42:40 -07:00
Jan Tattermusch
385afba572 Regenerate some proto files after ClsCompliance has been dropped 2015-05-12 21:42:40 -07:00
Jan Tattermusch
a39dc6d5be rename FieldPresence to correct name 2015-05-12 21:42:40 -07:00
Jan Tattermusch
3e0e54943b got rid of the outdated mono subdirectory 2015-05-12 21:42:40 -07:00
Jan Tattermusch
dfefe9a4c1 draft of generate_protos.sh 2015-05-12 21:42:40 -07:00
Jan Tattermusch
b1a921c7b3 add buildall script for mono 2015-05-12 21:42:39 -07:00
Jan Tattermusch
6f4bdffbe5 adding what was missing in .gitignore 2015-05-12 15:21:59 -07:00
Jan Tattermusch
86f97e3246 lib subdir is not needed anymore 2015-05-12 15:21:22 -07:00
Jan Tattermusch
3ccbf4b893 Fix newline assertion in TestJsonFormatted on mono 2015-05-12 11:54:23 -07:00
Jan Tattermusch
7149cee282 remove TreatWarningsAsError setting to allow building in Monodevelop 2015-05-12 11:23:35 -07:00
Jon Skeet
90c8932fc7 Convert back to using NUnit, which is now loaded via NuGet.
This includes the NUnit test adapter which allows NUnit tests to be run under VS without any extra plugins.
Unfortunate the compatibility tests using the abstract test fixture class show up as "external" tests, and aren't well presented - but they do run.
2015-05-12 09:48:02 +01:00
Jan Tattermusch
6f9da37b0d Performance optimization for small messages without unknown fields 2015-05-07 08:40:36 -07:00
Jie Luo
ea48104cdd fix comments 2015-05-01 10:35:19 -07:00
Jie Luo
41c175e711 Change field_presence_test.proto 2015-05-01 10:12:54 -07:00
Jie Luo
3d4b761998 fix comments 2015-04-30 18:36:17 -07:00
Jie Luo
6e1ec5f6ea fix commends from Jon Skeet 2015-04-30 18:19:50 -07:00
Jie Luo
24ae5105f3 Merge branch 'csharp' of git://github.com/google/protobuf into google-csharp 2015-04-30 11:23:09 -07:00
Jon Skeet
c56475088d Change to using xUnit for all unit tests, and fetch that via NuGet.
This includes fetching the VS unit test runner package, so that tests can be run from Visual Studio's Test Explorer.
2015-04-30 11:29:35 +01:00
Jie Luo
954bc83413 Merge branch 'csharp' of git://github.com/google/protobuf into google-csharp 2015-04-29 15:55:11 -07:00
Jie Luo
4af18b8711 rename FieldPResenceTest.cs file 2015-04-29 14:20:23 -07:00
Jon Skeet
ce97e68682 Convert both the full and lite runtimes (and json/xml serialization assemblies) to be Portable Class Libraries.
All referring projects are now .NET 4 client rather than .NET 3.5.
This commit also fixes up the ProtoBench app, which I'd neglected in previous commits. (Disentangling the two sets of changes would be time-consuming.)
2015-04-29 21:15:16 +01:00
Jie Luo
d1f5acaafb Change the package for field_presence_test.proto 2015-04-29 11:49:14 -07:00
Jie Luo
c5c9c6a7e0 field presence Reflection and tests 2015-04-29 11:33:07 -07:00
Jon Skeet
0e916d09a3 Removing more C# project files. 2015-04-29 12:22:35 +01:00
Jon Skeet
f015b860b7 Remove CLS compliance from runtime code.
We need to remove it from the generator too; I'll raise a github issue for that.
2015-04-29 12:21:54 +01:00
Jon Skeet
5e0189ab94 Update C# solution and AddressBook project.
Move to a single solution file containing all of the C# projects, but no other solution folders - it's easier to edit those files outside VS than keep adding and removing them from the project.
The AddressBook protos have been regenerated (with a change to the example proto which I haven't included in this change - I'll wait for us to decide exactly what we're doing with namespaces before changing protos outside the csharp directory.

Note that now we've got Addressbook.cs which contains AddressBook and Addressbook classes. It's bad enough that we've got a class called AddressBook within a namespace of AddressBook (hard to get away from) but having things vary just by case is nasty.
This is more evidence that an option for renaming the file and descriptor class would be welcome. (A single option can probably handle both.)
2015-04-29 10:10:20 +01:00
Jon Skeet
f651f73a3c Remove support for Serializable.
This could potentially be added back in later, but its use is limited and it's a pain in terms of support in PCL environments.
One use that has been highlighted is passing objects between AppDomains; we'd recommend passing a byte array explicitly and reparsing on the other side.
2015-04-29 09:18:19 +01:00
Jon Skeet
cc058e1118 Remove RPC support.
It is expected that third parties will generate service/RPC code themselves - see gRPC as an example.
2015-04-29 08:55:07 +01:00
Jon Skeet
e8310aa259 Remove a bunch of files which are no longer relevant:
1) Project files for different configurations - we're going to look at all this again, ideally to just have a single PCL-compatible build
2) ProtoGen - the C++ generator is now the only one we care about
3) Proto files - these are mostly duplicates (or older versions) of the ones in the common directories
2015-04-29 06:55:51 +01:00
Jon Skeet
5ca6dd76fb Update DescriptorProtoFile.cs and UnitTest.cs to indicate manual changes.
(Having regenerated descriptor.proto relative to src, the earlier commented-out code checking that dependencies match may now be okay to uncomment again. Will experiment in later CLs.)
2015-04-28 18:47:47 +01:00
Jon Skeet
ce66c5f1b9 Updated set of unit tests and unit test protos.
This commit includes changes to the C#-specific protos, and rebuilt versions of the "stock" protos.
The stock protos have been locally updated to have a specific C# namespace, but this is expected to change soon, so hasn't been committed.
Four areas are currently not tested:
1) Serialization - we may restore this at some point, possibly optionally.
2) Services - currently nothing is generated for this; will need to see how it interacts with GRPC
3) Fields beginning with _{digit} - see https://github.com/google/protobuf/issues/308
4) Fields with names which conflict with the declaring type in nasty ways - see https://github.com/google/protobuf/issues/309
2015-04-28 15:06:59 +01:00
Jon Skeet
f3504cf3b1 First part of making the C# runtime work with the new codegen.
1) Remove CSharpOptions
2) A new version of DescriptorProtoFile (with manual changes from codegen - it would otherwise be Descriptor.cs)
3) Turn off CLS compliance (which we'll remove from the codebase entirely; I don't think it's actually relevant these days)
4) Add "public imports" to FileDescriptor, with code broadly copied from the Java codebase.
Lots more changes to commit before it will build and tests run, but one step at a time...
2015-04-28 14:53:24 +01:00
Jan Tattermusch
1eab56aee8 removed .hgignore file 2015-04-16 12:31:48 -07:00
Jan Tattermusch
4e80fe15ed Added instructions to manually download the dependencies 2015-04-16 12:30:14 -07:00
Jan Tattermusch
6b7f0172b9 cleanup of csharp/lib/ directory 2015-04-16 10:56:23 -07:00
Jan Tattermusch
e77878ebc7 Updated readme.md and changes.txt, removed old license.txt 2015-04-16 10:23:54 -07:00
Jan Tattermusch
84fa3e2bbc Imported protobuf-csharp-port into csharp/ tree 2015-04-16 09:55:22 -07:00
Jon Skeet
f0589506c9 Wiping slate clean to start again with new layout. 2008-10-22 13:18:49 +01:00
Jon Skeet
e60ce8bfaf Final commit before changing layout 2008-10-22 07:11:17 +01:00
Jon Skeet
7f90d8ee57 Made things a bit more public for the sake of ProtoGen 2008-10-02 21:46:17 +01:00
Jon Skeet
7fd62ffd77 Initial setup of generator code. Little real functionality so far. 2008-09-04 15:13:21 +01:00
Jon Skeet
4658a3dd7e Doc fix 2008-09-04 14:44:03 +01:00
Jon Skeet
dd9703ba53 Reduce dependencies 2008-09-04 14:43:43 +01:00
Jon Skeet
881db010cb Fix initialization check when an optional field has required subfields 2008-09-04 14:43:17 +01:00
Jon Skeet
0dabc77f7f Renamed GeneratedRepeatException to GeneratedRepeatExtension 2008-09-04 14:41:09 +01:00
Jon Skeet
be432ca43c Added a doc TODO 2008-09-04 14:35:05 +01:00
Jon Skeet
57be03df65 Removed unnecessary delegate 2008-09-04 14:34:01 +01:00
Jon Skeet
0bf2ad145d Implemented popsicle immutability for lists. Modified MessageStreamIterator to be singly generic. 2008-08-21 21:57:58 +01:00
Jon Skeet
ad6903fe33 Fix to constructor access for nested types, and first pass at streaming. 2008-08-19 21:24:21 +01:00
Jon Skeet
f09fed217f Small tidying. 2008-08-16 21:23:40 +01:00
Jon Skeet
2cbd799b5e Comments. 2008-08-15 21:24:06 +01:00
Jon Skeet
984eb9c27a Just comments. 2008-08-15 21:15:41 +01:00
Jon Skeet
0b6d39acc4 Remove unused variable. 2008-08-15 21:14:41 +01:00
Jon Skeet
92b0aaa09e Use a nullable int for the memoizedSize, just because it's neater. 2008-08-15 21:12:55 +01:00
Jon Skeet
9deef9baec Add aliases into enums 2008-08-15 20:57:15 +01:00
Jon Skeet
10ad653ce5 Reflect Java source code. 2008-08-15 20:48:16 +01:00
Jon Skeet
40c2221ef4 Updated C# tests and code for TextFormat to match Java. 2008-08-15 20:40:05 +01:00
Jon Skeet
7941ebf198 Updates due to changes to descriptor.proto 2008-08-15 20:08:37 +01:00
Jon Skeet
8f721f5dc7 Experimental (and currently unused) behaviour to determine whether or not a message has any required fields. 2008-08-14 20:38:09 +01:00
Jon Skeet
b01135c485 Align delegates with .NET 3.5 2008-08-14 20:38:08 +01:00
Jon Skeet
6d0cbe7200 Use a switch instead of a map for WireFormat. 2008-08-14 20:38:08 +01:00
Jon Skeet
0980982095 Evil reflection optimisation. 2008-08-14 20:38:07 +01:00
Jon Skeet
38da52d349 Micro-optimisations around varints and strings. 2008-08-14 20:38:06 +01:00
Jon Skeet
272d384f6a Use delegates instead of dynamic reflection. 2008-08-14 20:37:12 +01:00
Jon Skeet
3b3150881a Optimisations of IsInitialized and removal of unnecessary references. 2008-08-14 20:37:11 +01:00
Jon Skeet
81efcf25f3 Removed accidental addition of test directory. 2008-08-14 20:37:10 +01:00
Jon Skeet
62b3d31fb7 Fixed a few TODOs 2008-08-14 20:36:24 +01:00
Jon Skeet
eb4ef52c66 Abandon the 'self' namespace alias - we need to be able to import types in other namespaces too. 2008-08-14 20:35:35 +01:00
Jon Skeet
5407a4329d Signed the test assembly, and added InternalsVisibleTo. Some public members now internal again. 2008-08-14 20:35:34 +01:00
Jon Skeet
38d453d318 Beginning to fix the TODOs 2008-08-14 20:35:34 +01:00
Jon Skeet
15041fa06c Removed EnumDescriptorIndexAttribute - not really necessary. 2008-08-14 20:35:33 +01:00
Jon Skeet
283b7a1a51 Batch file to generate the bootstrapping proto files 2008-08-14 20:35:33 +01:00
Jon Skeet
48ce28bf2f Copyright fixes, a bit of documentation, and removed unnecessary using directives. 2008-08-14 20:35:32 +01:00
Jon Skeet
5923b37223 Finished service test with a mock. 2008-08-14 20:35:31 +01:00
Jon Skeet
3ae573c174 Fleshed out service interfaces, and wrote the simpler service tests. Mocking tests still to be done. 2008-08-14 20:35:31 +01:00
Jon Skeet
1e42fdde2e Implemented text parsing. 2008-08-14 20:35:30 +01:00
Jon Skeet
feb9385b04 Lots of text formatting tests, but ignored the parsing ones for the moment. 2008-08-14 20:35:30 +01:00
Jon Skeet
ca4cbda9de Extensions don't need to go under a separate type. 2008-08-14 20:35:29 +01:00
Jon Skeet
d6c9495797 More tests, and a bug fix. 2008-08-14 20:35:28 +01:00
Jon Skeet
19ed9c0782 UnknownFieldSet tests, and a fix to repeated extension elements. 2008-08-14 20:35:28 +01:00
Jon Skeet
a80a37ccd5 Tidying up, and a couple of extra tests. 2008-08-14 20:35:27 +01:00
Jon Skeet
f26f8dce02 The great generics revisiting. 2008-08-14 20:35:27 +01:00
Jon Skeet
cabd06d12f More tests, and implementation of UninitializedMessageException description. 2008-08-14 20:35:25 +01:00
Jon Skeet
794409b379 More tests, more fixes. 2008-08-14 20:35:24 +01:00
Jon Skeet
ba02091ef8 New unit tests and corresponding bug fixes. 2008-08-14 20:35:24 +01:00
Jon Skeet
bef2caf5e4 Added DynamicMessage and ExtendableBuilder, along with the first supporting tests. 2008-08-14 20:35:23 +01:00
Jon Skeet
5d7adf66ce First unit test reading a complete message\! 2008-08-14 20:35:22 +01:00
Jon Skeet
3f9a6f2116 Implemented GeneratedExtension, although list handling may be incorrect. 2008-08-14 20:35:22 +01:00
Jon Skeet
575083ae9c Initial support for services and extensions. Incomplete, but enough to get generated unit test files to compile. 2008-08-14 20:35:21 +01:00
Jon Skeet
1353315ded Implemented TextFormatter 2008-08-14 20:35:20 +01:00
Jon Skeet
b84310e110 Field accessor implementations complete (hopefully) 2008-08-14 20:35:20 +01:00
Jon Skeet
023d7398d6 Update Makefile in terms of C# sources and keyfile command line option
committer: Jon Skeet <skeet@pobox.com>
2008-08-14 20:35:19 +01:00
Jon Skeet
4e6215c734 Update Makefile in terms of C# sources and keyfile command line option
committer: Jon Skeet <skeet@pobox.com>
2008-08-14 20:35:19 +01:00
Jon Skeet
00b0af0890 Fix default instance behaviour for repeated types 2008-08-14 20:35:18 +01:00
Jon Skeet
c1215c4660 Removed Descriptor.cs which was an early attempt at generation 2008-08-14 20:35:17 +01:00
Jon Skeet
a03ea11c52 Finish implementing GeneratedBuilder. 2008-08-14 20:35:17 +01:00
Jon Skeet
cd85190847 Two more which should have been in the last commit 2008-08-14 20:35:15 +01:00
Jon Skeet
3351bb63da Descriptors are pretty much complete, with a slight issue of how to find the default type for a repeated field. 2008-08-14 20:35:15 +01:00
Jon Skeet
2b61cbf408 Autogeneration now hopefully close to correct. Library builds! (Not finished though...) 2008-08-14 20:35:14 +01:00
Jon Skeet
de21d2c92c Patch from Miguel de Icaza: This introduces auto-detection of Mono to configure, and if found, builds and installs the runtime library, and provides a pkg-config file so developers can easily use it on Unix. 2008-08-14 20:33:37 +01:00
Jon Skeet
9f4f0a56b1 Descriptor framework skeleton. Somewhat generic to avoid lots of code duplication. 2008-08-14 20:33:36 +01:00
Jon Skeet
c0daf10724 Changed fixed size methods to return unsigned integers. Finished FieldSet. Introduced mapping from FieldType to WireType and MappedType. 2008-08-14 20:33:35 +01:00
Jon Skeet
ec8c395517 Gradually implementing FieldSet 2008-08-14 20:33:34 +01:00
Jon Skeet
b83aee759a Fix AbstractMessage and AbstractBuilder to get the explicit interface implementation sorted 2008-08-14 20:33:33 +01:00
Jon Skeet
621bb698e5 Some work on AbstractBuilder, and complete implementation of UnknownField and UnknownFieldSet 2008-08-14 20:33:33 +01:00
Jon Skeet
fe7bb26214 Implemented AbstractMethod and split the descriptors into a new package 2008-08-14 20:33:30 +01:00
Jon Skeet
c26b43d8cd Added copyright notices
committer: Jon Skeet <skeet@pobox.com>
2008-08-14 20:33:29 +01:00
Jon Skeet
1dd0a61d09 More tests for CodedInputStream, and some more WireFormat
committer: Jon Skeet <skeet@pobox.com>
2008-08-14 20:33:29 +01:00
Jon Skeet
b802a94f45 Half way through CodedInputStream
committer: Jon Skeet <skeet@pobox.com>
2008-08-14 20:33:28 +01:00
Jon Skeet
baa2bf54c2 First part of dotnet library
committer: Jon Skeet <skeet@pobox.com>
2008-08-14 20:33:27 +01:00