Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect generated proto go sources from OutputGroup #459

Closed
wants to merge 1 commit into from

Conversation

ceason
Copy link

@ceason ceason commented Nov 28, 2018

rules_go now exposes proto generated srcs via the go_generated_srcs OutputGroup as of 45e26a2e. This PR updates the IntelliJ aspect to collect those sources.

Resolves #194

Copy link
Collaborator

@chaoren chaoren left a comment

Choose a reason for hiding this comment

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

Thanks. I'll merge this upstream with a few changes.

return None
go_proto_info = target.aspect_proto_go_api_info
files = getattr(go_proto_info, "files_to_build", [])
files = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not necessary, variables can be declared in the if scope, and still be used outside of the scope.

go_proto_info = target.aspect_proto_go_api_info
files += getattr(go_proto_info, "files_to_build", [])
if hasattr(target[OutputGroupInfo], "go_generated_srcs"):
files += target[OutputGroupInfo].go_generated_srcs.to_list()
return [f for f in files if f.basename.endswith(".pb.go")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will return an empty [] if neither if statement matches.

@chaoren
Copy link
Collaborator

chaoren commented Nov 29, 2018

Merged.

@chaoren chaoren closed this Nov 29, 2018
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.

2 participants