Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/bitrise-io/go-utils v1.0.14
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.23
github.com/bitrise-io/go-xcode v1.3.0
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.67
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.67.0.20250916115031-007c7230724c
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/stretchr/testify v1.10.0
gopkg.in/yaml.v3 v3.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.23 h1:Dfh4nyZPuEtilBisidejqxBrkx9
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.23/go.mod h1:3XUplo0dOWc3DqT2XA2SeHToDSg7+j1y1HTHibT2H68=
github.com/bitrise-io/go-xcode v1.3.0 h1:QB8Vyr2oZQro/ocs9DJai80rlYL1hU1kwjHqdGslFLo=
github.com/bitrise-io/go-xcode v1.3.0/go.mod h1:9OwsvrhZ4A2JxHVoEY7CPcABAKA+OE7FQqFfBfvbFuY=
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.67 h1:Fz3LSRoH9p5u7yTqdsmE32RHGWEw8q3BVWoOSiHs7AY=
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.67/go.mod h1:rSmzmqVD3Mn9dWwe19qiiGjlvk/At3D8bQh7n9E8S58=
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.67.0.20250916115031-007c7230724c h1:7LVyacj3I5q54CSzzUGmigFxsINYdXTJgJPs9Z83tqY=
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.67.0.20250916115031-007c7230724c/go.mod h1:rSmzmqVD3Mn9dWwe19qiiGjlvk/At3D8bQh7n9E8S58=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
30 changes: 29 additions & 1 deletion step/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ const (
tvOS Platform = "tvOS"
watchOS Platform = "watchOS"
visionOS Platform = "visionOS"

// Not permitted on this steps UI, but may come from build-for-simulator
iOSSimulator Platform = "iOS Simulator"
watchOSSimulator Platform = "watchOS Simulator"
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 @@ -35,6 +40,12 @@ func parsePlatform(platform string) (Platform, error) {
return watchOS, nil
case "visionos":
return visionOS, nil
case "ios simulator":
return iOSSimulator, nil
case "watchos simulator":
return watchOSSimulator, nil
case "tvos simulator":
return tvOSSimulator, nil
default:
return "", fmt.Errorf("unknown platform: %s", platform)
}
Expand Down Expand Up @@ -157,7 +168,24 @@ func getPlatform(buildSettings serialized.Object) (Platform, error) {
case strings.HasPrefix(sdk, "xros"):
// visionOS SDK is called xros (as of Xcode 15.2), but the platform is called visionOS (e.g. in the destination specifier)
return visionOS, nil
case strings.HasPrefix(sdk, "iphonesimulator"):
return iOSSimulator, nil
case strings.HasPrefix(sdk, "watchsimulator"):
return watchOSSimulator, nil
case strings.HasPrefix(sdk, "appletvsimulator"):
return tvOSSimulator, nil
default:
return "", fmt.Errorf("unkown SDKROOT: %s", sdk)

Choose a reason for hiding this comment

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

🐛 Bug

Typo in error message: "unkown" should be "unknown"

🔄 Suggestion:

Suggested change
return "", fmt.Errorf("unkown SDKROOT: %s", sdk)
return "", fmt.Errorf("unknown SDKROOT: %s", sdk)

}
}

func (p Platform) canExportIPA() bool {
switch p {
case iOS, tvOS, watchOS, visionOS:
return true
case osX, iOSSimulator, watchOSSimulator, tvOSSimulator:
return false
default:
return false
}
}
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
6 changes: 5 additions & 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 Expand Up @@ -454,6 +454,10 @@ func (s XcodebuildArchiver) Run(opts RunOpts) (RunResult, error) {

out.Archive = archiveOut.Archive

if !opts.DestinationPlatform.canExportIPA() {
return out, nil
}

IPAExportOpts := xcodeIPAExportOpts{
XcodeMajorVersion: opts.XcodeMajorVersion,
XcodeAuthOptions: authOptions,
Expand Down
20 changes: 14 additions & 6 deletions vendor/github.com/bitrise-io/go-xcode/v2/xcarchive/ios.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ github.com/bitrise-io/go-xcode/xcodeproject/serialized
github.com/bitrise-io/go-xcode/xcodeproject/xcodeproj
github.com/bitrise-io/go-xcode/xcodeproject/xcscheme
github.com/bitrise-io/go-xcode/xcodeproject/xcworkspace
# github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.67
# github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.67.0.20250916115031-007c7230724c
## explicit; go 1.22
github.com/bitrise-io/go-xcode/v2/autocodesign
github.com/bitrise-io/go-xcode/v2/autocodesign/certdownloader
Expand Down