Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Make ParsePlatform public
  • Loading branch information
Badlazzor committed Sep 16, 2025
commit 8d4c89c78b6462bfa98bcbdb09d0fee102bab604
8 changes: 4 additions & 4 deletions step/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (
tvOSSimulator Platform = "tvOS Simulator"
)

func parsePlatform(platform string) (Platform, error) {
func ParsePlatform(platform string) (Platform, error) {
switch strings.ToLower(platform) {
case "detect":
return detectPlatform, nil
Expand All @@ -40,11 +40,11 @@ func parsePlatform(platform string) (Platform, error) {
return watchOS, nil
case "visionos":
return visionOS, nil
case "generic/platform=ios simulator":
case "ios simulator":
return iOSSimulator, nil
case "generic/platform=watchos simulator":
case "watchos simulator":
return watchOSSimulator, nil
case "generic/platform=tvos simulator":
case "tvos simulator":
return tvOSSimulator, nil
default:
return "", fmt.Errorf("unknown platform: %s", platform)
Expand Down
38 changes: 37 additions & 1 deletion step/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,44 @@ func Test_getPlatform(t *testing.T) {
wantErr: false,
},
{
name: "unkown SDK path",
name: "iOS Simulator",
buildSettings: serialized.Object(map[string]interface{}{"SDKROOT": "iphonesimulator"}),
want: iOSSimulator,
wantErr: false,
},
{
name: "tvOS Simulator",
buildSettings: serialized.Object(map[string]interface{}{"SDKROOT": "appletvsimulator"}),
want: tvOSSimulator,
wantErr: false,
},
{
name: "watchOS Simulator",
buildSettings: serialized.Object(map[string]interface{}{"SDKROOT": "watchsimulator"}),
want: watchOSSimulator,
wantErr: false,
},
{
name: "iOS simulator with SDK path",
buildSettings: serialized.Object(map[string]interface{}{"SDKROOT": "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"}),
want: iOSSimulator,
wantErr: false,
},
{
name: "tvOS simulator with SDK path",
buildSettings: serialized.Object(map[string]interface{}{"SDKROOT": "/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk"}),
want: tvOSSimulator,
wantErr: false,
},
{
name: "watchOS simulator with SDK path",
buildSettings: serialized.Object(map[string]interface{}{"SDKROOT": "/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk"}),
want: watchOSSimulator,
wantErr: false,
},
{
name: "unknown SDK path",
buildSettings: serialized.Object(map[string]interface{}{"SDKROOT": "/Applications/Xcode.app/Contents/Developer/Platforms/Stuff.platform/Developer/SDKs/Stuff.sdk"}),
want: Platform(""),
wantErr: true,
},
Expand Down
2 changes: 1 addition & 1 deletion step/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (s XcodebuildArchiveConfigParser) ProcessInputs() (Config, error) {
}

var err error
if config.DestinationPlatform, err = parsePlatform(config.Platform); err != nil {
if config.DestinationPlatform, err = ParsePlatform(config.Platform); err != nil {
return Config{}, fmt.Errorf("issue with input Platform: %w", err)
}

Expand Down