Commit Graph

21 Commits (4db004972ad943b7f2db36e6039a3166b5e925df)

Author SHA1 Message Date
Wojciech Tyczynski 16bf8c4008 Unify logging in generators and avoid annoying logs. 2016-07-13 15:06:44 +02:00
Tim Hockin 80490e0a55 go2idl: Allow generators to AddDir() at runtime
This is used subsequently to simplify the conversion generation, so each
package can declare what peer-packages it uses, and have those imported
dynamically, rather than having one mega list of packages to import and not
really being clear why, for any given list item.
2016-07-07 22:09:08 -07:00
Tim Hockin ab16ccc158 go2idl: don't mutate a map being iterated
This was causing us to process packages we didn't really want, which was only
visible when debugging was enabled.
2016-07-07 22:09:08 -07:00
Tim Hockin 1ba6f5df9e go2idl: Allow ... pkg specs
This is closer to standard Go semantics and obsoletes our custom --recursive
flag.
2016-07-07 16:49:46 -07:00
Tim Hockin 052847f4ed go2idl: Track doc.go file-comments
Previously we just tracked comments on the 'package' declaration.  Treat all
file comments as one comment-block, for simplicity.  Can be revisited if
needed.
2016-07-07 16:49:46 -07:00
Tim Hockin b01ac4726f go2idl: Consistently handle comments as []string
This makes subsequent comment-tag PRs more consistent.
2016-07-07 16:49:46 -07:00
Tim Hockin 57c3196914 Add support for manually defined DeepCopy methods
In bringing back Clayton's PR piece-by-piece this was almost as easy to
implement as his version, and is much more like what I think we should be
doing.

Specifically, any time which defines a .DeepCopy() method will have that method
called preferentially.  Otherwise we generate our own functions for
deep-copying.  This affected exactly one type - resource.Quantity.  In applying
this heuristic, several places in the generated code were simplified.

To achieve this I had to convert types.Type.Methods from a slice to a map,
which seems correct anyway (to do by-name lookups).
2016-07-07 16:49:46 -07:00
k8s-merge-robot 4da14c8a64 Merge pull request #28204 from thockin/cleanup-third_party
Automatic merge from submit-queue

Cleanup third party (pt 2)

Move forked-and-hacked golang code to the forked/ directory.  Remove ast/build/parse code that is now in stdlib.  Remove unused shell2junit
2016-07-07 12:13:14 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Tim Hockin b0a4b22e61 Remove no-longer-needed forked go/ast code 2016-06-28 22:57:14 -07:00
Clayton Coleman 1c8b928908
Handle aliases correctly in deepcopy/conversion 2016-06-27 21:42:02 -07:00
Clayton Coleman 5f9e7a00b8
Add optional slice and map support to protobuf
Specifying // +protobuf.nullable=true on a Go type that is an alias of a
map or slice will generate a synthetic protobuf message with the type
name that will serialize to the wire in a way that allows the difference
between empty and nil to be recorded.

For instance:

    // +protobuf.nullable=true
    types OptionalMap map[string]string

will create the following message:

    message OptionalMap {
      map<string, string> Items = 1
    }

and generate marshallers that use the presence of OptionalMap to
determine whether the map is nil (rather than Items, which protobuf
provides no way to delineate between empty and nil).
2016-06-27 21:42:02 -07:00
Tim Hockin 92567e1b06 Make go2idl handle vendor dirs 2016-05-08 20:30:38 -07:00
Wojciech Tyczynski 7448cc04e1 Switch to new generator 2016-04-11 08:04:45 +02:00
Daniel Smith 46d12b185e Add 'import-boss': enforce go import restrictions. 2016-01-27 16:18:46 -08:00
Chao Xu 5f0509a351 add SecondClosestCommentLines to go2idl types.Type 2015-12-15 22:30:58 -08:00
Chao Xu 0d7d4c04a2 split Package.Types to Types, Variables and Functions;
add DeclarationOf Kind.
2015-12-03 12:03:47 -08:00
Clayton Coleman 72df8bbfbe Allow go2idl to generate non-Go file types
Remove some indentation from file generation for specific languages,
allow SnippetWriter's io.Writer to be accessed, and add Path to
types.Name for languages where Package and Path can be disjoint.
2015-11-28 17:39:26 -05:00
Chao Xu 75cf28b7df Track Func in Universe 2015-11-24 21:22:30 -08:00
Daniel Smith 4deda6ea98 Vendor in go1.5.1 dependency
* Changes to make vendored packages accept new home.
* Fix go2idl to import vendored packages.
2015-10-21 09:56:36 -07:00
Daniel Smith 5ac9b16ade First iteration of go2idl.
* Add support for pointers, map keys, more builtins, Alias types
* Support for packages & imports
* Add helper functions to types
* change generation interface
* fix naming/ordering
* SnippetWriter for templates
* Naming systems
* Use the standard packages for import resolution
* Documentation
2015-10-21 09:56:36 -07:00