Skip to content

Use protobuild to build protobufs - #2337

Merged
stevvooe merged 5 commits into
moby:masterfrom
tossmilestone:use-protobuild
Aug 10, 2017
Merged

stevvooe merged 5 commits into
moby:masterfrom
tossmilestone:use-protobuild

Conversation

@tossmilestone

@tossmilestone tossmilestone commented Jul 30, 2017 •

Copy link
Copy Markdown
Contributor

This PR uses protobuild tool to build protobufs, replacing the "go generate" command.
Signed-off-by: He Xiaoxi tossmilestone@gmail.com

Signed-off-by: He Xiaoxi <tossmilestone@gmail.com>
@codecov

codecov Bot commented Jul 30, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #2337 into master will decrease coverage by 0.31%.
The diff coverage is 3.27%.

@@            Coverage Diff             @@
##           master    #2337      +/-   ##
==========================================
- Coverage   60.59%   60.27%   -0.32%     
==========================================
  Files         128      128              
  Lines       26048    26168     +120     
==========================================
- Hits        15783    15772      -11     
- Misses       8878     8997     +119     
- Partials     1387     1399      +12

Signed-off-by: He Xiaoxi <tossmilestone@gmail.com>
@GordonTheTurtle

Copy link
Copy Markdown

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "use-protobuild" git@github.com:tossmilestone/swarmkit.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842353964368
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

tossmilestone and others added 2 commits July 30, 2017 17:28
Signed-off-by: He Xiaoxi <tossmilestone@gmail.com>
Signed-off-by: He Xiaoxi <tossmilestone@gmail.com>
Comment thread Protobuild.toml Outdated
[includes]
# Include paths that will be added before all others. Typically, you want to
# treat the root of the project as an include, but this may not be necessary.
before = [".", "./protobuf"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ./protobuf necessary? Can update these paths?

@tossmilestone tossmilestone Aug 1, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include ./protobuf will let the proto files in swarmkit/api can import swarmkit/protobuf/plugin/plugin.proto using relative path plugin/plugin.proto.

If not include ./protobuf, we must change plugin/plugin.proto imports to full path. It's really not necessary but a choice. We can discuss which is better. ping @stevvooe

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go ahead and use the full include path so we don't need these extra paths. plugin/plugin.proto doesn't provide as much information as github.com/docker/swarmkit/protobufplugin/plugin.proto.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that.

Comment thread api/control.proto Outdated
import "github.com/docker/swarmkit/api/objects.proto";
import "github.com/docker/swarmkit/api/types.proto";
import "gogoproto/gogo.proto";
import "plugin/plugin.proto";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path probably needs to take on the full paths.

@tossmilestone tossmilestone Aug 1, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With full path import, the ./protobuf include in Protobuild.toml can be removed. ping @stevvooe

@stevvooe

Copy link
Copy Markdown
Contributor

Ok, this looks like a good start! I'm surprised that applying deepcopy everywhere just works! We might have to fix that later, but it seems to cause little harm here.

From a generation perspective, everything looks correct here. Please checkout a few comments I have on the paths for plugins/plugins.proto.

Comment thread Makefile
@echo "🐳 $@"
@PATH=${ROOTDIR}/bin:${PATH} go generate -x ${PACKAGES}

protos: bin/protoc-gen-gogoswarm ## generate protobuf

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless protos is an actual file that gets generated, it should be added to the .PHONY target.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the protos should be added to .PHONY.

Signed-off-by: He Xiaoxi <tossmilestone@gmail.com>
@tossmilestone

tossmilestone commented Aug 3, 2017 •

Copy link
Copy Markdown
Contributor Author

@stevvooe @aaronlehmann All problems addressed has been done, please help to review it again.

@stevvooe

stevvooe commented Aug 3, 2017

Copy link
Copy Markdown
Contributor

LGTM

I'll also be adding some API stability tools to protobuild that will benefit swarmkit!

@tossmilestone

Copy link
Copy Markdown
Contributor Author

To use the API stability tool of protobuild, I want to generate descriptor files of package api and protobuf/plugin, like api.pb.txt and plugin.pb.txt. What's your opinion? @stevvooe

@stevvooe

Copy link
Copy Markdown
Contributor

@tossmilestone I think that is a great addition. Please do so in a follow up PR.

@stevvooe
stevvooe merged commit 43e7983 into moby:master Aug 10, 2017
@tossmilestone

Copy link
Copy Markdown
Contributor Author

@stevvooe OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants