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

formula: change some private API to public API #18582

Merged
merged 2 commits into from
Nov 8, 2024
Merged

Conversation

cho-m
Copy link
Member

@cho-m cho-m commented Oct 16, 2024

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

The following methods used in Homebrew/core are now public API:

  • system
  • std_*_args
  • any_version_installed?
  • shared_library
  • rpath
  • loader_path
  • deuniversalize_machos
  • generate_completions_from_executable

Also remove duplicate typing in generate_completions_from_executable


Otherwise, https://rubydoc.brew.sh/Formula.html shows

This method may only be used in the Homebrew/brew repository

even though we use it in Homebrew/core.

@cho-m
Copy link
Member Author

cho-m commented Oct 16, 2024

Though, may need to also flip Formula to be @api public since it is odd that we claim

This class is part of a private API. This class may only be used in the Homebrew/brew repository.

@Bo98
Copy link
Member

Bo98 commented Oct 16, 2024

Methods that are used in Homebrew/core should at least be internal API. This updates:

  • any_version_installed?
  • shared_library
  • rpath
  • loader_path
  • deuniversalize_machos
  • generate_completions_from_executable

These should all be public. It should be rare/never that Homebrew/core uses internal API, especially given brew extract exists. I don't think any of these are particularly obscure.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks!

@MikeMcQuaid
Copy link
Member

Though, may need to also flip Formula to be @api public since it is odd that we claim

This class is part of a private API. This class may only be used in the Homebrew/brew repository.

I think as long as all private methods show up as private if we make this @api public: yeh, I agree.

@cho-m
Copy link
Member Author

cho-m commented Oct 16, 2024

These should all be public. It should be rare/never that Homebrew/core uses internal API, especially given brew extract exists. I don't think any of these are particularly obscure.

Was playing it safe, but can make them public.


I think as long as all private methods show up as private if we make this @api public: yeh, I agree.

This was the main reason I didn't in this PR. Wasn't sure if we needed to mark everything as @api private afterward.

@MikeMcQuaid
Copy link
Member

Was playing it safe, but can make them public.

go for it 👍🏻

This was the main reason I didn't in this PR. Wasn't sure if we needed to mark everything as @api private afterward.

I think @reitermarkus changed this in the past? Can probably check a method not explicitly marked like this and see what it looks like on <rubydoc.brew.sh>

The following methods used in Homebrew/core are now public API:

* `system`
* `std_*_args`
* `any_version_installed?`
* `shared_library`
* `rpath`
* `loader_path`
* `deuniversalize_machos`
* `generate_completions_from_executable`

Also remove duplicate typing in `generate_completions_from_executable`
@cho-m cho-m changed the title formula: change some private API to internal/public formula: change some private API to public API Oct 17, 2024
@reitermarkus
Copy link
Member

All methods not marked @api public should show as private, even if the class is @api public.

You can check locally using brew rubydoc.

@MikeMcQuaid MikeMcQuaid merged commit a8a4c07 into master Nov 8, 2024
38 checks passed
@MikeMcQuaid MikeMcQuaid deleted the formula-api branch November 8, 2024 08:54
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.

4 participants