Skip to content

Commit a1bdbc1

Browse files
authored
Merge pull request #104 from bamx23/vision-os
Add support for visionOS
2 parents c8e4fc8 + fbff3f3 commit a1bdbc1

10 files changed

Lines changed: 73 additions & 6 deletions

File tree

.github/workflows/checks.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,11 @@ jobs:
273273
codecov: false
274274
action: test
275275
warnings-as-errors: false
276+
- platform: visionOS
277+
xcode: ^15
278+
codecov: false
279+
action: test
280+
warnings-as-errors: false
276281
steps:
277282
- uses: actions/checkout@v3
278283
- uses: ./

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- tvOS
3737
- iOS
3838
- mac-catalyst
39+
- visionOS
3940
steps:
4041
- uses: mxcl/xcodebuild@v3
4142
with:

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ inputs:
1414
required: false
1515
platform:
1616
description: |
17-
Either `iOS`, `tvOS`, `macOS`, `watchOS` or (more rarely)
17+
Either `iOS`, `tvOS`, `macOS`, `watchOS`, `visionOS` or (more rarely)
1818
`mac-catalyst`
1919
Leave unset and `xcodebuild` decides itself.
2020
required: false

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fixtures/visionOS/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
/*.xcodeproj
5+
xcuserdata/
6+
DerivedData/
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

fixtures/visionOS/Package.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// swift-tools-version:5.0
2+
3+
import PackageDescription
4+
5+
let name = "my-fixture"
6+
7+
let pkg = Package(
8+
name: name,
9+
products: [
10+
.library(name: name, targets: [name]),
11+
],
12+
targets: [
13+
.target(name: name, path: ".", sources: ["code.swift"]),
14+
.testTarget(name: "\(name)Tests", path: ".", sources: ["test.swift"]),
15+
]
16+
)
17+
18+
pkg.platforms = [
19+
.macOS(.v10_10),
20+
.iOS(.v9),
21+
.tvOS(.v9),
22+
.watchOS(.v3)
23+
]

fixtures/visionOS/code.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#if !os(visionOS)
2+
#error("!os(visionOS)")
3+
#endif

fixtures/visionOS/test.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#if !os(visionOS)
2+
#error("!os(visionOS)")
3+
#endif
4+
5+
func foo() -> Int {
6+
return 5
7+
}
8+
9+
func bar() {
10+
// deliberate warning
11+
foo()
12+
}
13+
14+
import XCTest
15+
16+
class Test: XCTestCase {
17+
func test() {
18+
XCTAssertEqual(1, 1)
19+
}
20+
}

src/lib.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ interface Devices {
147147
}
148148
}
149149

150-
type DeviceType = 'watchOS' | 'tvOS' | 'iOS'
150+
type DeviceType = 'watchOS' | 'tvOS' | 'iOS' | 'xrOS'
151151
type Destination = { [key: string]: string }
152152

153153
interface Schemes {
@@ -217,6 +217,7 @@ async function destinations(): Promise<Destination> {
217217
tvOS: rv.tvOS?.id,
218218
watchOS: rv.watchOS?.id,
219219
iOS: rv.iOS?.id,
220+
visionOS: rv.xrOS?.id,
220221
}
221222

222223
function parse(key: string): [DeviceType, SemVer?] {
@@ -290,7 +291,13 @@ export function getConfiguration(): string {
290291
}
291292
}
292293

293-
export type Platform = 'watchOS' | 'iOS' | 'tvOS' | 'macOS' | 'mac-catalyst'
294+
export type Platform =
295+
| 'watchOS'
296+
| 'iOS'
297+
| 'tvOS'
298+
| 'macOS'
299+
| 'mac-catalyst'
300+
| 'visionOS'
294301

295302
export function getAction(
296303
xcodeVersion: SemVer,
@@ -320,7 +327,8 @@ export async function getDestination(
320327
switch (platform) {
321328
case 'iOS':
322329
case 'tvOS':
323-
case 'watchOS': {
330+
case 'watchOS':
331+
case 'visionOS': {
324332
const id = (await destinations())[platform]
325333
return ['-destination', `id=${id}`]
326334
}

0 commit comments

Comments
 (0)