2024-08-12 10:30:59 +01:00
|
|
|
# typed: true # rubocop:disable Sorbet/StrictSigil
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-10-10 17:53:31 +02:00
|
|
|
require "system_command"
|
|
|
|
|
2024-09-21 12:24:21 -07:00
|
|
|
module OS
|
|
|
|
module Mac
|
|
|
|
module SystemConfig
|
|
|
|
sig { returns(String) }
|
|
|
|
def describe_clang
|
|
|
|
return "N/A" if ::SystemConfig.clang.null?
|
|
|
|
|
|
|
|
clang_build_info = ::SystemConfig.clang_build.null? ? "(parse error)" : ::SystemConfig.clang_build
|
|
|
|
"#{::SystemConfig.clang} build #{clang_build_info}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
SystemConfig.prepend(OS::Mac::SystemConfig)
|
|
|
|
|
2020-08-19 07:35:50 +02:00
|
|
|
module SystemConfig
|
2016-04-25 18:01:15 +01:00
|
|
|
class << self
|
2020-10-10 17:53:31 +02:00
|
|
|
include SystemCommand::Mixin
|
|
|
|
|
2018-04-07 20:28:56 +01:00
|
|
|
def xcode
|
|
|
|
@xcode ||= if MacOS::Xcode.installed?
|
|
|
|
xcode = MacOS::Xcode.version.to_s
|
|
|
|
xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix?
|
|
|
|
xcode
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def clt
|
2019-02-19 13:11:32 +00:00
|
|
|
@clt ||= MacOS::CLT.version if MacOS::CLT.installed?
|
2018-04-07 20:28:56 +01:00
|
|
|
end
|
|
|
|
|
2023-12-21 22:54:38 -08:00
|
|
|
def core_tap_config(out = $stdout)
|
|
|
|
dump_tap_config(CoreTap.instance, out)
|
|
|
|
dump_tap_config(CoreCaskTap.instance, out)
|
|
|
|
end
|
|
|
|
|
2023-03-10 23:46:07 +00:00
|
|
|
def dump_verbose_config(out = $stdout)
|
|
|
|
dump_generic_verbose_config(out)
|
|
|
|
out.puts "macOS: #{MacOS.full_version}-#{kernel}"
|
|
|
|
out.puts "CLT: #{clt || "N/A"}"
|
|
|
|
out.puts "Xcode: #{xcode || "N/A"}"
|
|
|
|
out.puts "Rosetta 2: #{Hardware::CPU.in_rosetta2?}" if Hardware::CPU.physical_cpu_arm64?
|
2016-04-25 18:01:15 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|