Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ module DevCmd
module Bottle
sig { returns(T::Array[String]) }
def tar_args
if MacOS.version >= :catalina
["--no-mac-metadata", "--no-acls", "--no-xattrs"].freeze
else
[].freeze
end
["--no-mac-metadata", "--no-acls", "--no-xattrs"].freeze
end

sig { params(gnu_tar_formula: Formula).returns(String) }
Expand Down
9 changes: 1 addition & 8 deletions Library/Homebrew/os/mac.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@ def self.active_developer_dir

sig { returns(T::Boolean) }
def self.sdk_root_needed?
if MacOS::CLT.installed?
# If there's no CLT SDK, return false
return false unless MacOS::CLT.provides_sdk?
# If the CLT is installed and headers are provided by the system, return false
return false unless MacOS::CLT.separate_header_package?
end

true
end

Expand All @@ -122,7 +115,7 @@ def self.sdk_root_needed?

sig { returns(T.any(CLTSDKLocator, XcodeSDKLocator)) }
def self.sdk_locator
if CLT.installed? && CLT.provides_sdk?
if CLT.installed?
CLT.sdk_locator
else
Xcode.sdk_locator
Expand Down
11 changes: 1 addition & 10 deletions Library/Homebrew/os/mac/sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,11 @@ def source

private

# While CLT SDKs existed prior to Xcode 10, those packages also
# installed a traditional Unix-style header layout and we prefer
# using that.
# As of Xcode 10, the Unix-style headers are installed via a
# separate package, so we can't rely on their being present.
# This will only look up SDKs on Xcode 10 or newer and still
# return `nil` SDKs for Xcode 9 and older.
sig { override.returns(String) }
def sdk_prefix
@sdk_prefix ||= if CLT.provides_sdk?
"#{CLT::PKG_PATH}/SDKs"
else
""
end
@sdk_prefix ||= "#{CLT::PKG_PATH}/SDKs"
end
end
end
Expand Down
27 changes: 4 additions & 23 deletions Library/Homebrew/os/mac/xcode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,6 @@ def self.detect_version

xcode_version = xcodebuild_output[/Xcode (\d+(\.\d+)*)/, 1]
return xcode_version if xcode_version

# Xcode 2.x's xcodebuild has a different version string
case xcodebuild_output[/DevToolsCore-(\d+\.\d)/, 1]
when "798.0" then return "2.5"
when "515.0" then return "2.0"
end
end
end

Expand All @@ -226,17 +220,6 @@ def self.detect_version_from_clang_version(version = ::DevelopmentTools.clang_ve
# simultaneously so workarounds need to apply to both based on their
# comparable version.
case version
when "6.0.0" then "6.2"
when "6.1.0" then "6.4"
when "7.0.0" then "7.1"
when "7.0.2" then "7.2.1"
when "7.3.0" then "7.3.1"
when "8.0.0" then "8.2.1"
when "8.1.0" then "8.3.3"
when "9.0.0" then "9.2"
when "9.1.0" then "9.4.1"
when "10.0.0" then "10.1"
when "10.0.1" then "10.3"
when "11.0.0" then "11.3.1"
when "11.0.3" then "11.7"
when "12.0.0" then "12.4"
Expand All @@ -259,6 +242,8 @@ def self.default_prefix?

# Helper module for querying macOS Command Line Tools information.
module CLT
extend Utils::Output::Mixin

# The original Mavericks CLT package ID
EXECUTABLE_PKG_ID = "com.apple.pkg.CLTools_Executables"
MAVERICKS_NEW_PKG_ID = "com.apple.pkg.CLTools_Base" # obsolete
Expand All @@ -272,12 +257,8 @@ def self.installed?

sig { returns(T::Boolean) }
def self.separate_header_package?
version >= "10" && MacOS.version >= "10.14"
end

sig { returns(T::Boolean) }
def self.provides_sdk?
version >= "8"
odeprecated "MacOS::CLT.separate_header_package?"
true
end

sig { returns(CLTSDKLocator) }
Expand Down
25 changes: 2 additions & 23 deletions Library/Homebrew/test/os/mac_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,9 @@
described_class.sdk_path_if_needed
end

it "does not call sdk_path on Xcode-and-CLT systems with system headers" do
allow(OS::Mac::Xcode).to receive(:installed?).and_return(true)
allow(OS::Mac::CLT).to receive_messages(installed?: true, separate_header_package?: false)
expect(described_class).not_to receive(:sdk_path)
described_class.sdk_path_if_needed
end

it "does not call sdk_path on CLT-only systems with no CLT SDK" do
allow(OS::Mac::Xcode).to receive(:installed?).and_return(false)
allow(OS::Mac::CLT).to receive_messages(installed?: true, provides_sdk?: false)
expect(described_class).not_to receive(:sdk_path)
described_class.sdk_path_if_needed
end

it "does not call sdk_path on CLT-only systems with a CLT SDK if the system provides headers" do
allow(OS::Mac::Xcode).to receive(:installed?).and_return(false)
allow(OS::Mac::CLT).to receive_messages(installed?: true, provides_sdk?: true, separate_header_package?: false)
expect(described_class).not_to receive(:sdk_path)
described_class.sdk_path_if_needed
end

it "calls sdk_path on CLT-only systems with a CLT SDK if the system does not provide headers" do
it "calls sdk_path on CLT-only systems" do
allow(OS::Mac::Xcode).to receive(:installed?).and_return(false)
allow(OS::Mac::CLT).to receive_messages(installed?: true, provides_sdk?: true, separate_header_package?: true)
allow(OS::Mac::CLT).to receive_messages(installed?: true)
expect(described_class).to receive(:sdk_path)
described_class.sdk_path_if_needed
end
Expand Down
Loading