@@ -55,6 +55,7 @@ function prepareDebPackage(arch) {
5555 . pipe ( replace ( '@@NAME_LONG@@' , product . nameLong ) )
5656 . pipe ( replace ( '@@NAME_SHORT@@' , product . nameShort ) )
5757 . pipe ( replace ( '@@NAME@@' , product . applicationName ) )
58+ . pipe ( replace ( '@@ICON@@' , product . applicationName ) )
5859 . pipe ( rename ( 'usr/share/applications/' + product . applicationName + '.desktop' ) ) ;
5960
6061 const appdata = gulp . src ( 'resources/linux/code.appdata.xml' , { base : '.' } )
@@ -131,6 +132,7 @@ function prepareRpmPackage(arch) {
131132 . pipe ( replace ( '@@NAME_LONG@@' , product . nameLong ) )
132133 . pipe ( replace ( '@@NAME_SHORT@@' , product . nameShort ) )
133134 . pipe ( replace ( '@@NAME@@' , product . applicationName ) )
135+ . pipe ( replace ( '@@ICON@@' , product . applicationName ) )
134136 . pipe ( rename ( 'BUILD/usr/share/applications/' + product . applicationName + '.desktop' ) ) ;
135137
136138 const appdata = gulp . src ( 'resources/linux/code.appdata.xml' , { base : '.' } )
@@ -178,6 +180,51 @@ function buildRpmPackage(arch) {
178180 'cp "' + rpmOut + '/$(ls ' + rpmOut + ')" ' + destination + '/'
179181 ] ) ;
180182}
183+ function getSnapBuildPath ( arch ) {
184+ return `.build/linux/snap/${ arch } /${ product . applicationName } -${ arch } ` ;
185+ }
186+
187+ function prepareSnapPackage ( arch ) {
188+ const binaryDir = '../VSCode-linux-' + arch ;
189+ const destination = getSnapBuildPath ( arch ) ;
190+
191+ return function ( ) {
192+ const desktop = gulp . src ( 'resources/linux/code.desktop' , { base : '.' } )
193+ . pipe ( replace ( '@@NAME_LONG@@' , product . nameLong ) )
194+ . pipe ( replace ( '@@NAME_SHORT@@' , product . nameShort ) )
195+ . pipe ( replace ( '@@NAME@@' , product . applicationName ) )
196+ . pipe ( replace ( '@@ICON@@' , `/usr/share/pixmaps/${ product . applicationName } .png` ) )
197+ . pipe ( rename ( `usr/share/applications/${ product . applicationName } .desktop` ) ) ;
198+
199+ const icon = gulp . src ( 'resources/linux/code.png' , { base : '.' } )
200+ . pipe ( rename ( `usr/share/pixmaps/${ product . applicationName } .png` ) ) ;
201+
202+ const code = gulp . src ( binaryDir + '/**/*' , { base : binaryDir } )
203+ . pipe ( rename ( function ( p ) { p . dirname = 'usr/share/' + product . applicationName + '/' + p . dirname ; } ) ) ;
204+
205+ const snapcraft = gulp . src ( 'resources/linux/snap/snapcraft.yaml' , { base : '.' } )
206+ . pipe ( replace ( '@@NAME@@' , product . applicationName ) )
207+ . pipe ( replace ( '@@VERSION@@' , packageJson . version ) )
208+ . pipe ( replace ( '@@EPOCH@@' , linuxPackageRevision ) )
209+ . pipe ( rename ( 'snap/snapcraft.yaml' ) ) ;
210+
211+ const electronLaunch = gulp . src ( 'resources/linux/snap/electron-launch' , { base : '.' } )
212+ . pipe ( rename ( 'electron-launch' ) ) ;
213+
214+ const all = es . merge ( desktop , icon , code , snapcraft , electronLaunch ) ;
215+
216+ return all . pipe ( vfs . dest ( destination ) ) ;
217+ } ;
218+ }
219+
220+ function buildSnapPackage ( arch ) {
221+ const snapBuildPath = getSnapBuildPath ( arch ) ;
222+
223+ return shell . task ( [
224+ `chmod +x ${ snapBuildPath } /electron-launch` ,
225+ `cd ${ snapBuildPath } && snapcraft snap`
226+ ] ) ;
227+ }
181228
182229function getFlatpakArch ( arch ) {
183230 return { x64 : 'x86_64' , ia32 : 'i386' , arm : 'arm' } [ arch ] ;
@@ -273,6 +320,10 @@ gulp.task('vscode-linux-ia32-build-rpm', ['vscode-linux-ia32-prepare-rpm'], buil
273320gulp . task ( 'vscode-linux-x64-build-rpm' , [ 'vscode-linux-x64-prepare-rpm' ] , buildRpmPackage ( 'x64' ) ) ;
274321gulp . task ( 'vscode-linux-arm-build-rpm' , [ 'vscode-linux-arm-prepare-rpm' ] , buildRpmPackage ( 'arm' ) ) ;
275322
323+ gulp . task ( 'clean-vscode-linux-x64-snap' , util . rimraf ( '.build/linux/snap/x64' ) ) ;
324+ gulp . task ( 'vscode-linux-x64-prepare-snap' , [ 'clean-vscode-linux-x64-snap' ] , prepareSnapPackage ( 'x64' ) ) ;
325+ gulp . task ( 'vscode-linux-x64-build-snap' , [ 'vscode-linux-x64-prepare-snap' ] , buildSnapPackage ( 'x64' ) ) ;
326+
276327gulp . task ( 'clean-vscode-linux-ia32-flatpak' , util . rimraf ( '.build/linux/flatpak/i386' ) ) ;
277328gulp . task ( 'clean-vscode-linux-x64-flatpak' , util . rimraf ( '.build/linux/flatpak/x86_64' ) ) ;
278329gulp . task ( 'clean-vscode-linux-arm-flatpak' , util . rimraf ( '.build/linux/flatpak/arm' ) ) ;
0 commit comments