Merge pull request #7786 from vladimyr/std_cargo_args
formula: add std_cargo_args
This commit is contained in:
		
						commit
						550ba8b193
					
				@ -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"
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user