Skip to content

Commit

Permalink
Add visionOS as a new platform
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieldonadel committed Jun 26, 2023
1 parent 40a99f4 commit 026c08f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/cocoapods/command/spec/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def spec_template(data)
# spec.osx.deployment_target = "10.7"
# spec.watchos.deployment_target = "2.0"
# spec.tvos.deployment_target = "9.0"
# spec.visionos.deployment_target = "1.0"
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
Expand Down
1 change: 1 addition & 0 deletions lib/cocoapods/generator/copy_resources_script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def generate
:osx => Version.new('10.8'),
:watchos => Version.new('2.0'),
:tvos => Version.new('9.0'),
:visionos => Version.new('1.0'),
}

# @return [Boolean] Whether the external strings file is supported by the
Expand Down
2 changes: 1 addition & 1 deletion lib/cocoapods/installer/base_install_hooks_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class UmbrellaTargetDescription
#
attr_reader :specs

# @return [Symbol] The platform (either `:ios`, `:watchos`, `:tvos`, or `:osx`).
# @return [Symbol] The platform (either `:ios`, `:watchos`, `:tvos`, `:visionos`, or `:osx`).
#
attr_reader :platform_name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,7 @@ def create_build_phase_to_symlink_header_folders(native_target)
:osx => Version.new('10.8'),
:watchos => Version.new('2.0'),
:tvos => Version.new('9.0'),
:visionos => Version.new('1.0'),
}.freeze

# Returns the compiler flags for the source files of the given specification.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,13 @@ def prepare(sandbox, project, pod_targets, build_configurations, platforms, podf
ios_deployment_target = platforms.select { |p| p.name == :ios }.map(&:deployment_target).min
watchos_deployment_target = platforms.select { |p| p.name == :watchos }.map(&:deployment_target).min
tvos_deployment_target = platforms.select { |p| p.name == :tvos }.map(&:deployment_target).min
visionos_deployment_target = platforms.select { |p| p.name == :visionos }.map(&:deployment_target).min
project.build_configurations.each do |build_configuration|
build_configuration.build_settings['MACOSX_DEPLOYMENT_TARGET'] = osx_deployment_target.to_s if osx_deployment_target
build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ios_deployment_target.to_s if ios_deployment_target
build_configuration.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = watchos_deployment_target.to_s if watchos_deployment_target
build_configuration.build_settings['TVOS_DEPLOYMENT_TARGET'] = tvos_deployment_target.to_s if tvos_deployment_target
build_configuration.build_settings['XROS_DEPLOYMENT_TARGET'] = visionos_deployment_target.to_s if visionos_deployment_target
build_configuration.build_settings['STRIP_INSTALLED_PRODUCT'] = 'NO'
build_configuration.build_settings['CLANG_ENABLE_OBJC_ARC'] = 'YES'
build_configuration.build_settings['CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED'] = 'YES'
Expand Down
5 changes: 5 additions & 0 deletions lib/cocoapods/validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ def results_message
platform_message = '[watchOS] '
elsif result.platforms == [:tvos]
platform_message = '[tvOS] '
elsif result.platforms == [:visionos]
platform_message = '[visionOS] '
end

subspecs_message = ''
Expand Down Expand Up @@ -1104,6 +1106,9 @@ def xcodebuild(action, scheme, configuration, deployment_target:)
when :tvos
command += %w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator)
command += Fourflusher::SimControl.new.destination(:oldest, 'tvOS', deployment_target)
when :visionos
command += %w(CODE_SIGN_IDENTITY=- -sdk xrsimulator)
command += Fourflusher::SimControl.new.destination(:oldest, 'visionOS', deployment_target)
end

if analyze
Expand Down
3 changes: 3 additions & 0 deletions spec/functional/command/repo/push_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ module Pod
Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, true, [], false, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, true, [], false, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, true, [], false, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:visionos, nil, true, [], false, nil).twice.returns(stub('Podfile'))

cmd = command('repo', 'push', 'master')
# Git push will throw an exception here since this is a local custom git repo. All we care is the validator
Expand All @@ -232,6 +233,7 @@ module Pod
Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, false, [], false, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, false, [], false, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, false, [], false, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:visionos, nil, false, [], false, nil).twice.returns(stub('Podfile'))

cmd = command('repo', 'push', 'master', '--use-libraries')
# Git push will throw an exception here since this is a local custom git repo. All we care is the validator
Expand All @@ -246,6 +248,7 @@ module Pod
Validator.any_instance.expects(:podfile_from_spec).with(:osx, nil, false, [], true, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:watchos, nil, false, [], true, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:tvos, nil, false, [], true, nil).twice.returns(stub('Podfile'))
Validator.any_instance.expects(:podfile_from_spec).with(:visionos, nil, false, [], true, nil).twice.returns(stub('Podfile'))

cmd = command('repo', 'push', 'master', '--use-libraries', '--use-modular-headers')
# Git push will throw an exception here since this is a local custom git repo. All we care is the validator
Expand Down
9 changes: 5 additions & 4 deletions spec/unit/validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ def podspec_path(name = 'JSONKit', version = '1.4', source = nil)
file = write_podspec(stub_podspec)
validator = Validator.new(file, config.sources_manager.master.map(&:url))
validator.stubs(:validate_url)
validator.expects(:install_pod).times(4)
validator.expects(:build_pod).times(4)
validator.expects(:add_app_project_import).times(4)
validator.expects(:check_file_patterns).times(4)
validator.expects(:install_pod).times(5)
validator.expects(:build_pod).times(5)
validator.expects(:add_app_project_import).times(5)
validator.expects(:check_file_patterns).times(5)
validator.validate
end

Expand Down Expand Up @@ -608,6 +608,7 @@ def podspec_path(name = 'JSONKit', version = '1.4', source = nil)
validator.expects(:podfile_from_spec).with(:ios, nil, false, [], nil, nil).once.returns(stub('Podfile'))
validator.expects(:podfile_from_spec).with(:ios, '7.0', false, [], nil, nil).once.returns(stub('Podfile'))
validator.expects(:podfile_from_spec).with(:tvos, nil, false, [], nil, nil).once.returns(stub('Podfile'))
validator.expects(:podfile_from_spec).with(:visionos, nil, false, [], nil, nil).once.returns(stub('Podfile'))
validator.expects(:podfile_from_spec).with(:watchos, nil, false, [], nil, nil).once.returns(stub('Podfile'))
validator.send(:perform_extensive_analysis, validator.spec)

Expand Down

0 comments on commit 026c08f

Please sign in to comment.