Class: CompilerSelector Private

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/compilers.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class for selecting a compiler for a formula.

Defined Under Namespace

Classes: Compiler

Constant Summary collapse

COMPILER_PRIORITY =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  clang: [:clang, :gnu, :llvm_clang],
  gcc:   [:gnu, :gcc, :llvm_clang, :clang],
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formula, versions, compilers) ⇒ CompilerSelector

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CompilerSelector.


99
100
101
102
103
104
# File 'Library/Homebrew/compilers.rb', line 99

def initialize(formula, versions, compilers)
  @formula = formula
  @failures = formula.compiler_failures
  @versions = versions
  @compilers = compilers
end

Instance Attribute Details

#compilersObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


97
98
99
# File 'Library/Homebrew/compilers.rb', line 97

def compilers
  @compilers
end

#failuresObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


97
98
99
# File 'Library/Homebrew/compilers.rb', line 97

def failures
  @failures
end

#formulaObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


97
98
99
# File 'Library/Homebrew/compilers.rb', line 97

def formula
  @formula
end

#versionsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


97
98
99
# File 'Library/Homebrew/compilers.rb', line 97

def versions
  @versions
end

Class Method Details

.compilersObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


93
94
95
# File 'Library/Homebrew/compilers.rb', line 93

def self.compilers
  COMPILER_PRIORITY.fetch(DevelopmentTools.default_compiler)
end

.select_for(formula, compilers = self.compilers) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


89
90
91
# File 'Library/Homebrew/compilers.rb', line 89

def self.select_for(formula, compilers = self.compilers)
  new(formula, DevelopmentTools, compilers).compiler
end

Instance Method Details

#compilerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


106
107
108
109
# File 'Library/Homebrew/compilers.rb', line 106

def compiler
  find_compiler { |c| return c.name unless fails_with?(c) }
  raise CompilerSelectionError, formula
end