Skip to content

Commit 74dbbb9

Browse files
authored
Merge pull request #21169 from Homebrew/deprecate-needs-dsl
Deprecate `Formula#needs` and remove `needs :openmp` support
2 parents 0b75cf0 + b6643c2 commit 74dbbb9

File tree

3 files changed

+8
-29
lines changed

3 files changed

+8
-29
lines changed

Library/Homebrew/compilers.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ def version(val = T.unsafe(nil))
3535
sig { params(_: String).void }
3636
def cause(_); end
3737

38-
sig { params(standard: Symbol).returns(T::Array[CompilerFailure]) }
39-
def self.for_standard(standard)
40-
COLLECTIONS.fetch(standard) do
41-
raise ArgumentError, "\"#{standard}\" is not a recognized standard"
42-
end
43-
end
44-
4538
sig {
4639
params(spec: T.any(Symbol, T::Hash[Symbol, String]), block: T.nilable(T.proc.void)).returns(T.attached_class)
4740
}
@@ -101,13 +94,6 @@ def initialize(type, version, exact_major_match:, &block)
10194
def gcc_major(version)
10295
Version.new(version.major.to_s)
10396
end
104-
105-
COLLECTIONS = T.let({
106-
openmp: [
107-
create(:clang),
108-
],
109-
}.freeze, T::Hash[Symbol, T::Array[CompilerFailure]])
110-
private_constant :COLLECTIONS
11197
end
11298

11399
# Class for selecting a compiler for a formula.

Library/Homebrew/formula.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4381,20 +4381,20 @@ def fails_with(compiler, &block)
43814381
specs.each { |spec| spec.fails_with(compiler, &block) }
43824382
end
43834383

4384-
# Marks the {Formula} as needing a certain standard, so Homebrew
4385-
# will fall back to other compilers if the default compiler
4386-
# does not implement that standard.
4384+
# Used to mark the {Formula} as needing a certain standard, so Homebrew
4385+
# would fall back to other compilers if the default compiler
4386+
# did not implement that standard.
43874387
#
4388-
# We generally prefer to {.depends_on} a desired compiler and to
4389-
# explicitly use that compiler in a formula's {#install} block,
4388+
# This is now a no-op as we prefer to {.depends_on} a desired compiler
4389+
# and explicitly use that compiler in a formula's {#install} block,
43904390
# rather than implicitly finding a suitable compiler with `needs`.
43914391
#
43924392
# @see .fails_with
43934393
#
43944394
# @api public
4395-
sig { params(standards: Symbol).void }
4396-
def needs(*standards)
4397-
specs.each { |spec| spec.needs(*standards) }
4395+
sig { params(_standards: Symbol).void }
4396+
def needs(*_standards)
4397+
odeprecated "`needs :openmp`", '`depends_on "gcc"`'
43984398
end
43994399

44004400
# A test is required for new formulae and makes us happy.

Library/Homebrew/software_spec.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,6 @@ def fails_with(compiler, &block)
323323
compiler_failures << CompilerFailure.create(compiler, &block)
324324
end
325325

326-
sig { params(standards: Symbol).void }
327-
def needs(*standards)
328-
standards.each do |standard|
329-
compiler_failures.concat CompilerFailure.for_standard(standard)
330-
end
331-
end
332-
333326
sig { params(dep: Dependable).void }
334327
def add_dep_option(dep)
335328
dep.option_names.each do |name|

0 commit comments

Comments
 (0)