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

bazel updates to generate go-bindata #3689

Merged
merged 1 commit into from
Oct 26, 2017

Conversation

chrislovecnm
Copy link
Contributor

Fixes: #3626

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 23, 2017
@chrislovecnm chrislovecnm changed the title updates to generate go-bin-data bazel updates to generate go-bin-data Oct 23, 2017
@chrislovecnm chrislovecnm changed the title bazel updates to generate go-bin-data bazel updates to generate go-bindata Oct 23, 2017
@justinsb
Copy link
Member

This is awesome. One gotcha - this doesn't update the bindata.go in the directory AFAICT. (Rather it updates a generated copy). Not entirely sure what we should do about that, TBH. I suspect we should probably just accept that checking in these files is good neither for a Makefile nor bazel. But OTOH kops should be go get-able (at least for the CLI), though I think it might not be.

@chrislovecnm
Copy link
Contributor Author

@justinsb so https://docs.bazel.build/versions/master/be/general.html#genrule.outs is saying we cannot do that by default. We can output to bin dir or the generated sources dir. Am I missing something?

I am guessing we would need to write a custom rule. I would rather not. This is kinda how bazel works, and we should not change that just to have it work the way we had it working before.

Copy link
Member

@ixdy ixdy left a comment

Choose a reason for hiding this comment

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

Bazel will prefer the bindata.go generated by the genrule over the version in the source tree.


genrule(
name = "bindata",
srcs = glob(["*","*/*","*/*/*","*/*/*/*","*/*/*/*/*"], exclude=["bindata.go", "vfs.go"]),
Copy link
Member

Choose a reason for hiding this comment

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

I think you can just do glob(["**"], exclude=...) here for the same effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks


genrule(
name = "bindata",
srcs = glob(["*"], exclude=["bindata.go"]),
Copy link
Member

Choose a reason for hiding this comment

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

maybe exclude the BUILD.bazel file here too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missed that

$(location //vendor/github.com/jteeuwen/go-bindata/go-bindata:go-bindata) \
-o "$(OUTS)" -pkg model \
-prefix $$(pwd) \
-ignore bindata.go -ignore BUILD.bazel \
Copy link
Member

Choose a reason for hiding this comment

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

... which would probably let you omit this.

@chrislovecnm
Copy link
Contributor Author

Updates per @ixdy 's review. @justinsb PTAL

@justinsb
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 26, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 26, 2017
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue.

@k8s-github-robot k8s-github-robot merged commit f3454f9 into kubernetes:master Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants