@@ -127,15 +127,22 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
127
127
128
128
public buildProject ( projectRoot : string ) : IFuture < void > {
129
129
return ( ( ) => {
130
- var basicArgs = [
131
- "-project" , path . join ( projectRoot , this . $projectData . projectName + ".xcodeproj" ) ,
132
- "-target" , this . $projectData . projectName ,
130
+ let basicArgs = [
133
131
"-configuration" , this . $options . release ? "Release" : "Debug" ,
134
132
"build" ,
135
133
'SHARED_PRECOMPS_DIR=' + path . join ( projectRoot , 'build' , 'sharedpch' )
136
134
] ;
137
- var args : string [ ] = [ ] ;
138
-
135
+
136
+ let xcworkspacePath = path . join ( projectRoot , this . $projectData . projectName + ".xcworkspace" ) ;
137
+ if ( this . $fs . exists ( xcworkspacePath ) . wait ( ) ) {
138
+ basicArgs . push ( "-workspace" , xcworkspacePath ) ;
139
+ basicArgs . push ( "-scheme" , this . $projectData . projectName ) ;
140
+ } else {
141
+ basicArgs . push ( "-project" , path . join ( projectRoot , this . $projectData . projectName + ".xcodeproj" ) ) ;
142
+ basicArgs . push ( "-target" , this . $projectData . projectName ) ;
143
+ }
144
+
145
+ let args : string [ ] = [ ] ;
139
146
if ( this . $options . forDevice ) {
140
147
args = basicArgs . concat ( [
141
148
"-xcconfig" , path . join ( projectRoot , this . $projectData . projectName , "build.xcconfig" ) ,
@@ -151,7 +158,6 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
151
158
"VALID_ARCHS=\"i386\"" ,
152
159
"CONFIGURATION_BUILD_DIR=" + path . join ( projectRoot , "build" , "emulator" )
153
160
] ) ;
154
-
155
161
}
156
162
157
163
this . $childProcess . spawnFromEvent ( "xcodebuild" , args , "exit" , { cwd : this . $options , stdio : 'inherit' } ) . wait ( ) ;
@@ -361,4 +367,4 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
361
367
} ) . future < void > ( ) ( ) ;
362
368
}
363
369
}
364
- $injector . register ( "iOSProjectService" , IOSProjectService ) ;
370
+ $injector . register ( "iOSProjectService" , IOSProjectService ) ;
0 commit comments