Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept visionOS (in addition to visionos) as a valid platform #765

Merged
merged 1 commit into from
Feb 6, 2024
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
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

##### Bug Fixes

* None.

* Accept any casing for platform names in `Platform.new`.
[Eric Amorde](https://github.com/amorde)
[#765](https://github.com/CocoaPods/Core/pull/765)

## 1.15.0 (2024-01-28)

Expand Down
24 changes: 13 additions & 11 deletions lib/cocoapods-core/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,19 @@ def initialize(input, target = nil)
@symbolic_name = input.name
@deployment_target = input.deployment_target
else
# Allow `Platform.new('macos')` to be equivalent to `Platform.macos`
if input == 'macos'
input = 'osx'
elsif input == 'xros'
# To address the issue of the mismatch between the platform: xros in the XCFramework and the platform:
# visionos in Cocoapods.
#
# This will ensure proper alignment between the platform information in the XCFramework and Cocoapods.
input = 'visionos'
end
@symbolic_name = input.to_sym
input = input.to_s.downcase

name = case input
when 'macos'
# Allow `Platform.new('macos')` to be equivalent to `Platform.macos`
'osx'
when 'xros'
# Compatibility with older references to 'xrOS'
'visionos'
else
input
end
@symbolic_name = name.to_sym
target = target[:deployment_target] if target.is_a?(Hash)
@deployment_target = Version.create(target)
end
Expand Down
33 changes: 24 additions & 9 deletions spec/platform_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,30 @@ module Pod
@platform.name.should == :ios
end

it 'can be initialized with a string symbolic name' do
platform = Platform.new('ios')
platform.name.should == :ios
end
it 'can be initialized with a string' do
Platform.new('MACOS').should == Platform.macos
Platform.new('macOS').should == Platform.macos
Platform.new('macos').should == Platform.macos

Platform.new('iOS').should == Platform.ios
Platform.new('IOS').should == Platform.ios
Platform.new('ios').should == Platform.ios

Platform.new('tvos').should == Platform.tvos
Platform.new('tvOS').should == Platform.tvos
Platform.new('TVOS').should == Platform.tvos

Platform.new('watchOS').should == Platform.watchos
Platform.new('WATCHOS').should == Platform.watchos
Platform.new('watchos').should == Platform.watchos

it 'can be initialized with a string representing macOS' do
platform = Platform.new('macos')
platform.name.should == :osx
platform.string_name.should == 'macOS'
Platform.new('visionos').should == Platform.visionos
Platform.new('VISIONOS').should == Platform.visionos
Platform.new('visionOS').should == Platform.visionos
# Recognizes xrOS
Platform.new('xros').should == Platform.visionos
Platform.new('XROS').should == Platform.visionos
Platform.new('xrOS').should == Platform.visionos
end

it 'exposes its name as string' do
Expand Down Expand Up @@ -83,7 +98,7 @@ module Pod
Platform.new(:tvos, '9.0').to_s.should == 'tvOS 9.0'
end

it 'uses its name as its symbold version' do
it 'uses its name as its symbol version' do
@platform.to_sym.should == :ios
end

Expand Down