Skip to content

feat(zipapp): add content hash support to __main__-based invocations#3683

Merged
rickeylev merged 9 commits intobazel-contrib:mainfrom
rickeylev:zipapp.main.hash.extract
Apr 5, 2026
Merged

feat(zipapp): add content hash support to __main__-based invocations#3683
rickeylev merged 9 commits intobazel-contrib:mainfrom
rickeylev:zipapp.main.hash.extract

Conversation

@rickeylev
Copy link
Copy Markdown
Collaborator

This adds support for zipapps going through __main__ to extract to a directory
based on their content hash. This matches behavior of the shell-based
self-executable bootstrap.

@rickeylev rickeylev requested a review from aignas as a code owner April 5, 2026 07:17
@rickeylev rickeylev enabled auto-merge April 5, 2026 07:18
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a content-based hashing mechanism for zipapp extraction directories to ensure uniqueness. It replaces the standard template expansion with a custom zip_main_maker tool that computes a SHA256 hash of the application's runfiles and injects it into the __main__.py template. Feedback highlights a bug in the template substitution logic where overlapping placeholder names could cause incorrect replacements, and suggests refactoring duplicated manifest-building logic in the Starlark rules.

Copy link
Copy Markdown
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

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

LGTM

@rickeylev rickeylev added this pull request to the merge queue Apr 5, 2026
Merged via the queue into bazel-contrib:main with commit 2c5616b Apr 5, 2026
4 checks passed
@rickeylev rickeylev deleted the zipapp.main.hash.extract branch April 5, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants