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

ctx.delete missing in utils.bzl? #10518

Closed
philwo opened this issue Jan 3, 2020 · 1 comment
Closed

ctx.delete missing in utils.bzl? #10518

philwo opened this issue Jan 3, 2020 · 1 comment
Assignees

Comments

@philwo
Copy link
Member

@philwo philwo commented Jan 3, 2020

@aehlig I just read the code of our http_archive repository rule and came across this part:
https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/repo/utils.bzl#L50-L57

I don't know the exact semantics of ctx.file, ctx.delete and ctx.symlink regarding how they treat the case of a file already existing, but it seems like we either need to add ctx.delete("WORKSPACE") to the else clause, too, or we don't have to ctx.delete in the other two cases - right?

@aehlig

This comment has been minimized.

Copy link
Member

@aehlig aehlig commented Jan 8, 2020

Looking at the documentation (and verifying these assertions in tests)

  • ctx.file removes a pre-existing file,
  • while ctx.symlink may (and actually does) assume that the target location is empty.

So, we can remove two occurrences of ctx.delete. I will prepare a corresponding change.

@bazel-io bazel-io closed this in e91dca4 Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.