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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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