1717 * under the License.
1818 */
1919
20- const Q = require ( 'q' ) ;
2120const path = require ( 'path' ) ;
2221const which = require ( 'which' ) ;
2322const {
23+ CordovaError,
2424 events,
2525 superspawn : { spawn }
2626} = require ( 'cordova-common' ) ;
@@ -112,16 +112,16 @@ module.exports.run = buildOpts => {
112112 buildOpts = buildOpts || { } ;
113113
114114 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.' ) ) ;
116116 }
117117
118118 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.' ) ) ;
120120 }
121121
122122 if ( buildOpts . buildConfig ) {
123123 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 } ` ) ) ;
125125 }
126126 events . emit ( 'log' , `Reading build config file: ${ path . resolve ( buildOpts . buildConfig ) } ` ) ;
127127 const contents = fs . readFileSync ( buildOpts . buildConfig , 'utf-8' ) ;
@@ -211,7 +211,7 @@ module.exports.run = buildOpts => {
211211 writeCodeSignStyle ( 'Automatic' ) ;
212212 }
213213
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' ) ;
215215 } ) . then ( ( ) => {
216216 const configuration = buildOpts . release ? 'Release' : 'Debug' ;
217217
@@ -277,7 +277,7 @@ module.exports.run = buildOpts => {
277277 return spawn ( 'xcodebuild' , xcodearchiveArgs , { cwd : projectPath , printCommand : true , stdio : 'inherit' } ) ;
278278 }
279279
280- return Q . nfcall ( fs . writeFile , exportOptionsPath , exportOptionsPlist , 'utf-8' )
280+ return fs . writeFile ( exportOptionsPath , exportOptionsPlist , 'utf-8' )
281281 . then ( checkSystemRuby )
282282 . then ( packageArchive ) ;
283283 } ) ;
@@ -293,14 +293,14 @@ function findXCodeProjectIn (projectPath) {
293293 const xcodeProjFiles = fs . readdirSync ( projectPath ) . filter ( name => path . extname ( name ) === '.xcodeproj' ) ;
294294
295295 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 } ` ) ) ;
297297 }
298298 if ( xcodeProjFiles . length > 1 ) {
299299 events . emit ( 'warn' , `Found multiple .xcodeproj directories in \n${ projectPath } \nUsing first one` ) ;
300300 }
301301
302302 const projectName = path . basename ( xcodeProjFiles [ 0 ] , '.xcodeproj' ) ;
303- return Q . resolve ( projectName ) ;
303+ return Promise . resolve ( projectName ) ;
304304}
305305
306306module . exports . findXCodeProjectIn = findXCodeProjectIn ;
0 commit comments