@@ -11,6 +11,7 @@ function createTestInjector(data: {
1111 logLevel : string ;
1212 hasProjectWorkspace : boolean ;
1313 connectedDevices ?: any [ ] ;
14+ buildXcconfigContent ?: string ;
1415} ) : IInjector {
1516 const injector = new Yok ( ) ;
1617 injector . register ( "devicePlatformsConstants" , DevicePlatformsConstants ) ;
@@ -19,8 +20,11 @@ function createTestInjector(data: {
1920 getDevicesForPlatform : ( ) => data . connectedDevices || [ ] ,
2021 } ) ;
2122 injector . register ( "fs" , {
22- exists : ( ) => data . hasProjectWorkspace ,
23- readText : ( ) => "" ,
23+ exists : ( filePath : string ) =>
24+ filePath . endsWith ( "build.xcconfig" )
25+ ? data . buildXcconfigContent !== undefined
26+ : data . hasProjectWorkspace ,
27+ readText : ( ) => data . buildXcconfigContent || "" ,
2428 } ) ;
2529 injector . register ( "logger" , {
2630 getLevel : ( ) => data . logLevel ,
@@ -49,7 +53,13 @@ function getCommonArgs() {
4953}
5054
5155function getXcodeProjectArgs ( data ?: { hasProjectWorkspace : boolean } ) {
52- const extraArgs = [ "-scheme" , projectName , "-skipPackagePluginValidation" ] ;
56+ const extraArgs = [
57+ "-scheme" ,
58+ projectName ,
59+ "-skipPackagePluginValidation" ,
60+ "-skipMacroValidation" ,
61+ "SWIFT_ENABLE_EXPLICIT_MODULES=NO" ,
62+ ] ;
5363 return data && data . hasProjectWorkspace
5464 ? [
5565 "-workspace" ,
@@ -72,6 +82,27 @@ function getBuildLoggingArgs(logLevel: string): string[] {
7282}
7383
7484describe ( "xcodebuildArgsService" , ( ) => {
85+ describe ( "getXcodeProjectArgs" , ( ) => {
86+ it ( "should allow SWIFT_ENABLE_EXPLICIT_MODULES to be overridden from build.xcconfig" , ( ) => {
87+ const injector = createTestInjector ( {
88+ logLevel : "INFO" ,
89+ hasProjectWorkspace : false ,
90+ buildXcconfigContent : "SWIFT_ENABLE_EXPLICIT_MODULES = YES" ,
91+ } ) ;
92+ const xcodebuildArgsService : IXcodebuildArgsService = injector . resolve (
93+ "xcodebuildArgsService" ,
94+ ) ;
95+
96+ const actualArgs = xcodebuildArgsService . getXcodeProjectArgs (
97+ < any > { projectRoot, normalizedPlatformName } ,
98+ < any > { projectName, appResourcesDirectoryPath } ,
99+ ) ;
100+
101+ assert . include ( actualArgs , "SWIFT_ENABLE_EXPLICIT_MODULES=YES" ) ;
102+ assert . notInclude ( actualArgs , "SWIFT_ENABLE_EXPLICIT_MODULES=NO" ) ;
103+ } ) ;
104+ } ) ;
105+
75106 describe ( "getBuildForSimulatorArgs" , ( ) => {
76107 _ . each ( [ true , false ] , ( hasProjectWorkspace ) => {
77108 _ . each ( [ "INFO" , "TRACE" ] , ( logLevel ) => {
0 commit comments