Skip to content

Commit

Permalink
Add support for visionOS (#1379)
Browse files Browse the repository at this point in the history
* Add support for visionOS

* Update ProjectSpec

* Add carthageName property for .visionOS

* Update CHANGELOG.md and ProjectSpec.md

* Add visionOS yml to SettingPresets/Platforms and SettingPresets/Product_Platform

---------

Co-authored-by: Satsuki Hashiba <hashiba.satsuki@linecorp.com>
  • Loading branch information
shiba1014 and Satsuki Hashiba authored Aug 7, 2023
1 parent 49a9bda commit 3a215ce
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

- Added `scheme.enableGPUValidationMode` #1294 @LouisLWang
- Added visionOS support #1379 @shiba1014

### Fixed

Expand Down
1 change: 1 addition & 0 deletions Docs/ProjectSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ This will provide default build settings for a certain platform. It can be any o
- `macOS`
- `tvOS`
- `watchOS`
- `visionOS` (`visionOS` doesn't support Carthage usage)

**Multi Platform targets**

Expand Down
2 changes: 2 additions & 0 deletions SettingPresets/Platforms/visionOS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SDKROOT: xros
TARGETED_DEVICE_FAMILY: 7
1 change: 1 addition & 0 deletions SettingPresets/Product_Platform/application_visionOS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
10 changes: 9 additions & 1 deletion Sources/ProjectSpec/DeploymentTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@ public struct DeploymentTarget: Equatable {
public var tvOS: Version?
public var watchOS: Version?
public var macOS: Version?
public var visionOS: Version?

public init(
iOS: Version? = nil,
tvOS: Version? = nil,
watchOS: Version? = nil,
macOS: Version? = nil
macOS: Version? = nil,
visionOS: Version? = nil
) {
self.iOS = iOS
self.tvOS = tvOS
self.watchOS = watchOS
self.macOS = macOS
self.visionOS = visionOS
}

public func version(for platform: Platform) -> Version? {
Expand All @@ -27,6 +30,7 @@ public struct DeploymentTarget: Equatable {
case .tvOS: return tvOS
case .watchOS: return watchOS
case .macOS: return macOS
case .visionOS: return visionOS
}
}
}
Expand All @@ -39,6 +43,7 @@ extension Platform {
case .tvOS: return "TVOS_DEPLOYMENT_TARGET"
case .watchOS: return "WATCHOS_DEPLOYMENT_TARGET"
case .macOS: return "MACOSX_DEPLOYMENT_TARGET"
case .visionOS: return "XROS_DEPLOYMENT_TARGET"
}
}

Expand All @@ -48,6 +53,7 @@ extension Platform {
case .tvOS: return "appletvos"
case .watchOS: return "watchos"
case .macOS: return "macosx"
case .visionOS: return "xros"
}
}
}
Expand Down Expand Up @@ -77,6 +83,7 @@ extension DeploymentTarget: JSONObjectConvertible {
tvOS = try parseVersion("tvOS")
watchOS = try parseVersion("watchOS")
macOS = try parseVersion("macOS")
visionOS = try parseVersion("visionOS")
}
}

Expand All @@ -87,6 +94,7 @@ extension DeploymentTarget: JSONEncodable {
"tvOS": tvOS?.description,
"watchOS": watchOS?.description,
"macOS": macOS?.description,
"visionOS": visionOS?.description,
]
}
}
1 change: 1 addition & 0 deletions Sources/ProjectSpec/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ public enum Platform: String, Hashable, CaseIterable {
case watchOS
case tvOS
case macOS
case visionOS
}
1 change: 1 addition & 0 deletions Sources/ProjectSpec/XCProjExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ extension Platform {
case .watchOS: return "⌚️"
case .tvOS: return "📺"
case .macOS: return "🖥"
case .visionOS: return "🕶️"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions Sources/XcodeGenKit/CarthageDependencyResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ extension Platform {
return "watchOS"
case .macOS:
return "Mac"
case .visionOS:
// This is a dummy value because Carthage doesn't support visionOS.
return "visionOS"
}
}
}
2 changes: 1 addition & 1 deletion Sources/XcodeGenKit/PBXProjGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@ extension Platform {
/// - returns: `true` for platforms that the app store requires simulator slices to be stripped.
public var requiresSimulatorStripping: Bool {
switch self {
case .iOS, .tvOS, .watchOS:
case .iOS, .tvOS, .watchOS, .visionOS:
return true
case .macOS:
return false
Expand Down

0 comments on commit 3a215ce

Please sign in to comment.