1- IOS_VERSION = 26.0
2- TVOS_VERSION = 26.0
3- WATCHOS_VERSION = 26.0
4- VISIONOS_VERSION = 26.0
1+ IOS_DEVICE = iPhone
2+ TVOS_DEVICE = TV
3+ WATCHOS_DEVICE = Watch
4+ VISIONOS_DEVICE = Vision
55
6- PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS $(IOS_VERSION ) ,iPhone \d\+ Pro [^M])
6+ IOS_SIMULATOR = $(call udid_for,$(IOS_DEVICE ) )
7+ TVOS_SIMULATOR = $(call udid_for,$(TVOS_DEVICE ) )
8+ WATCHOS_SIMULATOR = $(call udid_for,$(WATCHOS_DEVICE ) )
9+ VISIONOS_SIMULATOR = $(call udid_for,$(VISIONOS_DEVICE ) )
10+
11+ PLATFORM_IOS = iOS Simulator,id=$(IOS_SIMULATOR )
712PLATFORM_MACOS = macOS
8- PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS $(TVOS_VERSION ) ,TV)
9- PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS $(WATCHOS_VERSION ) ,Watch)
10- PLATFORM_VISIONOS = visionOS Simulator,id=$(call udid_for,visionOS $(VISIONOS_VERSION ) ,Vision)
13+ PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
14+ PLATFORM_TVOS = tvOS Simulator,id=$(TVOS_SIMULATOR )
15+ PLATFORM_WATCHOS = watchOS Simulator,id=$(WATCHOS_SIMULATOR )
16+ PLATFORM_VISIONOS = visionOS Simulator,id=$(VISIONOS_SIMULATOR )
1117
1218default : test
1319
14- test : test-macos test-ios test-tvos test-watchos test-visionos
20+ test : test-macos test-maccatalyst test- ios test-tvos test-watchos test-visionos
1521
1622test-macos :
1723 @echo " Testing macOS..."
1824 xcodebuild test -scheme Textual -destination platform=" $( PLATFORM_MACOS) "
1925
26+ test-maccatalyst :
27+ @echo " Testing Mac Catalyst..."
28+ xcodebuild test -scheme Textual -destination platform=" $( PLATFORM_MAC_CATALYST) "
29+
2030test-ios :
21- @echo " Testing iOS $( IOS_VERSION) ..."
31+ @echo " Testing iOS..."
32+ $(call require_simulator,$(IOS_SIMULATOR ) ,$(IOS_DEVICE ) )
2233 xcodebuild test -scheme Textual -destination platform=" $( PLATFORM_IOS) "
2334
2435test-tvos :
25- @echo " Testing tvOS $( TVOS_VERSION) ..."
36+ @echo " Testing tvOS..."
37+ $(call require_simulator,$(TVOS_SIMULATOR ) ,$(TVOS_DEVICE ) )
2638 xcodebuild test -scheme Textual -destination platform=" $( PLATFORM_TVOS) "
2739
2840test-watchos :
29- @echo " Testing watchOS $( WATCHOS_VERSION) ..."
41+ @echo " Testing watchOS..."
42+ $(call require_simulator,$(WATCHOS_SIMULATOR ) ,$(WATCHOS_DEVICE ) )
3043 xcodebuild test -scheme Textual -destination platform=" $( PLATFORM_WATCHOS) "
3144
3245test-visionos :
33- @echo " Testing visionOS $( PLATFORM_VISIONOS) ..."
46+ @echo " Testing visionOS..."
47+ $(call require_simulator,$(VISIONOS_SIMULATOR ) ,$(VISIONOS_DEVICE ) )
3448 xcodebuild test -scheme Textual -destination platform=" $( PLATFORM_VISIONOS) "
3549
3650format :
@@ -51,8 +65,12 @@ build-demo:
5165 @echo " Building TextualDemo for macOS..."
5266 xcodebuild build -workspace Textual.xcworkspace -scheme TextualDemo -destination platform=" $( PLATFORM_MACOS) " CODE_SIGN_IDENTITY=" " CODE_SIGNING_REQUIRED=NO
5367
54- .PHONY : format test bundle-prism build-demo
68+ .PHONY : format test test-macos test-maccatalyst test-ios test-tvos test-watchos test-visionos bundle-prism build-demo
5569
5670define udid_for
57- $(shell xcrun simctl list devices available '$(1 ) ' | grep '$(2 ) ' | sort -r | head -1 | awk -F '[() ]' '{ print $$(NF-3 ) }')
71+ $(shell xcrun simctl list --json devices available '$(1 ) ' | jq -r '[.devices | to_entries | sort_by(.key) | reverse | .[].value | select(length > 0) | .[0]][0].udid // empty')
72+ endef
73+
74+ define require_simulator
75+ @test "$(1 ) " != "" || (echo "No available simulator found matching '$(2 ) '" >&2; exit 1)
5876endef
0 commit comments