@@ -16,6 +16,7 @@ import * as _ from "lodash";
1616import {
1717 DevicePlatformSdkName ,
1818 SimulatorPlatformSdkName ,
19+ VisionDevicePlatformSdkName ,
1920 VisionSimulatorPlatformSdkName ,
2021} from "../ios-project-service" ;
2122
@@ -26,13 +27,13 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
2627 private $fs : IFileSystem ,
2728 private $iOSWatchAppService : IIOSWatchAppService ,
2829 private $logger : ILogger ,
29- private $xcconfigService : IXcconfigService
30+ private $xcconfigService : IXcconfigService ,
3031 ) { }
3132
3233 public async getBuildForSimulatorArgs (
3334 platformData : IPlatformData ,
3435 projectData : IProjectData ,
35- buildConfig : IBuildConfig
36+ buildConfig : IBuildConfig ,
3637 ) : Promise < string [ ] > {
3738 let args = await this . getArchitecturesArgs ( buildConfig ) ;
3839
@@ -45,11 +46,11 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
4546 let destination = "generic/platform=iOS Simulator" ;
4647
4748 let isvisionOS = this . $devicePlatformsConstants . isvisionOS (
48- buildConfig . platform
49+ buildConfig . platform ,
4950 ) ;
5051
5152 if ( isvisionOS ) {
52- destination = "platform=visionOS Simulator" ;
53+ destination = "generic/ platform=visionOS Simulator" ;
5354 if ( buildConfig . _device ) {
5455 destination += `,id=${ buildConfig . _device . deviceInfo . identifier } ` ;
5556 }
@@ -67,8 +68,10 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
6768 this . getBuildCommonArgs (
6869 platformData ,
6970 projectData ,
70- isvisionOS ? VisionSimulatorPlatformSdkName : SimulatorPlatformSdkName
71- )
71+ isvisionOS
72+ ? VisionSimulatorPlatformSdkName
73+ : SimulatorPlatformSdkName ,
74+ ) ,
7275 )
7376 . concat ( this . getBuildLoggingArgs ( ) )
7477 . concat ( this . getXcodeProjectArgs ( platformData , projectData ) ) ;
@@ -79,20 +82,20 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
7982 public async getBuildForDeviceArgs (
8083 platformData : IPlatformData ,
8184 projectData : IProjectData ,
82- buildConfig : IBuildConfig
85+ buildConfig : IBuildConfig ,
8386 ) : Promise < string [ ] > {
8487 const architectures = await this . getArchitecturesArgs ( buildConfig ) ;
8588 const archivePath = path . join (
8689 platformData . getBuildOutputPath ( buildConfig ) ,
87- projectData . projectName + ".xcarchive"
90+ projectData . projectName + ".xcarchive" ,
8891 ) ;
8992 let destination = "generic/platform=iOS" ;
9093 let isvisionOS = this . $devicePlatformsConstants . isvisionOS (
91- buildConfig . platform
94+ buildConfig . platform ,
9295 ) ;
9396
9497 if ( isvisionOS ) {
95- destination = "platform=visionOS" ;
98+ destination = "generic/ platform=visionOS" ;
9699 if ( buildConfig . _device ) {
97100 destination += `,id=${ buildConfig . _device . deviceInfo . identifier } ` ;
98101 }
@@ -113,21 +116,23 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
113116 this . getBuildCommonArgs (
114117 platformData ,
115118 projectData ,
116- DevicePlatformSdkName
117- )
119+ isvisionOS ? VisionDevicePlatformSdkName : DevicePlatformSdkName ,
120+ ) ,
118121 )
119122 . concat ( this . getBuildLoggingArgs ( ) ) ;
120123
121124 return args ;
122125 }
123126
124127 private async getArchitecturesArgs (
125- buildConfig : IBuildConfig
128+ buildConfig : IBuildConfig ,
126129 ) : Promise < string [ ] > {
127130 const args = [ ] ;
128131
129132 if ( this . $devicePlatformsConstants . isvisionOS ( buildConfig . platform ) ) {
130- args . push ( "ONLY_ACTIVE_ARCH=YES" ) ;
133+ // visionOS builds (device/simulator) are arm64-only; rely on destination for arch
134+ // and explicitly exclude x86_64 to avoid accidental selection
135+ args . push ( "ONLY_ACTIVE_ARCH=YES" , "EXCLUDED_ARCHS=x86_64" ) ;
131136 return args ;
132137 }
133138
@@ -143,11 +148,11 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
143148
144149 public getXcodeProjectArgs (
145150 platformData : IPlatformData ,
146- projectData : IProjectData
151+ projectData : IProjectData ,
147152 ) : string [ ] {
148153 const xcworkspacePath = path . join (
149154 platformData . projectRoot ,
150- `${ projectData . projectName } .xcworkspace`
155+ `${ projectData . projectName } .xcworkspace` ,
151156 ) ;
152157 // Introduced in Xcode 14+
153158 // ref: https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/5
@@ -162,7 +167,7 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
162167 const BUILD_SETTINGS_FILE_PATH = path . join (
163168 projectData . appResourcesDirectoryPath ,
164169 platformData . normalizedPlatformName ,
165- constants . BUILD_XCCONFIG_FILE_NAME
170+ constants . BUILD_XCCONFIG_FILE_NAME ,
166171 ) ;
167172
168173 // Only include explicit properties from build.xcconfig
@@ -175,7 +180,7 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
175180 const deployTargetProperty = "IPHONEOS_DEPLOYMENT_TARGET" ;
176181 const deployTargetVersion = this . $xcconfigService . readPropertyValue (
177182 BUILD_SETTINGS_FILE_PATH ,
178- deployTargetProperty
183+ deployTargetProperty ,
179184 ) ;
180185 if ( deployTargetVersion ) {
181186 extraArgs . push ( `${ deployTargetProperty } =${ deployTargetVersion } ` ) ;
@@ -184,7 +189,7 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
184189 const swiftUIBootProperty = "NS_SWIFTUI_BOOT" ;
185190 const swiftUIBootValue = this . $xcconfigService . readPropertyValue (
186191 BUILD_SETTINGS_FILE_PATH ,
187- swiftUIBootProperty
192+ swiftUIBootProperty ,
188193 ) ;
189194 if ( swiftUIBootValue ) {
190195 extraArgs . push ( `${ swiftUIBootProperty } =${ swiftUIBootValue } ` ) ;
@@ -196,7 +201,7 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
196201
197202 const xcodeprojPath = path . join (
198203 platformData . projectRoot ,
199- `${ projectData . projectName } .xcodeproj`
204+ `${ projectData . projectName } .xcodeproj` ,
200205 ) ;
201206 return [ "-project" , xcodeprojPath , ...extraArgs ] ;
202207 }
@@ -208,7 +213,7 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
208213 private getBuildCommonArgs (
209214 platformData : IPlatformData ,
210215 projectData : IProjectData ,
211- platformSdkName : string
216+ platformSdkName : string ,
212217 ) : string [ ] {
213218 let args : string [ ] = [ ] ;
214219
@@ -226,7 +231,7 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
226231 }
227232
228233 private async getArchitecturesFromConnectedDevices (
229- buildConfig : IiOSBuildConfig
234+ buildConfig : IiOSBuildConfig ,
230235 ) : Promise < string [ ] > {
231236 const platform = this . $devicePlatformsConstants . iOS . toLowerCase ( ) ;
232237 await this . $devicesService . initialize ( {
0 commit comments