-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
base: main
Are you sure you want to change the base?
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.
| if macos_version | ||
| uses_from_macos = formula["uses_from_macos"].zip(formula["uses_from_macos_bounds"]) | ||
| dependencies += uses_from_macos.filter_map do |dep, bounds| | ||
| next if bounds.blank? | ||
|
|
||
| since = bounds[:since] | ||
| next if since.blank? | ||
|
|
||
| since_macos_version = MacOSVersion.from_symbol(since) | ||
| next if since_macos_version <= macos_version | ||
|
|
||
| dep | ||
| end | ||
| else | ||
| dependencies += formula["uses_from_macos"] | ||
| end |
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.
I reworked this slightly, so I would appreciate a second look before merging
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!