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

[spaceship] add visionOS support for Connect API #21929

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion deliver/lib/deliver/options.rb
Expand Up @@ -99,7 +99,7 @@ def self.available_options
optional: true,
default_value: "ios",
verify_block: proc do |value|
UI.user_error!("The platform can only be ios, appletvos, or osx") unless %('ios', 'appletvos', 'osx').include?(value)
UI.user_error!("The platform can only be ios, appletvos, xros or osx") unless %('ios', 'appletvos', 'xros', 'osx').include?(value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the supported platform name here be xros or visionos?

I’m thinking it should be the latter, as xrOS is just a leftover from the beta period before Apple decided on / communicated the visionOS name, so it’s effectively superseded by visionOS (even though it’s of course still used internally by Xcode SDKs).

It would definitely feel more natural to me to write platform :visionos do ... than to use :xros, but so this is not a question specific to Deliver but a general Fastlane question.

end),

# live version
Expand Down
4 changes: 2 additions & 2 deletions deliver/lib/deliver/runner.rb
Expand Up @@ -172,7 +172,7 @@ def verify_binary
transporter = transporter_for_selected_team

case platform
when "ios", "appletvos"
when "ios", "appletvos", "xros"
package_path = FastlaneCore::IpaUploadPackageBuilder.new.generate(
app_id: Deliver.cache[:app].id,
ipa_path: ipa_path,
Expand Down Expand Up @@ -209,7 +209,7 @@ def upload_binary
transporter = transporter_for_selected_team

case platform
when "ios", "appletvos"
when "ios", "appletvos", "xros"
package_path = FastlaneCore::IpaUploadPackageBuilder.new.generate(
app_id: Deliver.cache[:app].id,
ipa_path: ipa_path,
Expand Down
28 changes: 28 additions & 0 deletions deliver/spec/runner_spec.rb
Expand Up @@ -82,6 +82,20 @@ def provider_ids
end
end

describe 'with an IPA file for visionOS' do
before do
options[:platform] = 'xros'
end

it 'uploads the IPA for the visionOS platform' do
expect_any_instance_of(FastlaneCore::IpaUploadPackageBuilder).to receive(:generate)
.with(app_id: 'YI8C2AS', ipa_path: 'ACME.ipa', package_path: '/tmp', platform: 'xros')
.and_return('path')
expect(transporter).to receive(:upload).with(package_path: 'path', asset_path: 'ACME.ipa', platform: 'xros').and_return(true)
runner.upload_binary
end
end

describe 'with a PKG file for macOS' do
before do
options[:platform] = 'osx'
Expand Down Expand Up @@ -129,6 +143,20 @@ def provider_ids
end
end

describe 'with an IPA file for visionOS' do
before do
options[:platform] = 'xros'
end

it 'verifies the IPA for the visionOS platform' do
expect_any_instance_of(FastlaneCore::IpaUploadPackageBuilder).to receive(:generate)
.with(app_id: 'YI8C2AS', ipa_path: 'ACME.ipa', package_path: '/tmp', platform: 'xros')
.and_return('path')
expect(transporter).to receive(:verify).with(asset_path: "ACME.ipa", package_path: 'path', platform: "xros").and_return(true)
runner.verify_binary
end
end

describe 'with a PKG file for macOS' do
before do
options[:platform] = 'osx'
Expand Down
2 changes: 1 addition & 1 deletion fastlane/lib/fastlane/actions/app_store_build_number.rb
Expand Up @@ -186,7 +186,7 @@ def self.available_options
optional: true,
default_value: "ios",
verify_block: proc do |value|
UI.user_error!("The platform can only be ios, appletvos, or osx") unless %('ios', 'appletvos', 'osx').include?(value)
UI.user_error!("The platform can only be ios, appletvos, xros or osx") unless %('ios', 'appletvos', 'xros', 'osx').include?(value)
end),
FastlaneCore::ConfigItem.new(key: :team_name,
short_option: "-e",
Expand Down
Expand Up @@ -374,6 +374,7 @@ The available options:

- 'ios'
- 'appletvos'
- 'xros'
- 'osx'


Expand Down
4 changes: 2 additions & 2 deletions fastlane/lib/fastlane/actions/download_dsyms.rb
Expand Up @@ -290,7 +290,7 @@ def self.available_options
FastlaneCore::ConfigItem.new(key: :platform,
short_option: "-p",
env_name: "DOWNLOAD_DSYMS_PLATFORM",
description: "The app platform for dSYMs you wish to download (ios, appletvos)",
description: "The app platform for dSYMs you wish to download (ios, xros, appletvos)",
default_value: :ios),
FastlaneCore::ConfigItem.new(key: :version,
short_option: "-v",
Expand Down Expand Up @@ -351,7 +351,7 @@ def self.authors
end

def self.is_supported?(platform)
[:ios, :appletvos].include?(platform)
[:ios, :appletvos, :xros].include?(platform)
end

def self.example_code
Expand Down
Expand Up @@ -83,7 +83,7 @@ def self.available_options
optional: true,
default_value: "ios",
verify_block: proc do |value|
UI.user_error!("The platform can only be ios, osx, or appletvos") unless %('osx', ios', 'appletvos').include?(value)
UI.user_error!("The platform can only be ios, osx, xros or appletvos") unless %('osx', ios', 'appletvos', 'xros').include?(value)
end),
FastlaneCore::ConfigItem.new(key: :initial_build_number,
env_name: "INITIAL_BUILD_NUMBER",
Expand Down
6 changes: 3 additions & 3 deletions fastlane/lib/fastlane/actions/set_changelog.rb
Expand Up @@ -169,10 +169,10 @@ def self.available_options
end),
FastlaneCore::ConfigItem.new(key: :platform,
env_name: "FL_SET_CHANGELOG_PLATFORM",
description: "The platform of the app (ios, appletvos, mac)",
description: "The platform of the app (ios, appletvos, xros, mac)",
default_value: "ios",
verify_block: proc do |value|
available = ['ios', 'appletvos', 'mac']
available = ['ios', 'appletvos', 'xros', 'mac']
UI.user_error!("Invalid platform '#{value}', must be #{available.join(', ')}") unless available.include?(value)
end)
]
Expand All @@ -183,7 +183,7 @@ def self.authors
end

def self.is_supported?(platform)
[:ios, :appletvos, :mac].include?(platform)
[:ios, :appletvos, :xros, :mac].include?(platform)
end

def self.example_code
Expand Down
2 changes: 1 addition & 1 deletion fastlane/spec/actions_specs/set_changelog_spec.rb
Expand Up @@ -7,7 +7,7 @@
it 'raises a Fastlane error' do
expect { Fastlane::FastFile.new.parse(invalidPlatform_lane).runner.execute(:test) }.to(
raise_error(FastlaneCore::Interface::FastlaneError) do |error|
expect(error.message).to match(/Invalid platform 'whatever', must be ios, appletvos, mac/)
expect(error.message).to match(/Invalid platform 'whatever', must be ios, appletvos, xros, mac/)
end
)
end
Expand Down
5 changes: 4 additions & 1 deletion spaceship/lib/spaceship/connect_api.rb
Expand Up @@ -87,8 +87,9 @@ module Platform
MAC_OS = "MAC_OS"
TV_OS = "TV_OS"
WATCH_OS = "WATCH_OS"
VISION_OS = "VISION_OS"

ALL = [IOS, MAC_OS, TV_OS, WATCH_OS]
ALL = [IOS, MAC_OS, TV_OS, WATCH_OS, VISION_OS]

def self.map(platform)
return platform if ALL.include?(platform)
Expand All @@ -101,6 +102,8 @@ def self.map(platform)
return Spaceship::ConnectAPI::Platform::MAC_OS
when :ios
return Spaceship::ConnectAPI::Platform::IOS
when :visionos, :xros
return Spaceship::ConnectAPI::Platform::VISION_OS
else
raise "Cannot find a matching platform for '#{platform}' - valid values are #{ALL.join(', ')}"
end
Expand Down
2 changes: 1 addition & 1 deletion spaceship/lib/spaceship/tunes/application.rb
Expand Up @@ -72,7 +72,7 @@ def all
def find(identifier, mac: false)
all.find do |app|
((app.apple_id && app.apple_id.casecmp(identifier.to_s) == 0) || (app.bundle_id && app.bundle_id.casecmp(identifier.to_s) == 0)) &&
app.version_sets.any? { |v| (mac ? ["osx"] : ["ios", "appletvos"]).include?(v.platform) }
app.version_sets.any? { |v| (mac ? ["osx"] : ["ios", "xros", "appletvos"]).include?(v.platform) }
end
end

Expand Down
2 changes: 2 additions & 0 deletions spaceship/lib/spaceship/tunes/tunes_client.rb
Expand Up @@ -297,6 +297,8 @@ def applications
"appletvos"
when "MAC_OS"
"osx"
when "VISION_OS"
"xros"
when "IOS"
"ios"
else
Expand Down