@@ -194,7 +194,9 @@ class Embark {
194194 engine . startService ( "libraryManager" ) ;
195195 engine . startService ( "codeRunner" ) ;
196196 engine . startService ( "web3" ) ;
197- engine . startService ( "pipeline" ) ;
197+ if ( ! options . onlyCompile ) {
198+ engine . startService ( "pipeline" ) ;
199+ }
198200 engine . startService ( "deployment" , { onlyCompile : options . onlyCompile } ) ;
199201 engine . startService ( "storage" ) ;
200202 engine . startService ( "codeGenerator" ) ;
@@ -206,21 +208,30 @@ class Embark {
206208 } ) ;
207209 } ,
208210 function waitForWriteFinish ( callback ) {
211+ if ( options . onlyCompile ) {
212+ engine . logger . info ( "Finished compiling" . underline ) ;
213+ return callback ( null , true ) ;
214+ }
209215 engine . logger . info ( "Finished deploying" . underline ) ;
210- // Necessary log for simple projects. This event is trigger to soon because there is no file
211- // Also, not exiting straight after the deploy leaves time for async afterDeploys to finish
212- engine . logger . info ( "If you have no files to build, you can exit now with CTRL+C" ) ;
213- engine . events . on ( 'outputDone' , callback ) ;
216+ if ( ! engine . config . assetFiles || ! Object . keys ( engine . config . assetFiles ) . length ) {
217+ return callback ( ) ;
218+ }
219+ engine . events . on ( 'outputDone' , ( err ) => {
220+ engine . logger . info ( __ ( "finished building" ) . underline ) ;
221+ callback ( err , true ) ;
222+ } ) ;
214223 }
215- ] , function ( err , _result ) {
224+ ] , function ( err , canExit ) {
216225 if ( err ) {
217226 engine . logger . error ( err . message ) ;
218227 engine . logger . debug ( err . stack ) ;
219- } else {
220- engine . logger . info ( __ ( "finished building" ) . underline ) ;
221228 }
222- // needed due to child processes
223- process . exit ( ) ;
229+
230+ if ( canExit || ! engine . config . contractsConfig . afterDeploy || ! engine . config . contractsConfig . afterDeploy . length ) {
231+ process . exit ( ) ;
232+ }
233+ engine . logger . info ( __ ( 'Waiting for after deploy to finish...' ) ) ;
234+ engine . logger . info ( __ ( 'You can exit with CTRL+C when after deploy completes' ) ) ;
224235 } ) ;
225236 }
226237
0 commit comments