17
17
* under the License.
18
18
*/
19
19
20
- const Q = require ( 'q' ) ;
21
20
const path = require ( 'path' ) ;
22
21
const which = require ( 'which' ) ;
23
22
const {
23
+ CordovaError,
24
24
events,
25
25
superspawn : { spawn }
26
26
} = require ( 'cordova-common' ) ;
@@ -112,16 +112,16 @@ module.exports.run = buildOpts => {
112
112
buildOpts = buildOpts || { } ;
113
113
114
114
if ( buildOpts . debug && buildOpts . release ) {
115
- return Q . reject ( 'Cannot specify "debug" and "release" options together.' ) ;
115
+ return Promise . reject ( new CordovaError ( 'Cannot specify "debug" and "release" options together.' ) ) ;
116
116
}
117
117
118
118
if ( buildOpts . device && buildOpts . emulator ) {
119
- return Q . reject ( 'Cannot specify "device" and "emulator" options together.' ) ;
119
+ return Promise . reject ( new CordovaError ( 'Cannot specify "device" and "emulator" options together.' ) ) ;
120
120
}
121
121
122
122
if ( buildOpts . buildConfig ) {
123
123
if ( ! fs . existsSync ( buildOpts . buildConfig ) ) {
124
- return Q . reject ( `Build config file does not exist: ${ buildOpts . buildConfig } ` ) ;
124
+ return Promise . reject ( new CordovaError ( `Build config file does not exist: ${ buildOpts . buildConfig } ` ) ) ;
125
125
}
126
126
events . emit ( 'log' , `Reading build config file: ${ path . resolve ( buildOpts . buildConfig ) } ` ) ;
127
127
const contents = fs . readFileSync ( buildOpts . buildConfig , 'utf-8' ) ;
@@ -211,7 +211,7 @@ module.exports.run = buildOpts => {
211
211
writeCodeSignStyle ( 'Automatic' ) ;
212
212
}
213
213
214
- return Q . nfcall ( fs . writeFile , path . join ( __dirname , '..' , 'build-extras.xcconfig' ) , extraConfig , 'utf-8' ) ;
214
+ return fs . writeFile ( path . join ( __dirname , '..' , 'build-extras.xcconfig' ) , extraConfig , 'utf-8' ) ;
215
215
} ) . then ( ( ) => {
216
216
const configuration = buildOpts . release ? 'Release' : 'Debug' ;
217
217
@@ -277,7 +277,7 @@ module.exports.run = buildOpts => {
277
277
return spawn ( 'xcodebuild' , xcodearchiveArgs , { cwd : projectPath , printCommand : true , stdio : 'inherit' } ) ;
278
278
}
279
279
280
- return Q . nfcall ( fs . writeFile , exportOptionsPath , exportOptionsPlist , 'utf-8' )
280
+ return fs . writeFile ( exportOptionsPath , exportOptionsPlist , 'utf-8' )
281
281
. then ( checkSystemRuby )
282
282
. then ( packageArchive ) ;
283
283
} ) ;
@@ -293,14 +293,14 @@ function findXCodeProjectIn (projectPath) {
293
293
const xcodeProjFiles = fs . readdirSync ( projectPath ) . filter ( name => path . extname ( name ) === '.xcodeproj' ) ;
294
294
295
295
if ( xcodeProjFiles . length === 0 ) {
296
- return Q . reject ( `No Xcode project found in ${ projectPath } ` ) ;
296
+ return Promise . reject ( new CordovaError ( `No Xcode project found in ${ projectPath } ` ) ) ;
297
297
}
298
298
if ( xcodeProjFiles . length > 1 ) {
299
299
events . emit ( 'warn' , `Found multiple .xcodeproj directories in \n${ projectPath } \nUsing first one` ) ;
300
300
}
301
301
302
302
const projectName = path . basename ( xcodeProjFiles [ 0 ] , '.xcodeproj' ) ;
303
- return Q . resolve ( projectName ) ;
303
+ return Promise . resolve ( projectName ) ;
304
304
}
305
305
306
306
module . exports . findXCodeProjectIn = findXCodeProjectIn ;
0 commit comments