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

Initial visionOS support #344

Merged
merged 9 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
31 changes: 31 additions & 0 deletions e2e/bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,37 @@ app:

workflows:

test_visionOS:
description: visionOS SDK requires Xcode 15.2+
steps:
- bitrise-run:
title: Run visionOS test if current stack supports it
run_if: |-
{{ and (ne (getenv "BITRISEIO_STACK_ID") "osx-xcode-15.1.x") (ne (getenv "BITRISEIO_STACK_ID") "osx-xcode-15.0.x") (ne (getenv "BITRISEIO_STACK_ID") "osx-xcode-14.3.x-ventura") (ne (getenv "BITRISEIO_STACK_ID") "osx-xcode-14.2.x-ventura") (ne (getenv "BITRISEIO_STACK_ID") "osx-xcode-14.1.x-ventura") (ne (getenv "BITRISEIO_STACK_ID") "osx-xcode-14.0.x-ventura") }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This ugly expression is going to get better over time (we'll remove Xcode 14.0 in 4 weeks, for example).

I also tried to make it easier to read by adding {{ with $stack := getenv "BITRISEIO_STACK_ID" }} ... {{ end }}, but it breaks the expression, it seems like it always returns a truthy value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, too bad the templating doesn't have a strings.HasPrefix("osx-xcode-14") equivalent :(

Copy link
Contributor

Choose a reason for hiding this comment

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

inputs:
- workflow_id: utility_test_visionOS
- bitrise_config_path: ./e2e/bitrise.yml

utility_test_visionOS:
envs:
- TEST_APP_URL: https://github.com/bitrise-io/visionOS-HelloWorld
- TEST_APP_BRANCH: main
- TEST_APP_COMMIT: ""
- BITRISE_PROJECT_PATH: World.xcodeproj
- BITRISE_SCHEME: World
- CODE_SIGNING_METHOD: api-key
- MIN_DAYS_PROFILE_VALID: 0
- FORCE_CODE_SIGN_IDENTITY: "iPhone Developer: Tooling Bot Bitrise"
- TEAM_ID: 72SA8V3WYL
- FORCE_PROV_PROFILE_SPECIFIER: ""
- IPA_EXPORT_METHOD: development
- IPA_EXPORT_ICLOUD_CONTAINER_ENVIRONMENT: ""
- LOG_FORMATTER: xcodebuild
after_run:
- _run
- _check_outputs
- _check_exported_artifacts

test_override_api_key_signing:
description: Test API key based signing on a project where code signing is not managed automatically, by step inputs
envs:
Expand Down
18 changes: 8 additions & 10 deletions step/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ import (
"github.com/bitrise-io/go-xcode/xcodeproject/xcscheme"
)

// Platform ...
type Platform string

const (
iOS Platform = "iOS"
osX Platform = "OS X"
tvOS Platform = "tvOS"
watchOS Platform = "watchOS"
iOS Platform = "iOS"
osX Platform = "OS X"
tvOS Platform = "tvOS"
watchOS Platform = "watchOS"
visionOS Platform = "visionOS"
)

// OpenArchivableProject ...
func OpenArchivableProject(pth, schemeName, configurationName string) (*xcodeproj.XcodeProj, *xcscheme.Scheme, string, error) {
scheme, schemeContainerDir, err := schemeint.Scheme(pth, schemeName)
if err != nil {
Expand Down Expand Up @@ -53,21 +52,17 @@ func OpenArchivableProject(pth, schemeName, configurationName string) (*xcodepro
return &xcodeProj, scheme, configurationName, nil
}

// TargetBuildSettingsProvider ...
type TargetBuildSettingsProvider interface {
TargetBuildSettings(xcodeProj *xcodeproj.XcodeProj, target, configuration string, customOptions ...string) (serialized.Object, error)
}

// XcodeBuild ...
type XcodeBuild struct {
}

// TargetBuildSettings ...
func (x XcodeBuild) TargetBuildSettings(xcodeProj *xcodeproj.XcodeProj, target, configuration string, customOptions ...string) (serialized.Object, error) {
return xcodeProj.TargetBuildSettings(target, configuration, customOptions...)
}

// BuildableTargetPlatform ...
func BuildableTargetPlatform(
xcodeProj *xcodeproj.XcodeProj,
scheme *xcscheme.Scheme,
Expand Down Expand Up @@ -140,6 +135,9 @@ func getPlatform(buildSettings serialized.Object) (Platform, error) {
return tvOS, nil
case strings.HasPrefix(sdk, "watchos"):
return watchOS, nil
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
default:
return "", fmt.Errorf("unkown SDKROOT: %s", sdk)
}
Expand Down