@@ -138,7 +138,7 @@ export function findLatestServeD(force: boolean = false, channel?: string): Then
138138 if ( channel == "frozen" && force )
139139 channel = "stable" ;
140140
141- if ( channel == "frozen" )
141+ if ( channel == "frozen" || config ( null ) . get ( "forceCompileServeD" , false ) )
142142 return Promise . resolve ( undefined ) ;
143143
144144 if ( servedVersionCache . channel == channel )
@@ -340,7 +340,7 @@ export function updateAndInstallServeD(env: any): Thenable<boolean | undefined>
340340 vscode . commands . executeCommand ( "workbench.action.openGlobalSettings" ) ;
341341 return Promise . resolve ( undefined ) ;
342342 } ) ;
343- } else if ( ! version . asset ) {
343+ } else if ( ! version . asset || config ( null ) . get ( "forceCompileServeD" , false ) ) {
344344 return compileServeD ( "master" ) ( env ) ;
345345 } else {
346346 return installServeD ( [ { url : version . asset . browser_download_url , title : "Serve-D" } ] , version . name ) ( env ) ;
@@ -482,33 +482,33 @@ export function extractServedBuiltDate(log: string): Date | false {
482482}
483483
484484export function compileServeD ( ref ?: string ) : ( env : NodeJS . ProcessEnv ) => Promise < boolean | undefined > {
485- return ( env : any ) => new Promise < boolean | undefined > ( ( resolve ) => {
485+ return ( env : any ) => new Promise < boolean | undefined > ( async ( ) => {
486486 var outputFolder = determineOutputFolder ( ) ;
487487 mkdirp . sync ( outputFolder ) ;
488- fs . exists ( outputFolder , async function ( exists ) {
489- const dubPath = config ( null ) . get ( "dubPath " , "dub" ) ;
490- const dmdPath = config ( null ) . get ( "dmdPath " , undefined ) ;
491- if ( ! exists )
492- fs . mkdirSync ( outputFolder ) ;
493- env [ "DFLAGS" ] = "-O -release" ;
494- let buildArgs = [ "build" ] ;
495- if ( process . platform == "win32" ) {
496- env [ "DFLAGS" ] = "-release" ;
497- buildArgs . push ( "--arch=x86_mscoff" ) ;
498- }
499- if ( dubPath != "dub" && dmdPath ) {
500- // explicit dub path specified, it won't automatically find dmd if it's not in the same folder so we just pass the path if we have it
501- buildArgs . push ( "--compiler=" + dmdPath ) ;
502- }
503- await compileDependency ( outputFolder , "serve-d" , "https://github.com/Pure-D/serve-d.git" , [
504- [ dubPath , [ "upgrade" ] ] ,
505- [ dubPath , buildArgs ]
506- ] , env , ref ) ;
507- var finalDestination = path . join ( outputFolder , "serve-d" , "serve-d" + ( process . platform == "win32" ? ".exe" : "" ) ) ;
508-
509- await config ( null ) . update ( "servedPath" , finalDestination , true ) ;
510- resolve ( true ) ;
511- } ) ;
488+ const dubPath = config ( null ) . get ( "dubPath" , "dub" ) ;
489+ const dmdPath = config ( null ) . get ( "dmdPath " , undefined ) ;
490+ const dubCompiler = config ( null ) . get ( "dubCompiler " , undefined ) ;
491+ env [ "DFLAGS" ] = "-O -release" ;
492+ let buildArgs = [ "build" ] ;
493+ if ( process . platform == "win32" ) {
494+ env [ "DFLAGS" ] = "-release" ;
495+ buildArgs . push ( "--arch=x86_mscoff" ) ;
496+ }
497+ if ( dubCompiler ) {
498+ buildArgs . push ( "--compiler=" + dubCompiler ) ;
499+ }
500+ else if ( dubPath != "dub" && dmdPath ) {
501+ // explicit dub path specified, it won't automatically find dmd if it's not in the same folder so we just pass the path if we have it
502+ buildArgs . push ( "--compiler=" + dmdPath ) ;
503+ }
504+ await compileDependency ( outputFolder , "serve-d" , "https://github.com/Pure-D/serve-d.git" , [
505+ [ dubPath , [ "upgrade" ] ] ,
506+ [ dubPath , buildArgs ]
507+ ] , env , ref ) ;
508+ var finalDestination = path . join ( outputFolder , "serve-d" , "serve-d" + ( process . platform == "win32" ? ".exe" : "" ) ) ;
509+
510+ await config ( null ) . update ( "servedPath" , finalDestination , true ) ;
511+ return true ;
512512 } ) ;
513513}
514514
0 commit comments