@@ -65,7 +65,9 @@ export class DependenceManager implements ManagerInterface {
6565 }
6666
6767 InstallComponent ( packName : string , component : Component ) {
68+ GlobalEvent . emit ( 'globalLog.append' , `[Info] Install CMSIS Component: ${ component . groupName } \n` ) ;
6869 this . _installComponent ( packName , component , [ component . groupName ] ) ;
70+ GlobalEvent . emit ( 'globalLog.append' , `[Info] Done.\n` ) ;
6971 }
7072
7173 private _installComponent ( packName : string , component : Component , pendingList : string [ ] ) {
@@ -77,25 +79,30 @@ export class DependenceManager implements ManagerInterface {
7779
7880 /* 安装此组件的依赖项 */
7981 if ( component . condition ) {
80- const r = packageManager . CheckConditionRequire ( component . condition , toolchain ) ;
81- if ( r == false )
82- throw new Error ( `This condition '${ component . condition } ' is not met for component: '${ component . groupName } '` ) ;
83- if ( Array . isArray ( r ) ) {
84- for ( const comp of r ) {
85- const compName = comp . replace ( 'Device.' , '' ) ;
86- if ( ! comp . startsWith ( 'Device.' ) )
82+ const result = packageManager . CheckConditionRequire ( component . condition , toolchain ) ;
83+ if ( result == false )
84+ throw new Error ( `Condition '${ component . condition } ' is not fit for this component: '${ component . groupName } '` ) ;
85+ if ( Array . isArray ( result ) ) {
86+ for ( const fullname of result ) {
87+ if ( ! fullname . startsWith ( 'Device.' ) )
8788 continue ; /* 排除非 Device 类型的组件 */
88- if ( this . isInstalled ( packName , compName ) )
89+ const requiredName = fullname . replace ( 'Device.' , '' ) ;
90+ if ( this . isInstalled ( packName , requiredName ) )
8991 continue ; /* 排除已安装的 */
90- if ( pendingList . includes ( compName ) )
92+ if ( pendingList . includes ( requiredName ) )
9193 continue ; /* 排除队列中已存在的 */
92- const t = packageManager . FindComponent ( compName ) ;
93- if ( t ) {
94- pendingList . push ( compName ) ;
95- this . _installComponent ( packName , t , pendingList ) ;
96- pendingList . pop ( ) ;
94+ const compList = packageManager . FindAllComponents ( requiredName ) ;
95+ if ( compList ) {
96+ for ( const item of compList ) {
97+ pendingList . push ( item . groupName ) ;
98+ GlobalEvent . emit ( 'globalLog.append' , `[Info] ${ ' ' . repeat ( pendingList . length ) } -> install dependence component: ${ item . groupName } \n` ) ;
99+ this . _installComponent ( packName , item , pendingList ) ;
100+ pendingList . pop ( ) ;
101+ }
97102 } else {
98- throw new Error ( `Not found required sub component: '${ comp } '` ) ;
103+ //throw new Error(`Not found required sub component: '${comp}'`);
104+ GlobalEvent . emit ( 'globalLog.append' ,
105+ `[Warn] ${ ' ' . repeat ( pendingList . length ) } Not found required sub component: '${ comp } '\n` ) ;
99106 }
100107 }
101108 }
0 commit comments