Import ProtoParser into Wire. #257

Merged
merged 188 commits into from Jul 13, 2015

Projects

None yet

8 participants

@swankjesse
Contributor

No description provided.

swankjesse and others added some commits Dec 10, 2012
@swankjesse swankjesse Initial commit 68abe86
@swankjesse swankjesse Bare bones proto schema parser. d77dd9d
@swankjesse swankjesse Merge pull request #1 from jwilson/jwilson/barebones
Bare bones proto schema parser.
4256a7e
alexander Extend type support 6d7060d
@swankjesse swankjesse Merge pull request #2 from android/alex/extend
Extend type support
de80a45
alexander Add 'service' and 'rpc' bf235eb
@swankjesse swankjesse Merge pull request #3 from android/alexander/service
Add 'service' and 'rpc'
9844584
alexander Parse files from command line a46ec82
@swankjesse swankjesse Merge pull request #4 from android/alexander/command-line-tool
Parse files from command line
52ea1cf
alexander Generate Java class for message with native types 93791ae
@swankjesse swankjesse Merge pull request #5 from android/alexander/command-line-tool
Generate Java class for message with native types
a0be0b3
@swankjesse swankjesse Process multiple .proto files in a round.
This changes the generator so that it honors imports and parses
dependencies that are imported.
6041248
Eric Denman Merge pull request #6 from android/jwilson/directories
Process multiple .proto files in a round.
23119b9
@swankjesse swankjesse Support nested types.
Previously we were promoting all types to top-level types.
This breaks down when multiple classes have their own inner
'Type' enums.
c79d81d
Eric Denman Merge pull request #7 from android/jwilson/directories
Support nested types.
9f0eeb3
@swankjesse swankjesse Emit comments extracted from the source .proto. 2304e03
Eric Denman Merge pull request #9 from android/jwilson/directories
Emit comments extracted from the source .proto.
1da5957
@swankjesse swankjesse Fix ProtoSchemaParser to handle all of Square's .proto data. 198f565
Alex Chow Merge pull request #12 from android/jwilson/all_squares_protos
Fix ProtoSchemaParser to handle all of Square's .proto data.
efb4abe
@JakeWharton JakeWharton Expose proper API. 8d6a8da
@swankjesse swankjesse Merge pull request #1 from jw/jw/exposed-api
Expose proper API.
384dd1b
@JakeWharton JakeWharton Change package name. 5c918fb
@JakeWharton JakeWharton Simple docs and simpler licenses. a254177
@swankjesse swankjesse Merge pull request #2 from jw/jw/docs-n-things
Simple docs and simpler licenses.
b97764b
@JakeWharton JakeWharton Move more into public API. 6549ba2
@JakeWharton JakeWharton Style tweaks. a3ad52f
@tbroyer tbroyer Parse RPC services 277dea9
@swankjesse swankjesse Merge pull request #1 from tbroyer/service
Parse RPC services
bff248c
@swankjesse swankjesse Fix up documentation and reduce visibility of an API. 3280b77
@JakeWharton JakeWharton Merge pull request #3 from square/jwilson/docs
Fix up documentation and reduce visibility of an API.
7cad038
@JakeWharton JakeWharton Rename package to 'protoparser'. eeea0ee
@JakeWharton JakeWharton Merge pull request #4 from square/jw/package
Rename package to 'protoparser'.
53a6bd7
@danrice-square danrice-square Add support for fully-qualified type names and extensions b7bfc2e
@danrice-square danrice-square Respond to review comments 0214e63
@JakeWharton JakeWharton Merge pull request #5 from square/rice/add_extensions_and_fqnames
Add support for fully-qualified type names and extensions
392aa3d
@JakeWharton JakeWharton Use JUnit 4-style test declarations. 32ce4a7
@JakeWharton JakeWharton Merge pull request #8 from square/jw/junit4
Use JUnit 4-style test declarations.
fe74f6a
@JakeWharton JakeWharton Support messages inside extensions with nested maps. c8cb22f
@JakeWharton JakeWharton Merge pull request #9 from square/jw/nested-maps
Support messages inside extensions with nested maps.
6270e57
@danrice-square danrice-square Parse escapes in quoted strings 5b824a1
@danrice-square danrice-square Avoid string creation; eliminate some duplicated code 5c0c9db
@danrice-square danrice-square Merge pull request #10 from square/rice/parse_string_escapes
Parse escapes in quoted strings
e23e33b
@danrice-square danrice-square Add support for message options 81ab75c
@JakeWharton JakeWharton Merge pull request #12 from square/rice/options
Add support for message options
443df88
@alanpaulin alanpaulin Add support for values as lists
Example:

service SearchService {
  rpc Purchase (PurchaseRequest) returns (PurchaseResponse) {
    option (squareup.a.b) = { value: [FOO, BAR] };
  }
}
6335a8b
@alanpaulin alanpaulin Merge pull request #13 from square/apaulin/supportLists
Add support for values as lists
dec9506
@anistor anistor Add parse() methods to ProtoSchemaParser that accept a Reader or an I…
…nputStream
240fdbd
@swankjesse swankjesse Merge pull request #16 from anistor/issue_14
Add constructors to ProtoSchemaParser that accept a Reader or an InputSt...
10c0553
@danrice-square danrice-square Preserve square brackets in option names - they denote extensions 3b5603d
@danrice-square danrice-square Merge pull request #17 from square/rice/option_name_brackets
Preserve square brackets in option names - they denote extensions
c3f8b18
@danrice-square danrice-square Handle repeated option values 2ea6050
@danrice-square danrice-square Merge pull request #18 from square/rice/repeated_options
Handle repeated option values
43e8302
@JakeWharton JakeWharton Expand enum comment test to include Javadoc-style comments. eb16e30
@JakeWharton JakeWharton Merge pull request #19 from square/jw/javadocish
Expand enum comment test to include Javadoc-style comments.
ec59beb
@danrice-square danrice-square Ensure tag numbers are greater than 0 1afcd25
@danrice-square danrice-square Merge pull request #20 from square/rice/bad_tag_number
Ensure tag numbers are greater than 0
ab879c8
@JakeWharton JakeWharton Parse comments more intelligently to preserve leading whitespace. be7dc55
@JakeWharton JakeWharton Merge pull request #23 from square/jw/smarter-comment-parsing
Parse comments more intelligently to preserve leading whitespace.
4e798f1
@danrice-square danrice-square Parse enum value options eff3492
@danrice-square danrice-square Option maps do not require comma separators 2873e6e
@danrice-square danrice-square Merge pull request #24 from square/rice/enum_value_options
Parse enum value options and fix option map parsing
0482fc8
@danrice-square danrice-square Supply field options as a List<Option> rather than as a Map 68ae86e
@danrice-square danrice-square Merge pull request #25 from square/rice/field_options
Supply field options as a List<Option> rather than as a Map
54d3619
@JakeWharton JakeWharton Support public imports which are to be honored transitively. bca5b55
@JakeWharton JakeWharton Add fully-qualified name to Service model. b48eda3
@swankjesse swankjesse Merge pull request #28 from square/jw/service-tweaks
Add fully-qualified name to Service model.
54e7cb5
@swankjesse swankjesse Merge pull request #26 from square/jw/public-imports
Support public imports which are to be honored transitively.
35cd3d9
@JakeWharton JakeWharton Promote inconsistent object model constructors to public.
Prior to this only a subset of the constructors were public which dramatically limited their reuse.
289af90
@JakeWharton JakeWharton Merge pull request #27 from square/jw/publicize
Promote inconsistent object model constructors to public.
2d71252
@JakeWharton JakeWharton Add getter for fully-qualified name.
This was erroneously omitted from 862684787806b234774e8bfd1802cc8031c083ed.
1791b38
@JakeWharton JakeWharton Include fully-qualified service name in equals check. ea9b3c8
@JakeWharton JakeWharton Revert "Include fully-qualified service name in equals check."
This reverts commit 0d03eba7fa1d9368caee2b025864829bd95f7ab1.
9f5d38f
@JakeWharton JakeWharton Add missing info from equals and hashCode implementations. 7d5c4e4
@swankjesse swankjesse Merge pull request #29 from square/jw/equals-hashcode-fixes
Add missing info from equals and hashCode implementations.
b176a0a
@JakeWharton JakeWharton Fix variable casing. 5fc64a7
@JakeWharton JakeWharton Include public dependencies in toString. edbe2f1
@JakeWharton JakeWharton Standardize options as a list.
This is a backwards-incompatible change on Service.Method since it is a return type change on which methods cannot be overloaded.
ed240a6
@JakeWharton JakeWharton Ensure all types have equals/hashCode/toString. fb6a96f
@JakeWharton JakeWharton Promote getDocumentation() to Type since it's common to enums and mes…
…sages.
6c99171
@JakeWharton JakeWharton Merge pull request #34 from square/jw/doc-to-type
Promote getDocumentation() to Type since it's common to enums and messages.
5faa58b
@JakeWharton JakeWharton Merge pull request #31 from square/jw/public-to-string
Include public dependencies in toString.
81031dd
@swankjesse swankjesse Merge pull request #32 from square/jw/option-lists
Standardize options as a list.
c12092f
@swankjesse swankjesse Merge pull request #33 from square/jw/eq-hash
Ensure all types have equals/hashCode/toString.
29a0717
@JakeWharton JakeWharton Support type-level options on service and enums. 6e3d6c4
@swankjesse swankjesse Merge pull request #35 from square/jw/enum-options
Support type-level options on service and enums.
536795c
@JakeWharton JakeWharton Add simple directory-traversing parser for quickly testing the parser. 94bdce9
@JakeWharton JakeWharton Merge pull request #36 from square/jw/litmus-test
Add simple directory-traversing parser for quickly testing the parser.
efa607d
@JakeWharton JakeWharton Add options list to Type interface. 2fae643
@JakeWharton JakeWharton Standardize on static import for Collections helper. 54be7f1
@JakeWharton JakeWharton Correct extensions parsing.
Two problems were plaguing equality testing:

* ProtoFile had a ternary operator improperly scoped which resulted in precedence problems. As a result types, services, and public dependencies were only being compared when the package was not null.
* MessageType was not including the list of extensions in its equals check.
0961e84
@swankjesse swankjesse Merge pull request #37 from square/jw/type-options
Add options list to Type interface.
cc659ad
@swankjesse swankjesse Merge pull request #38 from square/jw/extensions-to
Correct extensions parsing.
a8879c0
@JakeWharton JakeWharton Properly handle nested types when converting to map. 16ea626
@swankjesse swankjesse Merge pull request #40 from square/jw/nested-option-to-map
Properly handle nested types when converting to map.
6ff8f25
@JakeWharton JakeWharton Update toString to emit valid proto syntax. 236922c
@JakeWharton JakeWharton Merge pull request #39 from square/jw/tostring
Update toString to emit valid proto syntax.
710cbad
@JakeWharton JakeWharton Make ProtoFile public. 3e191a3
@JakeWharton JakeWharton Enforce field tags to be unique. b02a212
@JakeWharton JakeWharton Validate that enum value tags are unique in scope. cb9d2b0
@JakeWharton JakeWharton Validate tag values are unique in enums. ac98cbd
@JakeWharton JakeWharton Use a set to track seen tags since they have the potential to be sparse. 586d644
@JakeWharton JakeWharton Merge pull request #45 from square/jw/unique-field-tags
Enforce field tags to be unique.
19b5e63
@JakeWharton JakeWharton Add util class for scalar types. a73d0d9
@JakeWharton JakeWharton Remove duplicate tag range check.
This check is done at the object level in the MessageType.Field and EnumType.Value constructor.
ba3e11f
@JakeWharton JakeWharton Remove errant position increment.
This was causing the first character after a field's semicolon to be ignored.
bbd59c3
@JakeWharton JakeWharton Merge pull request #48 from square/jw/duplicate-test
Remove duplicate tag range check.
64bab50
@JakeWharton JakeWharton Merge pull request #47 from square/jw/scalar
Add util class for scalar types.
feba0fc
@JakeWharton JakeWharton Merge pull request #49 from square/jw/no-whitespace
Remove errant position increment.
2813adf
@JakeWharton JakeWharton Add convenience method for option lookup. 2e924b4
@JakeWharton JakeWharton Unused import. 45c5259
@JakeWharton JakeWharton Merge pull request #50 from square/jw/options-lookup
Add convenience method for option lookup.
aa17f90
@JakeWharton JakeWharton Special-case descriptor protos from enum scope rule.
The protocol buffer descriptors (specifically FieldOptions) contain multiple enums which contain the same value. These protos will never generate code since their representation is inside the runtime which is why they are allowed by protoc.
763e851
@JakeWharton JakeWharton Merge pull request #51 from square/jw/really-google
Special-case descriptor protos from enum scope rule.
f86a22e
@JakeWharton JakeWharton Support extend declarations that are nested.
No matter in what context they are specified (e.g., inside of a message), extend declarations are always treated as being part of the scope of the root of the proto file.
acab22d
@JakeWharton JakeWharton Merge pull request #53 from square/jw/nested-extends
Support extend declarations that are nested.
4093541
@JakeWharton JakeWharton Handle missing field options on helper methods. f6762a2
@swankjesse swankjesse Merge pull request #54 from square/jw/null
Handle missing field options on helper methods.
51dd096
@JakeWharton JakeWharton Enum names must be unique, not values. d8a0418
@swankjesse swankjesse Merge pull request #55 from square/jw/names-must-be-unique
Enum names must be unique, not values.
6beab69
@JakeWharton JakeWharton Support 'allow_alias' option in 'enum' declarations. 1ba51b5
@JakeWharton JakeWharton Merge pull request #57 from square/jw/allow-alias
Support 'allow_alias' option in 'enum' declarations.
9421167
@zachmargolis zachmargolis Format multiple options on an enum value correctly 529e782
@JakeWharton JakeWharton Merge pull request #60 from zachmargolis/format-multiple-enum-options
Format multiple options on an enum value correctly
83c6c3f
@zachmargolis zachmargolis Differentiate between value types: add int, enum, boolean e1b8a0c
@JakeWharton JakeWharton Merge pull request #61 from square/margolis/handle-more-values
Differentiate between value types: add int, enum, boolean
cc8db0b
@zachmargolis zachmargolis Parse and preserve parentheses around option names f5c89a2
@zachmargolis zachmargolis Add test to verify parentheses inside brackets work 373fe6b
@JakeWharton JakeWharton Merge pull request #62 from square/margolis/options-with-parens
Parse and preserve parentheses around option names
833b98e
@JakeWharton JakeWharton Ensure API compatibility with older versions. 20b7e30
@JakeWharton JakeWharton Remove now-untrue warning on the parser. 8483051
@JakeWharton JakeWharton Switch naming from types to elements.
This makes more sense conceptually since we are matching parsing and representing the syntax tree, not a type graph.

Since this is a fundamental API change (with more to come) we also bump the version to be working towards a v4.
778747a
@swankjesse swankjesse Merge pull request #65 from square/jw/elements
Switch naming from types to elements.
fdc7428
@JakeWharton JakeWharton Convert model to AutoValue. 932d8ac
@JakeWharton JakeWharton Convert inner-classes to have 'Element' suffix to match. 60fcca1
@JakeWharton JakeWharton Merge pull request #66 from square/jw/auto-value-all-the-things
Convert model to AutoValue.
61a1e45
@JakeWharton JakeWharton Add support for 'oneof' declarations. d7aa86c
@swankjesse swankjesse Merge pull request #67 from square/jw/more-elementization
Convert inner-classes to have 'Element' suffix to match.
e23dc54
@swankjesse swankjesse Merge pull request #68 from square/jw/one-of-us-one-of-us
Add support for 'oneof' declarations.
99c6dce
@JakeWharton JakeWharton Update JUnit and switch to AssertJ. a048fed
@swankjesse swankjesse Merge pull request #70 from square/jw/update-dependencies
Update JUnit and switch to AssertJ.
1e1f3fa
@JakeWharton JakeWharton Update to Java 7. Add quick parse method for Path types.
This also changes the 'fileName' property of a file to 'filePath' to more accurately reflect its content.
352f231
@JakeWharton JakeWharton Merge pull request #69 from square/jw/java7
Update to Java 7. Add quick parse method for Path types.
06d93db
@JakeWharton JakeWharton Rename a service 'method' to 'rpc'. fb7f759
@swankjesse swankjesse Merge pull request #71 from square/jw/service-method-rename
Rename a service 'method' to 'rpc'.
4632e0c
@JakeWharton JakeWharton Promote nested element types to top-level. bd98075
@swankjesse swankjesse Merge pull request #72 from square/jw/promote-nested-element-types
Promote nested element types to top-level.
305ab86
@JakeWharton JakeWharton Use a builder for the file to simplify creation. a2beb42
@swankjesse swankjesse Merge pull request #73 from square/jw/file-builder
Use a builder for the file to simplify creation.
9f5d11f
@JakeWharton JakeWharton Merge pull request #76 from square/jw/auto-deploy
Enable Travis CI snapshot auto-deploys.
f78f079
@JakeWharton JakeWharton Merge branch 'jw/auto-deploy' 5f04221
@JakeWharton JakeWharton Add support for syntax declaration. 1da54b9
@JakeWharton JakeWharton Support trailing comments on message fields and enum values. 8eea1af
@JakeWharton JakeWharton Merge pull request #30 from square/jw/trailing-doc
Support trailing comments on message fields and enum values.
60735bc
@swankjesse swankjesse Merge pull request #77 from square/jw/syntax-support
Add support for syntax declaration.
62e5470
@JakeWharton JakeWharton Rename ProtoSchemaParser to ProtoParser. 03f6f48
@swankjesse swankjesse Merge pull request #80 from square/jw/rename
Rename ProtoSchemaParser to ProtoParser.
6b166a9
@JakeWharton JakeWharton Add builders to elements. 53f7fdb
@JakeWharton JakeWharton Merge pull request #81 from square/jw/builders
Add builders to elements.
de3e725
@JakeWharton JakeWharton More builder validation and tests. 515c064
@JakeWharton JakeWharton Merge pull request #82 from square/jw/builder-validation
More builder validation and tests.
993ce23
@JakeWharton JakeWharton Formalize type concept and add 'map' and 'any' types. 1a4fc3b
@swankjesse swankjesse Merge pull request #83 from square/jw/any-map
Formalize type concept and add 'map' and 'any' types.
c8971e3
@JakeWharton JakeWharton Nest label enum in field to which it has a stronger association. 9ad04dd
@swankjesse swankjesse Merge pull request #85 from square/jw/fields-have-labels-not-messages
Nest label enum in field to which it has a stronger association.
f0e6578
@JakeWharton JakeWharton Add option creation overload for non-parenthesized name.
This is the common case so it's worth supporting in the API, especially since it avoids a boolean parameter.
09beddc
@JakeWharton JakeWharton Merge pull request #86 from square/jw/unparenthesized-overload
Add option creation overload for non-parenthesized name.
4d0c7f2
@JakeWharton JakeWharton Builders support adding collections. 8f458d9
@swankjesse swankjesse Merge pull request #87 from square/jw/collections
Builders support adding collections.
4f89093
@JakeWharton JakeWharton Option default should return Object as they are now typed. cce2fa6
@JakeWharton JakeWharton Coerce option value to string before comparing.
Both string and boolean values are supported by the reference implementation, so we support both.
1227a07
@swankjesse swankjesse Merge pull request #88 from square/jw/default-instance
Option default should return Object as they are now typed.
234d001
@JakeWharton JakeWharton Option value scalars are now always strings but include type informat…
…ion.

This also changes rendering the schema from implicitly being behind `toString()` to an explicit `toSchema()`.
57e4e09
@swankjesse swankjesse Merge pull request #92 from square/jw/what-other-options-do-i-have
Option value scalars are now always strings but include type information.
43c4702
@JakeWharton JakeWharton Re-enable crazy string parsing test with proper expected output. bf8691d
@swankjesse swankjesse Merge pull request #93 from square/jw/string-parsing
Re-enable crazy string parsing test with proper expected output.
b243ded
@JakeWharton JakeWharton Add proper rendering of option maps. f73d529
@swankjesse swankjesse Merge pull request #94 from square/jw/map-rendering
Add proper rendering of option maps.
90441c5
@JakeWharton JakeWharton Remove JSR305 in favor of our own simple Nullable. 58426dd
@JakeWharton JakeWharton Merge pull request #96 from square/jw/nully
Remove JSR305 in favor of our own simple Nullable.
e38be5b
@JakeWharton JakeWharton Merge branch 'master' of https://github.com/square/protoparser d95c20f
@DanielHeckrath DanielHeckrath Check that syntax label is followed by equal sign 633c4c6
@JakeWharton JakeWharton Merge pull request #98 from DanielHeckrath/master
Check that syntax label is followed by equal sign
d878d1f
@JakeWharton JakeWharton Merge branch 'master' of https://github.com/square/protoparser 59c9649
@danrice-square danrice-square Accept "0X" as a hex prefix 173e257
@danrice-square danrice-square Merge pull request #100 from square/rice/uppercase_hex
Accept "0X" as a hex prefix
7ae9765
@JakeWharton JakeWharton Parse trailing star comments. Strip trailing whitespace on trailing c…
…omments.
0e9fe48
@JakeWharton JakeWharton Merge pull request #101 from square/jw/crazy-trailing-star-comments
Parse trailing star comments. Strip trailing whitespace on trailing comments.
df827b0
@swankjesse swankjesse Import ProtoParser into Wire.
* protoparser/wire-import: (102 commits)
  Parse trailing star comments. Strip trailing whitespace on trailing comments.
  Accept "0X" as a hex prefix
  Check that syntax label is followed by equal sign
  Remove JSR305 in favor of our own simple Nullable.
  Add proper rendering of option maps.
  Re-enable crazy string parsing test with proper expected output.
  Option value scalars are now always strings but include type information.
  Coerce option value to string before comparing.
  Option default should return Object as they are now typed.
  Builders support adding collections.
  Add option creation overload for non-parenthesized name.
  Nest label enum in field to which it has a stronger association.
  Formalize type concept and add 'map' and 'any' types.
  More builder validation and tests.
  Add builders to elements.
  Rename ProtoSchemaParser to ProtoParser.
  Support trailing comments on message fields and enum values.
  Add support for syntax declaration.
  Use a builder for the file to simplify creation.
  Promote nested element types to top-level.
  ...
68bc640
@danrice-square
Collaborator

Why?

@swankjesse
Contributor

Here's the Wire tech stack:

  1. protoparser: basic syntax parsing, no linking.
  2. wire-schema: a linked model over protoparser.
  3. wire-compiler emit code based on that linked model.

The standalone utility of #1 is limited, and it's awkward to have an API boundary between the parsed models and the linked models. I'm attempting to bring layers 1 and 2 closer together, with the ultimate goal that layer #1 is just an implementation detail of wire-schema instead of a standalone dependency.

Current clients of protoparser should use wire-schema instead!

@danrice-square
Collaborator

Sounds great, can we add something to the README.md over in protoparser?

@swankjesse
Contributor

Yes, definitely. Do you mind if I save that for a follow-up? This change is just about importing the code & retaining git history.

@danrice-square
Collaborator

LGTM

@swankjesse swankjesse merged commit cdd5492 into master Jul 13, 2015

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@swankjesse swankjesse deleted the jwilson_0712_import_protoparser branch Jul 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment