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

[7.4.0] Repo context cherry-picks #23389

Merged
merged 5 commits into from
Aug 24, 2024

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Aug 22, 2024

Cherry-picks the following commits:

  • Clarify /rules/lib/builtins/repository_ctx description of default working_directory for execute() (fa2fbcd)
  • Normalize repository starlark API docs (8f16990)
  • Document source of truth for rctx.download* cache key (d4b416f)
  • Make get_default_canonical_id public (6052ad6)
  • No longer eagerly fetch labels in repo rule (6fabb1f)

Closes #23372

dws and others added 5 commits August 22, 2024 12:10
…king_directory for execute()

Fixes bazelbuild#21897 per feedback from @meteorcloudy.

Closes bazelbuild#22669.

PiperOrigin-RevId: 642185332
Change-Id: I188efa9bf0567d14fdd1b67583f51bebd65af295
Now that Bazel built with JDK21, Starlark builtin documentation can be made more readable in source (and easier to author, since less escaping is required).

This PR refactors the repository starlark API under `src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/` to use multi-line text blocks. Minor edits have also been made to some documentation (replacing unprocessed back-ticks with HTML `code` tags, adding `code` tags where I think it makes sense, capitalization, punctuation).

Stats wise (excluding `test` directory) this covers;
- 34 of 1101 `@StarlarkMethod(...)` (5 of 170 files)
- 5 of 233 `@StarlarkBuiltin(...)` (5 of 221 files)

Closes bazelbuild#22762.

PiperOrigin-RevId: 650649974
Change-Id: I3002b8d4bccbe1d11aa6aff184b448eb1f280ba4
Documenting the default caching behaviour for `rctx.download` and `rctx.download_and_extract`.
 
Related to bazelbuild#22652

Closes bazelbuild#22716.

PiperOrigin-RevId: 653878029
Change-Id: I129f9eede2b841483a98d5335651c1d1198aaf76
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
Eager fetching of all labels listed in repo rule attributes was introduced as a performance optimization to avoid costly restarts.

Now that restarts are gone by default, this is no longer a benefit as it can cause unnecessary fetches and also create cycles where there wouldn't be any without this behavior (e.g. when two repos write each others labels into a file without resolving them).

Work towards bazelbuild#19055

Closes bazelbuild#23371.

PiperOrigin-RevId: 665744319
Change-Id: Ia27f207793a2da3fb8e37743b328483f9d45192c
@fmeum fmeum requested a review from a team as a code owner August 22, 2024 10:20
@github-actions github-actions bot added awaiting-review PR is awaiting review from an assigned reviewer team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. labels Aug 22, 2024
@iancha1992 iancha1992 added this pull request to the merge queue Aug 24, 2024
Merged via the queue into bazelbuild:release-7.4.0 with commit f1a1f2d Aug 24, 2024
52 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Aug 24, 2024
@fmeum fmeum deleted the 23372-cherry branch August 27, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants