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

[match][sigh] add support for Apple Silicon Macs in iOS/iPadOS provisioning profiles #20676

Merged
merged 7 commits into from Nov 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions match/lib/match/generator.rb
Expand Up @@ -90,6 +90,7 @@ def self.generate_provisioning_profile(params: nil, prov_type: nil, certificate_
template_name: params[:template_name],
fail_on_name_taken: params[:fail_on_name_taken],
include_all_certificates: params[:include_all_certificates],
include_mac_in_profiles: params[:include_mac_in_profiles],
}

values[:platform] = params[:platform]
Expand Down
5 changes: 5 additions & 0 deletions match/lib/match/options.rb
Expand Up @@ -253,6 +253,11 @@ def self.available_options
description: "Renew the provisioning profiles if the device count on the developer portal has changed. Ignored for profile types 'appstore' and 'developer_id'",
type: Boolean,
default_value: false),
FastlaneCore::ConfigItem.new(key: :include_mac_in_profiles,
env_name: "INCLUDE_MAC_IN_PROFILES",
PinkidG marked this conversation as resolved.
Show resolved Hide resolved
description: "Include Apple Silicon Mac devices in provisioning profiles for iOS/iPadOS apps",
type: Boolean,
default_value: false),
FastlaneCore::ConfigItem.new(key: :include_all_certificates,
env_name: "MATCH_INCLUDE_ALL_CERTIFICATES",
description: "Include all matching certificates in the provisioning profile. Works only for the 'development' provisioning profile type",
Expand Down
7 changes: 5 additions & 2 deletions match/lib/match/runner.rb
Expand Up @@ -336,7 +336,7 @@ def should_force_include_all_devices(params: nil, prov_type: nil, profile: nil,

prov_types_without_devices = [:appstore, :developer_id]
if !prov_types_without_devices.include?(prov_type) && !params[:force]
force = device_count_different?(profile: profile, keychain_path: keychain_path, platform: params[:platform].to_sym)
force = device_count_different?(profile: profile, keychain_path: keychain_path, platform: params[:platform].to_sym, include_mac_in_profiles: params[:include_mac_in_profiles])
else
# App Store provisioning profiles don't contain device identifiers and
# thus shouldn't be renewed if the device count has changed.
Expand All @@ -347,7 +347,7 @@ def should_force_include_all_devices(params: nil, prov_type: nil, profile: nil,
return force
end

def device_count_different?(profile: nil, keychain_path: nil, platform: nil)
def device_count_different?(profile: nil, keychain_path: nil, platform: nil, include_mac_in_profiles: false)
return false unless profile

parsed = FastlaneCore::ProvisioningProfile.parse(profile, keychain_path)
Expand Down Expand Up @@ -379,6 +379,9 @@ def device_count_different?(profile: nil, keychain_path: nil, platform: nil)
else
[]
end
if platform == :ios && include_mac_in_profiles
device_classes += [Spaceship::ConnectAPI::Device::DeviceClass::APPLE_SILICON_MAC]
end

devices = Spaceship::ConnectAPI::Device.all
unless device_classes.empty?
Expand Down
5 changes: 5 additions & 0 deletions sigh/lib/sigh/options.rb
Expand Up @@ -47,6 +47,11 @@ def self.available_options
is_string: false,
short_option: "-f",
default_value: false),
FastlaneCore::ConfigItem.new(key: :include_mac_in_profiles,
env_name: "SIGH_INCLUDE_MAC_IN_PROFILES",
description: "Include Apple Silicon Mac devices in provisioning profiles for iOS/iPadOS apps",
is_string: false,
default_value: false),
FastlaneCore::ConfigItem.new(key: :app_identifier,
short_option: "-a",
env_name: "SIGH_APP_IDENTIFIER",
Expand Down
4 changes: 3 additions & 1 deletion sigh/lib/sigh/runner.rb
Expand Up @@ -289,7 +289,9 @@ def devices_to_use
when 'macos', 'catalyst'
[Spaceship::ConnectAPI::Device::DeviceClass::MAC]
end

if Sigh.config[:platform].to_s == 'ios' && Sigh.config[:include_mac_in_profiles]
device_classes += [Spaceship::ConnectAPI::Device::DeviceClass::APPLE_SILICON_MAC]
end
if Spaceship::ConnectAPI.token
return Spaceship::ConnectAPI::Device.all.select do |device|
device_classes.include?(device.device_class)
Expand Down
1 change: 1 addition & 0 deletions spaceship/lib/spaceship/connect_api/models/device.rb
Expand Up @@ -29,6 +29,7 @@ module DeviceClass
IPOD = "IPOD"
APPLE_TV = "APPLE_TV"
MAC = "MAC"
APPLE_SILICON_MAC = "APPLE_SILICON_MAC"
end

module Status
Expand Down