-
Notifications
You must be signed in to change notification settings - Fork 697
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
Add limited support for overriding and excluding dependencies. #84
Conversation
docker/docker.bzl
Outdated
@@ -30,55 +30,65 @@ load(":push.bzl", "docker_push") | |||
# The release of the github.com/google/containerregistry to consume. | |||
CONTAINERREGISTRY_RELEASE = "v0.0.11" | |||
|
|||
def docker_repositories(): | |||
def docker_repositories(excludes=[], overrides={}): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In python there are issues with using mutable objects as default vals in functions, does that apply to skylark?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed regardless.
docker/docker.bzl
Outdated
name = "puller", | ||
url = ("https://storage.googleapis.com/containerregistry-releases/" + | ||
gcr_release + "/puller.par"), | ||
sha256 = overrides.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're overriding it might be nice to not have to specify a SHA, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it, but let's see if someone complains. I was debating exactly this for the large list of TODOs below. Ultimately I didn't do this because AFAIK there is no way of doing this without duplicating the rule. @damienmg thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make it optional but generally this go against reproducibility which is going to get back at you.
BTW, maybe use native.existing_rule to make sure you do not add an existing deps instead, that would better address #55.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like excludes= and override= are not needed, I would rather use native.existing_rules to not re-add existing deps.
docker/docker.bzl
Outdated
name = "puller", | ||
url = ("https://storage.googleapis.com/containerregistry-releases/" + | ||
gcr_release + "/puller.par"), | ||
sha256 = overrides.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make it optional but generally this go against reproducibility which is going to get back at you.
BTW, maybe use native.existing_rule to make sure you do not add an existing deps instead, that would better address #55.
@damienmg I believe what you are suggesting is that |
Yes it is.
…On Tue, Jul 4, 2017, 3:38 AM mattmoor ***@***.***> wrote:
@damienmg <https://github.com/damienmg> I believe what you are suggesting
is that native. existing_ruless keys replaces excludes and if a user
wants to override, they should just import it themselves and then
existing_rules will do the right thing. Is that a fair interpretation?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#84 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADjHfxJw2JQBvcDvXxpDwIUWSFD5jFM6ks5sKUM-gaJpZM4OLCfX>
.
|
@damienmg then it should be RFAL, that's what I pushed :) |
@dlorenc any problems with the new approach? |
This avoids manual `excludes=[]` and `overrides={}`, which were suggested in the linked issues. We exclude things that have already been imported, so to override them, simply import them before `docker_repositories()` and the exclusion logic will handle the rest. Fixes: bazelbuild#55 Fixes: bazelbuild#77
rebased after the fast push/pull stuff was merged through. |
@dlorenc Ping |
…ld#84) * Add missing greeter target to java-tutorial //src/main/java/com/example/cmdline:runner currently references //:greeter, which does not exist. * Format all BUILD files Generated by running . * Update greeter to be consistent with documentation See https://docs.bazel.build/versions/master/tutorial/java.html.
Fixes: #55
Fixes: #77