Class: CompilerFailure Private

Inherits:
Object show all
Defined in:
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 checking compiler compatibility for a formula.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#typeSymbol (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.

Returns:



22
23
24
# File 'compilers.rb', line 22

def type
  @type
end

Class Method Details

.create(spec, &block) ⇒ T.attached_class

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.

Parameters:

Returns:

  • (T.attached_class)


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'compilers.rb', line 41

def self.create(spec, &block)
  # Non-Apple compilers are in the format fails_with compiler => version
  if spec.is_a?(Hash)
    compiler, major_version = spec.first
    raise ArgumentError, "The `fails_with` hash syntax only supports GCC" if compiler != :gcc

    type = compiler
    # so `fails_with gcc: "7"` simply marks all 7 releases incompatible
    version = "#{major_version}.999"
    exact_major_match = true
  else
    type = spec
    version = 9999
    exact_major_match = false
  end
  new(type, version, exact_major_match:, &block)
end

Instance Method Details

#cause(_) ⇒ void

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.

This method returns an undefined value.

The cause is no longer used so we need not hold a reference to the string.

Parameters:



36
# File 'compilers.rb', line 36

def cause(_); end

#fails_with?(compiler) ⇒ Boolean

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.

Parameters:

Returns:

  • (Boolean)


60
61
62
63
64
65
66
67
68
69
# File 'compilers.rb', line 60

def fails_with?(compiler)
  version_matched = if type != :gcc
    version >= compiler.version
  elsif @exact_major_match
    gcc_major(version) == gcc_major(compiler.version) && version >= compiler.version
  else
    gcc_major(version) >= gcc_major(compiler.version)
  end
  type == compiler.type && version_matched
end

#version(val = T.unsafe(nil)) ⇒ Version Also known as: build

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.

Parameters:

  • val (Integer, String) (defaults to: T.unsafe(nil))

Returns:



25
26
27
28
# File 'compilers.rb', line 25

def version(val = T.unsafe(nil))
  @version = Version.parse(val.to_s) if val
  @version
end