formula: add std_cargo_args

This commit is contained in:
Dario Vladovic 2020-06-22 13:24:41 +02:00
parent a89b56598b
commit 8a62f891e1
No known key found for this signature in database
GPG Key ID: 87F43AAF74B61286
4 changed files with 10 additions and 3 deletions

View File

@ -1354,6 +1354,11 @@ class Formula
"#<Formula #{name} (#{active_spec_sym}) #{path}>"
end
# Standard parameters for cargo builds.
def std_cargo_args
["--locked", "--root", prefix, "--path", "."]
end
# Standard parameters for CMake builds.
# Setting `CMAKE_FIND_FRAMEWORK` to "LAST" tells CMake to search for our
# libraries before trying to utilize Frameworks, many of which will be from
@ -1930,6 +1935,8 @@ class Formula
case cmd
when "./configure"
pretty_args -= %w[--disable-dependency-tracking --disable-debug --disable-silent-rules]
when "cargo"
pretty_args -= std_cargo_args
when "cmake"
pretty_args -= std_cmake_args
when "go"

View File

@ -175,7 +175,7 @@ module Homebrew
bin.install libexec/"bin/\#{name}"
bin.env_script_all_files(libexec/"bin", :GEM_HOME => ENV["GEM_HOME"])
<% elsif mode == :rust %>
system "cargo", "install", "--locked", "--root", prefix, "--path", "."
system "cargo", "install", *std_cargo_args
<% else %>
# Remove unrecognized options if warned by configure
system "./configure", "--disable-debug",

View File

@ -60,7 +60,7 @@ module RuboCop
end
find_method_with_args(body_node, :system, "cargo", "build") do
problem "use \"cargo\", \"install\", \"--root\", prefix, \"--path\", \".\""
problem "use \"cargo\", \"install\", *std_cargo_args"
end
end
end

View File

@ -210,7 +210,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install
system "cargo", "build"
^^^^^^^^^^^^^^^^^^^^^^^ use \"cargo\", \"install\", \"--root\", prefix, \"--path\", \".\"
^^^^^^^^^^^^^^^^^^^^^^^ use \"cargo\", \"install\", *std_cargo_args
end
end
RUBY