@@ -378,29 +378,15 @@ export abstract class CodeBuilder {
378378 const oldParamsPath = `${ paramsPath } .old` ;
379379 const prevParams : BuilderParams | undefined = File . IsFile ( oldParamsPath ) ? JSON . parse ( fs . readFileSync ( oldParamsPath , 'utf8' ) ) : undefined ;
380380 const sourceInfo = this . genSourceInfo ( prevParams ) ;
381-
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- }
381+ const builderModeList : string [ ] = [ ] ; // build mode
396382
397383 const builderOptions : BuilderParams = {
398384 name : config . name ,
399385 target : this . project . getCurrentTarget ( ) ,
400386 toolchain : toolchain . name ,
401387 toolchainLocation : toolchain . getToolchainDir ( ) . path ,
402388 toolchainCfgFile : toolchain . modelName ,
403- buildMode : builderModeList . map ( str => str . toLowerCase ( ) ) . join ( '|' ) ,
389+ buildMode : 'fast|multhread' ,
404390 showRepathOnLog : settingManager . isPrintRelativePathWhenBuild ( ) ,
405391 threadNum : settingManager . getThreadNumber ( ) ,
406392 rootDir : this . project . GetRootDir ( ) . path ,
@@ -445,28 +431,48 @@ export abstract class CodeBuilder {
445431 // generate hash for compiler options
446432 builderOptions . sha = this . genHashFromCompilerOptions ( builderOptions ) ;
447433
448- // check whether need rebuild project
449- if ( this . isRebuild ( ) == false && prevParams ) {
450- try {
451- // not found hash from old params file
452- if ( prevParams . sha == undefined ) {
453- this . enableRebuild ( ) ;
454- }
434+ // set build mode
435+ {
436+ // check whether need rebuild project
437+ if ( this . isRebuild ( ) == false && prevParams ) {
438+ try {
439+ // not found hash from old params file
440+ if ( prevParams . sha == undefined ) {
441+ this . enableRebuild ( ) ;
442+ }
455443
456- // check hash obj by specifies keys
457- else {
458- const keyList = [ 'global' , 'c/cpp-defines' , 'c/cpp-compiler' , 'asm-compiler' ] ;
459- for ( const key of keyList ) {
460- if ( ! this . compareHashObj ( key , prevParams . sha , builderOptions . sha ) ) {
461- this . enableRebuild ( ) ;
462- break ;
444+ // check hash obj by specifies keys
445+ else {
446+ const keyList = [ 'global' , 'c/cpp-defines' , 'c/cpp-compiler' , 'asm-compiler' ] ;
447+ for ( const key of keyList ) {
448+ if ( ! this . compareHashObj ( key , prevParams . sha , builderOptions . sha ) ) {
449+ this . enableRebuild ( ) ;
450+ break ;
451+ }
463452 }
464453 }
454+ } catch ( error ) {
455+ this . enableRebuild ( ) ; // make rebuild
456+ GlobalEvent . emit ( 'msg' , ExceptionToMessage ( error , 'Hidden' ) ) ;
465457 }
466- } catch ( error ) {
467- this . enableRebuild ( ) ; // make rebuild
468- GlobalEvent . emit ( 'msg' , ExceptionToMessage ( error , 'Hidden' ) ) ;
469458 }
459+
460+ if ( config . toolchain === 'Keil_C51' ) { // disable increment compile for Keil C51
461+ builderModeList . push ( 'normal' ) ;
462+ } else {
463+ builderModeList . push ( this . isRebuild ( ) ? 'normal' : 'fast' ) ;
464+ }
465+
466+ if ( settingManager . isUseMultithreadMode ( ) ) {
467+ builderModeList . push ( 'multhread' ) ;
468+ }
469+
470+ if ( this . useShowParamsMode ) {
471+ builderModeList . push ( 'debug' ) ;
472+ }
473+
474+ // set build mode
475+ builderOptions . buildMode = builderModeList . map ( str => str . toLowerCase ( ) ) . join ( '|' ) ;
470476 }
471477
472478 // write project build params
0 commit comments