1818
1919import { ArchiveFileAsset , Downloadable , Downloader , GitHubReleaseAsset , WebFileAsset } from '@open-cmsis-pack/vsce-helper' ;
2020import { PackageJson } from 'type-fest' ;
21+ import fs from 'node:fs/promises' ;
22+ import path from 'node:path' ;
2123
2224type CmsisPackageJson = PackageJson & {
2325 cmsis : {
@@ -64,6 +66,16 @@ const pyocd : Downloadable = new Downloadable(
6466 } ,
6567)
6668
69+ class GDBArchiveFileAsset extends ArchiveFileAsset {
70+ public async copyTo ( dest ?: string ) {
71+ dest = await super . copyTo ( dest ) ;
72+ // Remove doc directory as it contains duplicate files (names differ only in case)
73+ // which are not supported by ZIP (VSIX) archives
74+ await fs . rm ( path . join ( dest , 'share' , 'doc' ) , { recursive : true , force : true } ) ;
75+ return dest ;
76+ }
77+ }
78+
6779const gdb : Downloadable = new Downloadable (
6880 'GNU Debugger for Arm' , 'gdb' ,
6981 async ( target ) => {
@@ -81,7 +93,7 @@ const gdb : Downloadable = new Downloadable(
8193 const asset_name = `arm-gnu-toolchain-${ build } -arm-none-eabi-gdb.${ ext } ` ;
8294 const url = new URL ( `https://artifacts.tools.arm.com/arm-none-eabi-gdb/${ version } /${ asset_name } ` ) ;
8395 const dlAsset = new WebFileAsset ( url , asset_name , version ) ;
84- const asset = new ArchiveFileAsset ( dlAsset , strip ) ;
96+ const asset = new GDBArchiveFileAsset ( dlAsset , strip ) ;
8597 return asset ;
8698 } ,
8799) ;
0 commit comments