-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Make get_default_canonical_id
public
#22742
Make get_default_canonical_id
public
#22742
Conversation
65d1eac
to
f349322
Compare
Broken test should be fixed, and I've got the documentation sorted. |
Maybe this time, since I apparently missed a default lockfile test. 🤞 |
...ava/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkBaseExternalContext.java
Outdated
Show resolved
Hide resolved
@Silic0nS0ldier Can you please add an integration test to make sure this API would work as expected? |
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.
Please add a simple integration test
Also, looks like there is a conflict with a file. Could you please take a look? Thanks! |
…canonical-id-public
Conflict resolved. Working on integration test now. |
Integration test added, but I noticed |
I guess we do want to keep it consistent? @fmeum WDYT? |
This is tough... The name suggests it only affects the |
It's not ideal, but I think it's fine with proper documentation? |
I'll make sure this is properly documented. I'm also going to move the examples over to Side note, I noticed |
It makes sense to change the behavior, although remote files are mostly used to power BCR use cases, where the URLs are not user-specified. It may even be more efficient to not use canonical IDs for them as many remote overlay files won't change between module versions, but their URLs will. |
…function behaviour.
…canonical-id-public
Documentation has been updated. I won't make any to |
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.
Thanks!
When `repository_ctx.download` or `repository_ctx.download_and_extract` are not given an explicit `canonical_id` the default behaviour can lead to some counterintuitive results (e.g. URL changed but old asset restored from cache due to unchanged checksum). This PR seeks to bring greater attention to `canonical_id` in these low level API (relative to `http_archive` which uses `get_default_canonical_id` by default). URLs are usually the most appropriate `canonical_id` choice, so `get_default_canonical_id` has been added to the public API and sample usage added to documentation. Related to bazelbuild#22652 I need some pointers to make these happen. - [x] Add `get_default_canonical_id` to the Bazel docs (I believe there are other `load`ed API that is missing from docs in one way or another). - [x] Confirm examples render correctly in docs. Closes bazelbuild#22742. PiperOrigin-RevId: 662822225 Change-Id: I1617aa16a62da2d8dff2034fef8ca19aecd33d58
When
repository_ctx.download
orrepository_ctx.download_and_extract
are not given an explicitcanonical_id
the default behaviour can lead to some counterintuitive results (e.g. URL changed but old asset restored from cache due to unchanged checksum).This PR seeks to bring greater attention to
canonical_id
in these low level API (relative tohttp_archive
which usesget_default_canonical_id
by default).URLs are usually the most appropriate
canonical_id
choice, soget_default_canonical_id
has been added to the public API and sample usage added to documentation.Related to #22652
TODO
I need some pointers to make these happen.
get_default_canonical_id
to the Bazel docs (I believe there are otherload
ed API that is missing from docs in one way or another).