Class: CompilerSelector Private

Inherits:
Object show all
Includes:
CompilerConstants
Defined in:
extend/os/linux/compilers.rb,
compilers.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

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. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

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

Constants included from CompilerConstants

CompilerConstants::COMPILERS, CompilerConstants::COMPILER_SYMBOL_MAP, CompilerConstants::GNU_GCC_REGEXP, CompilerConstants::GNU_GCC_VERSIONS

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. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns a new instance of CompilerSelector.



119
120
121
122
123
124
# File 'compilers.rb', line 119

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. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



117
118
119
# File 'compilers.rb', line 117

def compilers
  @compilers
end

#failuresObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



117
118
119
# File 'compilers.rb', line 117

def failures
  @failures
end

#formulaObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



117
118
119
# File 'compilers.rb', line 117

def formula
  @formula
end

#versionsObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



117
118
119
# File 'compilers.rb', line 117

def versions
  @versions
end

Class Method Details

.compilersObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



113
114
115
# File 'compilers.rb', line 113

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

.preferred_gccString

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



6
7
8
# File 'extend/os/linux/compilers.rb', line 6

def self.preferred_gcc
  OS::LINUX_PREFERRED_GCC_COMPILER_FORMULA
end

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

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



109
110
111
# File 'compilers.rb', line 109

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. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



126
127
128
129
# File 'compilers.rb', line 126

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