ARGV: Deprecate ARGV.collect_build_args

This commit is contained in:
Gautham G 2020-03-24 19:44:05 +05:30
parent 6530e333b3
commit 7ad6dab288
3 changed files with 38 additions and 20 deletions

View File

@ -68,6 +68,19 @@ module Homebrew
named.blank?
end
# If the user passes any flags that trigger building over installing from
# a bottle, they are collected here and returned as an Array for checking.
def collect_build_args
build_flags = []
build_flags << "--HEAD" if head
build_flags << "--universal" if build_universal
build_flags << "--build-bottle" if build_bottle
build_flags << "--build-from-source" if build_from_source
build_flags
end
def formulae
require "formula"
@formulae ||= (downcased_unique_named - casks).map do |name|
@ -160,11 +173,33 @@ module Homebrew
end
def head
(args_parsed && HEAD?) || cmdline_args.include?("--HEAD")
return true if args_parsed && HEAD?
cmdline_args.include?("--HEAD")
end
def devel
(args_parsed && devel?) || cmdline_args.include?("--devel")
return true if args_parsed && devel?
cmdline_args.include?("--devel")
end
def build_universal
return true if args_parsed && universal?
cmdline_args.include?("--universal")
end
def build_bottle
return true if args_parsed && build_bottle?
cmdline_args.include?("--build-bottle")
end
def build_from_source
return true if args_parsed && (build_from_source? || s?)
cmdline_args.include?("--build-from-source") || cmdline_args.include?("-s")
end
def spec(default = :stable)

View File

@ -47,10 +47,6 @@ module HomebrewArgvExtension
!(include?("--HEAD") || include?("--devel"))
end
def build_universal?
include? "--universal"
end
def build_bottle?
include?("--build-bottle")
end
@ -84,19 +80,6 @@ module HomebrewArgvExtension
value "env"
end
# If the user passes any flags that trigger building over installing from
# a bottle, they are collected here and returned as an Array for checking.
def collect_build_flags
build_flags = []
build_flags << "--HEAD" if include?("--HEAD")
build_flags << "--universal" if build_universal?
build_flags << "--build-bottle" if build_bottle?
build_flags << "--build-from-source" if build_from_source?
build_flags
end
private
def options_only

View File

@ -80,7 +80,7 @@ class FormulaInstaller
# it's necessary to interrupt the user before any sort of installation
# can proceed. Only invoked when the user has no developer tools.
def self.prevent_build_flags
build_flags = ARGV.collect_build_flags
build_flags = Homebrew.args.collect_build_args
return if build_flags.empty?
all_bottled = ARGV.formulae.all?(&:bottled?)