-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
dev-cmd/generate-formula-api: add dependencies to internal API. #21042
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
Conversation
This should reduce the need to download formula stubs in the vast majority of cases.
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.
Pull Request Overview
This PR adds dependency information to Homebrew's internal formula API to reduce the need to download full formula definitions (stubs) in most cases. The changes include logic to determine which uses_from_macos dependencies should be included based on the macOS version of the bottle tag being processed.
Key Changes:
- Extracts macOS version from bottle tags for version-aware dependency filtering
- Adds logic to include conditional
uses_from_macosdependencies based on the:sincebounds - Modifies the formula stub array structure to include a 5th element (dependencies)
- Adds an empty
caskskey to the formula internal API JSON structure
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| end | ||
| end | ||
|
|
||
| [name, [pkg_version.to_s, version_scheme, rebuild, sha256, dependencies.to_a]] |
Copilot
AI
Nov 12, 2025
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.
The formula stub array structure is being changed from 4 elements [pkg_version, version_scheme, rebuild, sha256] to 5 elements by adding dependencies.to_a. However, the consumer code in api/internal.rb (line 127) expects a 4-element array as indicated by the type signature T::Hash[String, [String, Integer, Integer, T.nilable(String)]], and formula_stub method (lines 43-51) only accesses indices 0-3. This will break the expected API contract. The FormulaStub class and consumer code need to be updated to handle the dependencies field, or the type signature needs to be updated to reflect the new structure.
| [name, [pkg_version.to_s, version_scheme, rebuild, sha256, dependencies.to_a]] | |
| [name, [pkg_version.to_s, version_scheme, rebuild, sha256]] |
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.
This should be fine to do in a separate PR
Rylan12
left a comment
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! I made some small changes, but feel free to merge if you think things look good
This should reduce the need to download formula stubs in the vast majority of cases.
CC @Rylan12 feel free to adjust, tweak, test and merge as needed!