Module: EnvActivation Private

Includes:
EnvSensitive, SharedEnvExtension
Included in:
ENV, Sorbet::Private::Static::ENVClass
Defined in:
extend/ENV.rb,
extend/ENV.rbi

Overview

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

Constant Summary

Constants included from CompilerConstants

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

Instance Attribute Summary

Attributes included from SharedEnvExtension

#bottle_arch, #build_bottle

Instance Method Summary collapse

Methods included from SharedEnvExtension

#[]=, #append, #append_path, #append_to_cccfg, #append_to_cflags, #append_to_rustflags, #cc, #cflags, #compiler, #cppflags, #cxx, #cxxflags, #effective_arch, #fc, #fcflags, #fflags, #fortran, #ldflags, #make_jobs, #permit_arch_flags, #prepend, #prepend_create_path, #prepend_path, #refurbish_args, #remove, #remove_cc_etc, #remove_from_cflags, #setup_build_environment

Methods included from Utils::Output::Mixin

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_outdated, #pretty_uninstalled, #pretty_upgradable

Methods included from OS::Linux::SharedEnvExtension

#effective_arch

Methods included from OS::Mac::SharedEnvExtension

#setup_build_environment

Methods included from EnvSensitive

#clear_sensitive_environment!, #clear_sensitive_environment_for_eval!, #sensitive?, #sensitive_environment

Instance Method Details

#activate_extensions!(env: nil) ⇒ 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.

Parameters:

  • env (String, nil) (defaults to: nil)


25
26
27
28
29
30
31
# File 'extend/ENV.rb', line 25

def activate_extensions!(env: nil)
  if superenv?(env)
    extend(Superenv)
  else
    extend(Stdenv)
  end
end

#with_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil, debug_symbols: false, &_block) ⇒ T.type_parameter(:U)

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:

  • env (String, nil) (defaults to: nil)
  • cc (String, nil) (defaults to: nil)
  • build_bottle (Boolean) (defaults to: false)
  • bottle_arch (String, nil) (defaults to: nil)
  • debug_symbols (Boolean, nil) (defaults to: false)
  • _block (T.proc.returns(T.type_parameter(:U)))

Returns:

  • (T.type_parameter(:U))


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'extend/ENV.rb', line 43

def with_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil, debug_symbols: false, &_block)
  old_env = to_hash.dup
  tmp_env = to_hash.dup.extend(EnvActivation)
  T.cast(tmp_env, EnvActivation).activate_extensions!(env:)
  T.cast(tmp_env, T.any(Superenv, Stdenv))
   .setup_build_environment(cc:, build_bottle:, bottle_arch:,
                            debug_symbols:)
  replace(tmp_env)

  begin
    yield
  ensure
    replace(old_env)
  end
end