@@ -40,6 +40,7 @@ import { AbstractProject } from './EIDEProject';
4040import { ExceptionToMessage , newMessage } from './Message' ;
4141import { ResManager } from './ResManager' ;
4242import { ExeCmd } from '../lib/node-utility/Executable' ;
43+ import { ArrayDelRepetition } from '../lib/node-utility/Utility' ;
4344
4445export enum ComponentUpdateType {
4546 Disabled = 1 ,
@@ -326,7 +327,7 @@ export class PackageManager {
326327 }
327328
328329 private _checkConditionGroup ( gMap : ConditionMap ,
329- cGroup : ConditionGroup , cDev : CurrentDevice , toolchain ?: IToolchian ) : boolean {
330+ cGroup : ConditionGroup , cDev : CurrentDevice , comp_requires : string [ ] , toolchain ?: IToolchian ) : boolean {
330331
331332 const familyInfo = cDev . packInfo . familyList [ cDev . familyIndex ] ;
332333 const devInfo = this . getCurrentDevInfo ( cDev ) ;
@@ -356,11 +357,15 @@ export class PackageManager {
356357 return false ;
357358 }
358359
360+ if ( con . component ) {
361+ comp_requires . push ( con . component ) ;
362+ }
363+
359364 if ( con . condition && ! this . _recurseList . includes ( con . condition ) ) {
360365 const _group = gMap . get ( con . condition ) ;
361366 if ( _group ) {
362367 this . _recurseList . push ( con . condition ) ;
363- if ( ! this . _checkConditionGroup ( gMap , _group , cDev , toolchain ) ) {
368+ if ( ! this . _checkConditionGroup ( gMap , _group , cDev , comp_requires , toolchain ) ) {
364369 return false ;
365370 }
366371 }
@@ -413,7 +418,7 @@ export class PackageManager {
413418 const _group = gMap . get ( con . condition ) ;
414419 if ( _group ) {
415420 this . _recurseList . push ( con . condition ) ;
416- if ( this . _checkConditionGroup ( gMap , _group , cDev , toolchain ) ) {
421+ if ( this . _checkConditionGroup ( gMap , _group , cDev , comp_requires , toolchain ) ) {
417422 passCount ++ ;
418423 }
419424 } else {
@@ -438,13 +443,36 @@ export class PackageManager {
438443 const cGroup = cMap . get ( conditionName ) ;
439444 if ( cGroup ) {
440445 this . _recurseList = [ conditionName ] ;
441- return this . _checkConditionGroup ( cMap , cGroup , this . currentDevice , toolchain ) ;
446+ return this . _checkConditionGroup ( cMap , cGroup , this . currentDevice , [ ] , toolchain ) ;
442447 }
443448 }
444449
445450 return true ;
446451 }
447452
453+ CheckConditionRequire ( conditionName : string , toolchain : IToolchian ) : string [ ] | boolean {
454+
455+ if ( this . currentDevice ) {
456+ const cMap = this . currentDevice . packInfo . conditionMap ;
457+ const cGroup = cMap . get ( conditionName ) ;
458+ if ( cGroup ) {
459+ this . _recurseList = [ conditionName ] ;
460+ const components : string [ ] = [ ] ;
461+ const pass = this . _checkConditionGroup ( cMap , cGroup , this . currentDevice , components , toolchain ) ;
462+ return pass ? ArrayDelRepetition ( components ) : false ;
463+ }
464+ }
465+
466+ return true ;
467+ }
468+
469+ makeComponentGroupName ( ...names : string [ ] ) : string {
470+ return names
471+ . filter ( n => n !== undefined )
472+ . join ( '.' )
473+ . replace ( / \s + / g, '' ) ;
474+ }
475+
448476 private _preHandleSubfamily ( family : any ) {
449477 let _subFamilyList : any [ ] = [ ] ;
450478 for ( const subFamily of ( < any [ ] > family . subFamily ) ) {
@@ -957,7 +985,7 @@ export class PackageManager {
957985 for ( let component of componentList ) {
958986
959987 const item : Component = {
960- groupName : component . $Cgroup + ( component . $Csub ? ( '.' + component . $Csub ) : '' ) ,
988+ groupName : this . makeComponentGroupName ( component . $Cgroup , component . $Csub ) ,
961989 enable : false ,
962990 description : component . description ,
963991 incDirList : [ ] ,
@@ -969,8 +997,6 @@ export class PackageManager {
969997 condition : component . $condition
970998 } ;
971999
972- item . groupName = item . groupName . replace ( / \s + / g, '' ) ;
973-
9741000 /* category component's files */
9751001
9761002 if ( Array . isArray ( component . files . file ) ) {
@@ -984,14 +1010,15 @@ export class PackageManager {
9841010
9851011 switch ( f . $category ) {
9861012 case 'include' :
987- if ( / \. (?: h | h p p | h x x | i n c ) $ / . test ( f . $name ) ) {
1013+ if ( AbstractProject . headerFilter . test ( f . $name ) ) {
9881014 item . headerList . push ( comp_item ) ;
9891015 } else {
9901016 item . incDirList . push ( comp_item ) ;
9911017 }
9921018 break ;
9931019 case 'header' :
994- item . headerList . push ( comp_item ) ;
1020+ if ( AbstractProject . headerFilter . test ( f . $name ) )
1021+ item . headerList . push ( comp_item ) ;
9951022 break ;
9961023 case 'source' :
9971024 case 'library' :
@@ -1075,6 +1102,9 @@ export class PackageManager {
10751102 . replace ( / \? / g, '.' )
10761103 . replace ( / \* / g, '.*?' ) , 'i' ) ;
10771104 }
1105+ if ( require . $Cclass && require . $Cgroup ) {
1106+ condition . component = this . makeComponentGroupName ( require . $Cclass , require . $Cgroup , require . $Csub ) ;
1107+ }
10781108
10791109 if ( Object . keys ( condition ) . length > 0 ) {
10801110 cGroup . requireList . push ( condition ) ;
0 commit comments