@@ -23,6 +23,21 @@ import { getRuntimeDependenciesPackages } from '../src/tools/RuntimeDependencyPa
2323import { getAbsolutePathPackagesToInstall } from '../src/packageManager/getAbsolutePathPackagesToInstall' ;
2424import { isValidDownload } from '../src/packageManager/isValidDownload' ;
2525
26+ export const offlinePackages = [
27+ { platformInfo : new PlatformInformation ( 'win32' , 'x86_64' ) , id : "win32-x64" } ,
28+ { platformInfo : new PlatformInformation ( 'win32' , 'x86' ) , id : "win32-ia32" } ,
29+ { platformInfo : new PlatformInformation ( 'win32' , 'arm64' ) , id : "win32-arm64" } ,
30+ { platformInfo : new PlatformInformation ( 'linux' , 'x86_64' ) , id : "linux-x64" } ,
31+ { platformInfo : new PlatformInformation ( 'darwin' , 'x86_64' ) , id : "darwin-x64" } ,
32+ { platformInfo : new PlatformInformation ( 'darwin' , 'arm64' ) , id : "darwin-arm64" } ,
33+ ] ;
34+
35+ export function getPackageName ( packageJSON : any , vscodePlatformId : string ) {
36+ const name = packageJSON . name ;
37+ const version = packageJSON . version ;
38+ return `${ name } .${ version } -${ vscodePlatformId } .vsix` ;
39+ }
40+
2641gulp . task ( 'vsix:offline:package' , async ( ) => {
2742
2843 if ( process . platform === 'win32' ) {
@@ -53,44 +68,30 @@ async function doPackageOffline() {
5368 }
5469
5570 const packageJSON = getPackageJSON ( ) ;
56- const name = packageJSON . name ;
57- const version = packageJSON . version ;
58- const packageName = name + '.' + version ;
59-
60- const packages = [
61- { platformInfo : new PlatformInformation ( 'win32' , 'x86_64' ) , id : "win32-x64" } ,
62- { platformInfo : new PlatformInformation ( 'win32' , 'x86' ) , id : "win32-ia32" } ,
63- { platformInfo : new PlatformInformation ( 'win32' , 'arm64' ) , id : "win32-arm64" } ,
64- { platformInfo : new PlatformInformation ( 'linux' , 'x86_64' ) , id : "linux-x64" } ,
65- { platformInfo : new PlatformInformation ( 'darwin' , 'x86_64' ) , id : "darwin-x64" } ,
66- { platformInfo : new PlatformInformation ( 'darwin' , 'arm64' ) , id : "darwin-arm64" } ,
67- ] ;
68-
69- for ( let p of packages ) {
70- try
71- {
72- await doOfflinePackage ( p . platformInfo , p . id , packageName , packageJSON , packedVsixOutputRoot ) ;
71+
72+ for ( let p of offlinePackages ) {
73+ try {
74+ await doOfflinePackage ( p . platformInfo , p . id , packageJSON , packedVsixOutputRoot ) ;
7375 }
74- catch ( err )
75- {
76- // NOTE: Extra `\n---` at the end is because gulp will print this message following by the
76+ catch ( err ) {
77+ // NOTE: Extra `\n---` at the end is because gulp will print this message following by the
7778 // stack trace of this line. So that seperates the two stack traces.
7879 throw Error ( `Failed to create package ${ p . id } . ${ err . stack ?? err ?? '<unknown error>' } \n---` ) ;
7980 }
8081 }
8182}
8283
8384async function cleanAsync ( deleteVsix : boolean ) {
84- await del ( [ 'install.*' , '.omnisharp*' , '.debugger' , '.razor' ] ) ;
85+ await del ( [ 'install.*' , '.omnisharp*' , '.debugger' , '.razor' ] ) ;
8586
8687 if ( deleteVsix ) {
8788 await del ( '*.vsix' ) ;
8889 }
8990}
9091
91- async function doOfflinePackage ( platformInfo : PlatformInformation , vscodePlatformId : string , packageName : string , packageJSON : any , outputFolder : string ) {
92+ async function doOfflinePackage ( platformInfo : PlatformInformation , vscodePlatformId : string , packageJSON : any , outputFolder : string ) {
9293 await cleanAsync ( false ) ;
93- const packageFileName = ` ${ packageName } - ${ vscodePlatformId } .vsix` ;
94+ const packageFileName = getPackageName ( packageJSON , vscodePlatformId ) ;
9495 await install ( platformInfo , packageJSON ) ;
9596 await createPackageAsync ( packageFileName , outputFolder , vscodePlatformId ) ;
9697}
@@ -104,14 +105,13 @@ async function install(platformInfo: PlatformInformation, packageJSON: any) {
104105 let runTimeDependencies = getRuntimeDependenciesPackages ( packageJSON ) ;
105106 let packagesToInstall = await getAbsolutePathPackagesToInstall ( runTimeDependencies , platformInfo , codeExtensionPath ) ;
106107 let provider = ( ) => new NetworkSettings ( undefined , undefined ) ;
107- if ( ! ( await downloadAndInstallPackages ( packagesToInstall , provider , eventStream , isValidDownload ) ) )
108- {
108+ if ( ! ( await downloadAndInstallPackages ( packagesToInstall , provider , eventStream , isValidDownload ) ) ) {
109109 throw Error ( "Failed to download package." ) ;
110110 }
111111
112112 // The VSIX Format doesn't allow files that differ only by case. The Linux OmniSharp package had a lowercase version of these files ('.targets') targets from mono,
113113 // and an upper case ('.Targets') from Microsoft.Build.Runtime. Remove the lowercase versions.
114- await del ( [ '.omnisharp/*/omnisharp/.msbuild/Current/Bin/Workflow.targets' , '.omnisharp/*/omnisharp/.msbuild/Current/Bin/Workflow.VisualBasic.targets' ] ) ;
114+ await del ( [ '.omnisharp/*/omnisharp/.msbuild/Current/Bin/Workflow.targets' , '.omnisharp/*/omnisharp/.msbuild/Current/Bin/Workflow.VisualBasic.targets' ] ) ;
115115}
116116
117117/// Packaging (VSIX) Tasks
0 commit comments