@@ -62,6 +62,9 @@ export interface BuilderParams {
6262 name : string ;
6363 target : string ;
6464 toolchain : ToolchainName ;
65+ toolchainCfgFile : string ;
66+ toolchainLocation : string ;
67+ buildMode : string ;
6568 showRepathOnLog ?: boolean ,
6669 threadNum ?: number ;
6770 dumpPath : string ;
@@ -134,7 +137,7 @@ export abstract class CodeBuilder {
134137
135138 // append user options for files
136139 try {
137- const options = this . project . getFilesOptions ( ) ;
140+ const options = this . project . getSourceExtraArgsCfg ( ) ;
138141
139142 // parser
140143 const matcher = ( parttenInfo : any , fieldName : string ) => {
@@ -145,11 +148,13 @@ export abstract class CodeBuilder {
145148 . replace ( / \. \. \/ / g, '' )
146149 . replace ( / \. \/ / g, '' ) ; // globmatch bug ? it can't parse path which have '.' or '..'
147150 if ( globmatch . isMatch ( searchPath , expr ) ) {
148- const val = parttenInfo [ expr ] ?. trim ( ) . replace ( / (?: \r \n | \n ) $ / , '' )
149- if ( srcParams [ srcInf . path ] ) {
150- srcParams [ srcInf . path ] += ` ${ val || '' } `
151- } else {
152- srcParams [ srcInf . path ] = val || '' ;
151+ const val = parttenInfo [ expr ] ?. trim ( ) . replace ( / (?: \r \n | \n ) $ / , '' ) ;
152+ if ( val ) {
153+ if ( srcParams [ srcInf . path ] ) {
154+ srcParams [ srcInf . path ] += ` ${ val } `
155+ } else {
156+ srcParams [ srcInf . path ] = val ;
157+ }
153158 }
154159 }
155160 }
@@ -191,7 +196,7 @@ export abstract class CodeBuilder {
191196 let mTimeMs : number | undefined ;
192197
193198 try {
194- mTimeMs = fs . statSync ( this . project . getFilesOptionsFile ( ) . path ) . mtimeMs
199+ mTimeMs = fs . statSync ( this . project . getSourceExtraArgsCfgFile ( ) . path ) . mtimeMs
195200 } catch ( error ) {
196201 // do nothing
197202 }
@@ -364,22 +369,38 @@ export abstract class CodeBuilder {
364369 const settingManager = SettingManager . GetInstance ( ) ;
365370 const toolchain = this . project . getToolchain ( ) ;
366371
367- const binDir = toolchain . getToolchainDir ( ) . path ;
368372 const dumpDir = this . project . getLogDir ( ) . path ;
369373 const outDir = File . ToUnixPath ( this . project . getOutputDir ( ) ) ;
370374 const paramsPath = this . project . ToAbsolutePath ( outDir + File . sep + this . paramsFileName ) ;
371375 const compileOptions : ICompileOptions = this . project . GetConfiguration ( )
372376 . compileConfigModel . getOptions ( this . project . getEideDir ( ) . path , config ) ;
373377 const memMaxSize = this . getMaxSize ( ) ;
374- const modeList : string [ ] = [ ] ;
375378 const oldParamsPath = `${ paramsPath } .old` ;
376379 const prevParams : BuilderParams | undefined = File . IsFile ( oldParamsPath ) ? JSON . parse ( fs . readFileSync ( oldParamsPath , 'utf8' ) ) : undefined ;
377380 const sourceInfo = this . genSourceInfo ( prevParams ) ;
378381
382+ // set build mode
383+ const builderModeList : string [ ] = [ ] ;
384+
385+ if ( config . toolchain === 'Keil_C51' ) {
386+ // disable increment compile for Keil C51
387+ builderModeList . push ( 'Normal' ) ;
388+ } else {
389+ builderModeList . push ( this . isRebuild ( ) ? 'Normal' : 'Fast' ) ;
390+ if ( settingManager . isUseMultithreadMode ( ) ) { builderModeList . push ( 'MULTHREAD' ) ; }
391+ }
392+
393+ if ( this . useShowParamsMode ) {
394+ builderModeList . push ( 'Debug' ) ;
395+ }
396+
379397 const builderOptions : BuilderParams = {
380398 name : config . name ,
381399 target : this . project . getCurrentTarget ( ) ,
382400 toolchain : toolchain . name ,
401+ toolchainLocation : toolchain . getToolchainDir ( ) . path ,
402+ toolchainCfgFile : toolchain . modelName ,
403+ buildMode : builderModeList . map ( str => str . toLowerCase ( ) ) . join ( '|' ) ,
383404 showRepathOnLog : settingManager . isPrintRelativePathWhenBuild ( ) ,
384405 threadNum : settingManager . getThreadNumber ( ) ,
385406 rootDir : this . project . GetRootDir ( ) . path ,
@@ -448,23 +469,6 @@ export abstract class CodeBuilder {
448469 }
449470 }
450471
451- // set build mode
452- if ( config . toolchain === 'Keil_C51' ) {
453- // disable fast compile for Keil C51
454- modeList . push ( 'Normal' ) ;
455- } else {
456- modeList . push ( this . isRebuild ( ) ? 'Normal' : 'Fast' ) ;
457- }
458-
459- if ( this . useShowParamsMode ) {
460- modeList . push ( 'Debug' ) ;
461- }
462-
463- // disable multi-thread in Keil_C51
464- if ( settingManager . isUseMultithreadMode ( ) && config . toolchain !== 'Keil_C51' ) {
465- modeList . push ( 'MULTHREAD' ) ;
466- }
467-
468472 // write project build params
469473 fs . writeFileSync ( paramsPath , JSON . stringify ( builderOptions , undefined , 4 ) ) ;
470474
@@ -479,10 +483,7 @@ export abstract class CodeBuilder {
479483 }
480484
481485 let cmds = [
482- '-b' , binDir ,
483- '-M' , toolchain . modelName ,
484486 '-p' , paramsPath ,
485- '-m' , modeList . join ( '-' )
486487 ] ;
487488
488489 const extraCmd = settingManager . getBuilderAdditionalCommandLine ( ) ?. trim ( ) ;
0 commit comments