@@ -5,6 +5,7 @@ import * as path from "path";
5
5
import * as _ from "lodash" ;
6
6
import { assert } from "chai" ;
7
7
import { IInjector } from "../../../lib/common/definitions/yok" ;
8
+ import { BUILD_XCCONFIG_FILE_NAME } from "../../../lib/constants" ;
8
9
9
10
function createTestInjector ( data : {
10
11
logLevel : string ;
@@ -18,7 +19,13 @@ function createTestInjector(data: {
18
19
getDevicesForPlatform : ( ) => data . connectedDevices || [ ] ,
19
20
} ) ;
20
21
injector . register ( "fs" , {
21
- exists : ( ) => data . hasProjectWorkspace ,
22
+ exists : ( filepath : string ) => {
23
+ if ( filepath . includes ( BUILD_XCCONFIG_FILE_NAME ) ) {
24
+ return true ;
25
+ } else {
26
+ return data . hasProjectWorkspace ;
27
+ }
28
+ } ,
22
29
} ) ;
23
30
injector . register ( "logger" , {
24
31
getLevel : ( ) => data . logLevel ,
@@ -32,6 +39,8 @@ function createTestInjector(data: {
32
39
}
33
40
34
41
const projectRoot = "path/to/my/app/folder/platforms/ios" ;
42
+ const normalizedPlatformName = "iOS" ;
43
+ const appResourcesDirectoryPath = "App_Resources" ;
35
44
const projectName = "myApp" ;
36
45
const buildOutputPath = path . join ( projectRoot , projectName , "archive" ) ;
37
46
@@ -43,18 +52,27 @@ function getCommonArgs() {
43
52
}
44
53
45
54
function getXcodeProjectArgs ( data ?: { hasProjectWorkspace : boolean } ) {
55
+ const extraArgs = [
56
+ "-scheme" ,
57
+ projectName ,
58
+ "-skipPackagePluginValidation" ,
59
+ "-xcconfig" ,
60
+ path . join (
<
8000
td data-grid-cell-id="diff-556455dd68a39c503dcada70398cfaf83ee384e2d50316c8d34ee7035968bdea-45-61-0" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-additionNum-bgColor, var(--diffBlob-addition-bgColor-num));text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative left-side">
61
+ appResourcesDirectoryPath ,
62
+ normalizedPlatformName ,
63
+ BUILD_XCCONFIG_FILE_NAME
64
+ ) ,
65
+ ] ;
46
66
return data && data . hasProjectWorkspace
47
67
? [
48
68
"-workspace" ,
49
69
path . join ( projectRoot , `${ projectName } .xcworkspace` ) ,
50
- "-scheme" ,
51
- projectName ,
70
+ ...extraArgs ,
52
71
]
53
72
: [
54
73
"-project" ,
55
74
path . join ( projectRoot , `${ projectName } .xcodeproj` ) ,
56
- "-scheme" ,
57
- projectName ,
75
+ ...extraArgs ,
58
76
] ;
59
77
}
60
78
@@ -84,11 +102,12 @@ describe("xcodebuildArgsService", () => {
84
102
const xcodebuildArgsService = injector . resolve (
85
103
"xcodebuildArgsService"
86
104
) ;
87
- const actualArgs = await xcodebuildArgsService . getBuildForSimulatorArgs (
88
- { projectRoot } ,
89
- { projectName } ,
90
- buildConfig
91
- ) ;
105
+ const actualArgs =
106
+ await xcodebuildArgsService . getBuildForSimulatorArgs (
107
+ { projectRoot, normalizedPlatformName } ,
108
+ { projectName, appResourcesDirectoryPath } ,
109
+ buildConfig
110
+ ) ;
92
111
93
112
const expectedArgs = [
94
113
"ONLY_ACTIVE_ARCH=NO" ,
@@ -114,8 +133,7 @@ describe("xcodebuildArgsService", () => {
114
133
describe ( "getBuildForDeviceArgs" , ( ) => {
115
134
const testCases = [
116
135
{
117
- name :
118
- "should return correct args when there are more than one connected device" ,
136
+ name : "should return correct args when there are more than one connected device" ,
119
137
connectedDevices : [
120
138
{ deviceInfo : { activeArchitecture : "arm64" } } ,
121
139
{ deviceInfo : { activeArchitecture : "armv7" } } ,
@@ -125,8 +143,7 @@ describe("xcodebuildArgsService", () => {
125
143
) ,
126
144
} ,
127
145
{
128
- name :
129
- "should return correct args when there is only one connected device" ,
146
+ name : "should return correct args when there is only one connected device" ,
130
147
connectedDevices : [ { deviceInfo : { activeArchitecture : "arm64" } } ] ,
131
148
expectedArgs : [ "-sdk" , "iphoneos" ] . concat ( getCommonArgs ( ) ) ,
132
149
} ,
@@ -150,21 +167,25 @@ describe("xcodebuildArgsService", () => {
150
167
151
168
const platformData = {
152
169
projectRoot,
170
+ normalizedPlatformName,
153
171
getBuildOutputPath : ( ) => buildOutputPath ,
154
172
} ;
155
- const projectData = { projectName } ;
173
+ const projectData = {
174
+ projectName,
175
+ appResourcesDirectoryPath,
176
+ } ;
156
177
const buildConfig = {
157
178
buildForDevice : true ,
158
179
release : configuration === "Release" ,
159
180
} ;
160
- const xcodebuildArgsService : IXcodebuildArgsService = injector . resolve (
161
- "xcodebuildArgsService"
162
- ) ;
163
- const actualArgs = await xcodebuildArgsService . getBuildForDeviceArgs (
164
- < any > platformData ,
165
- < any > projectData ,
166
- < any > buildConfig
167
- ) ;
181
+ const xcodebuildArgsService : IXcodebuildArgsService =
182
+ injector . resolve ( "xcodebuildArgsService" ) ;
183
+ const actualArgs =
184
+ await xcodebuildArgsService . getBuildForDeviceArgs (
185
+ < any > platformData ,
186
+ < any > projectData ,
187
+ < any > buildConfig
188
+ ) ;
168
189
169
190
const expectedArgs = [
170
191
"-destination" ,
0 commit comments