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: Allow cargo build when building libraries #12819

Merged
merged 1 commit into from Feb 1, 2022

Conversation

rolandcrosby
Copy link

  • 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?

When building Rust packages that provide libraries but no executable binaries, cargo install doesn't do anything; you need to use cargo build and install any libraries manually. See e.g. rust-lang/cargo#8294.

Unfortunately, Homebrew's Rubocop "use "cargo", "install", *std_cargo_args" rule, as currently written, blocks all invocations of cargo build. This is blocking Homebrew/homebrew-core#94091 and will prevent formulas for being created for any library-only Rust packages that use cargo to build.

This commit changes that rule to allow invocations of cargo build that use the --lib argument (--lib specifies to Cargo that a package's library targets should be built). This will enable library packages to be built, while retaining the "use "cargo", "install", *std_cargo_args" message for the more common case when a Rust package provides executable binaries.

When building Rust packages that provide libraries but no executable
binaries, `cargo install` doesn't do anything; you need to use `cargo
build` and install any libraries manually. See e.g.
rust-lang/cargo#8294.

Unfortunately, Homebrew's Rubocop "use cargo install *std_cargo_args"
rule, as currently written, blocks all invocations of `cargo build`.
This commit changes that rule to exclude invocations of `cargo build`
that use the `--lib` argument (`--lib` specifies to Cargo that a
package's library targets should be built). This will enable library
packages to be built while retaining the "use cargo install
*std_cargo_args" message for the more common case when a Rust package
provides executable binaries.
@rolandcrosby
Copy link
Author

Rebased to see if that fixes the coverage check's spurious complaint about reduced coverage.

@MikeMcQuaid MikeMcQuaid added the critical Critical change which should be shipped as soon as possible. label Feb 1, 2022
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.

Thanks so much for your great, first contribution! Without people like you submitting PRs we couldn't run this project. You rock, @rolandcrosby!

@MikeMcQuaid MikeMcQuaid merged commit 7a31b3b into Homebrew:master Feb 1, 2022
@github-actions github-actions bot added the outdated PR was locked due to age label Mar 4, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
critical Critical change which should be shipped as soon as possible. outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants