2016-07-20 09:00:43 +00:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const gulp = require('gulp');
|
|
|
|
const replace = require('gulp-replace');
|
|
|
|
const rename = require('gulp-rename');
|
|
|
|
const es = require('event-stream');
|
2016-09-05 10:38:25 +00:00
|
|
|
const vfs = require('vinyl-fs');
|
2024-06-06 15:54:06 +00:00
|
|
|
const { rimraf } = require('./lib/util');
|
2022-10-05 17:05:40 +00:00
|
|
|
const { getVersion } = require('./lib/getVersion');
|
2019-02-12 14:13:43 +00:00
|
|
|
const task = require('./lib/task');
|
2016-07-20 09:00:43 +00:00
|
|
|
const packageJson = require('../package.json');
|
|
|
|
const product = require('../product.json');
|
2022-08-12 00:09:00 +00:00
|
|
|
const dependenciesGenerator = require('./linux/dependencies-generator');
|
2022-07-19 17:43:05 +00:00
|
|
|
const debianRecommendedDependencies = require('./linux/debian/dep-lists').recommendedDeps;
|
2018-12-19 14:02:19 +00:00
|
|
|
const path = require('path');
|
2024-06-06 15:54:06 +00:00
|
|
|
const cp = require('child_process');
|
|
|
|
const util = require('util');
|
|
|
|
|
|
|
|
const exec = util.promisify(cp.exec);
|
2018-12-19 14:02:19 +00:00
|
|
|
const root = path.dirname(__dirname);
|
2022-10-05 17:05:40 +00:00
|
|
|
const commit = getVersion(root);
|
2016-07-20 09:00:43 +00:00
|
|
|
|
Support building Flatpak bundles
This adds support for building Flatpak application bundles, which should be
runnable on any Linux distribution with Flatpak support. See the page at
http://flatpak.org/getting.html
New Gulp tasks are added to prepare a directory with the needed files
(vscode-linux-${arch}-prepare-flatpak), assembling the Flatpak bundles
(vscode-linux-${arch}-flatpak), and for cleaning the build directories
(clean-vscode-linux-${arch}-flatpak). This mimics how the Debian and RPM
package creation works. Hence, building an application bundle is done with:
$ gulp vscode-linux-x64-flatpak
[...]
$ ls *.flatpak
com.visualstudio.code.oss-x86_64.flatpak
Installing and running the application is achieved with:
$ flatpak --user install --bundle com.visualstudio.code.oss-x86_64.flatpak
$ flatpak run com.visualstudio.code.oss
(Removing "--user" would install the application system-wide. Also note that
the "org.freedesktop.Platform" runtime needs to be installeed, check the
Flatpak website for instructions.)
The "flatpak-bundler" development dependency provides an asynchronous API to
invoke "flatpak-builder". The "gulp-image-resize" module is used to
incorporate scaling of the application icon to multiple sizes, and uses
ImageMagick (or GraphicsMagick) under the hood, which is commonly available on
most GNU/Linux distributions.
Instead of building the Electron dependencies ourselves, this uses the
io.atom.electron.BaseApp bundle as base application.
Instead of building the Electron dependencies, this reuses the
"io.atom.electron.BaseApp" bundle as base application. The contents of the
base application are imported at build time, and then Electron and the
prepared files added on top. The prebuilt base application will be fetched
automatically using the URL specified in the "baseFlatpakref" attribute of the
manifest, and it is kindly hosted at Amazon S3 by Endless Computers
(https://endlessm.com). The sources for the base application can be found at:
https://github.com/endlessm/electron-flatpak-base-app/
2016-11-25 00:21:57 +00:00
|
|
|
const linuxPackageRevision = Math.floor(new Date().getTime() / 1000);
|
|
|
|
|
2022-08-12 00:09:00 +00:00
|
|
|
/**
|
|
|
|
* @param {string} arch
|
|
|
|
*/
|
2016-07-20 09:00:43 +00:00
|
|
|
function getDebPackageArch(arch) {
|
2020-09-08 07:41:28 +00:00
|
|
|
return { x64: 'amd64', armhf: 'armhf', arm64: 'arm64' }[arch];
|
2016-07-20 09:00:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function prepareDebPackage(arch) {
|
|
|
|
const binaryDir = '../VSCode-linux-' + arch;
|
|
|
|
const debArch = getDebPackageArch(arch);
|
|
|
|
const destination = '.build/linux/deb/' + debArch + '/' + product.applicationName + '-' + debArch;
|
|
|
|
|
|
|
|
return function () {
|
|
|
|
const desktop = gulp.src('resources/linux/code.desktop', { base: '.' })
|
|
|
|
.pipe(rename('usr/share/applications/' + product.applicationName + '.desktop'));
|
|
|
|
|
2018-08-18 01:47:54 +00:00
|
|
|
const desktopUrlHandler = gulp.src('resources/linux/code-url-handler.desktop', { base: '.' })
|
2018-09-13 09:14:33 +00:00
|
|
|
.pipe(rename('usr/share/applications/' + product.applicationName + '-url-handler.desktop'));
|
|
|
|
|
|
|
|
const desktops = es.merge(desktop, desktopUrlHandler)
|
2018-08-18 01:47:54 +00:00
|
|
|
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
|
|
|
.pipe(replace('@@NAME_SHORT@@', product.nameShort))
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
2019-09-10 15:12:45 +00:00
|
|
|
.pipe(replace('@@EXEC@@', `/usr/share/${product.applicationName}/${product.applicationName}`))
|
2020-04-25 12:39:30 +00:00
|
|
|
.pipe(replace('@@ICON@@', product.linuxIconName))
|
2018-09-13 09:14:33 +00:00
|
|
|
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));
|
2018-08-18 01:47:54 +00:00
|
|
|
|
2016-11-28 19:15:48 +00:00
|
|
|
const appdata = gulp.src('resources/linux/code.appdata.xml', { base: '.' })
|
|
|
|
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
|
|
|
.pipe(replace('@@LICENSE@@', product.licenseName))
|
|
|
|
.pipe(rename('usr/share/appdata/' + product.applicationName + '.appdata.xml'));
|
|
|
|
|
2020-09-10 13:02:48 +00:00
|
|
|
const workspaceMime = gulp.src('resources/linux/code-workspace.xml', { base: '.' })
|
2020-04-19 11:57:06 +00:00
|
|
|
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
|
|
|
.pipe(rename('usr/share/mime/packages/' + product.applicationName + '-workspace.xml'));
|
|
|
|
|
2017-03-31 08:30:29 +00:00
|
|
|
const icon = gulp.src('resources/linux/code.png', { base: '.' })
|
2019-03-08 19:17:38 +00:00
|
|
|
.pipe(rename('usr/share/pixmaps/' + product.linuxIconName + '.png'));
|
2016-07-20 09:00:43 +00:00
|
|
|
|
2019-01-07 22:40:15 +00:00
|
|
|
const bash_completion = gulp.src('resources/completions/bash/code')
|
|
|
|
.pipe(replace('@@APPNAME@@', product.applicationName))
|
|
|
|
.pipe(rename('usr/share/bash-completion/completions/' + product.applicationName));
|
2018-08-17 11:18:07 +00:00
|
|
|
|
2019-01-07 22:40:15 +00:00
|
|
|
const zsh_completion = gulp.src('resources/completions/zsh/_code')
|
|
|
|
.pipe(replace('@@APPNAME@@', product.applicationName))
|
|
|
|
.pipe(rename('usr/share/zsh/vendor-completions/_' + product.applicationName));
|
2018-08-17 11:18:07 +00:00
|
|
|
|
2017-03-31 08:30:29 +00:00
|
|
|
const code = gulp.src(binaryDir + '/**/*', { base: binaryDir })
|
2016-07-20 09:00:43 +00:00
|
|
|
.pipe(rename(function (p) { p.dirname = 'usr/share/' + product.applicationName + '/' + p.dirname; }));
|
|
|
|
|
|
|
|
let size = 0;
|
|
|
|
const control = code.pipe(es.through(
|
|
|
|
function (f) { size += f.isDirectory() ? 4096 : f.contents.length; },
|
2022-07-19 17:43:05 +00:00
|
|
|
async function () {
|
2016-07-20 09:00:43 +00:00
|
|
|
const that = this;
|
2023-12-12 10:39:00 +00:00
|
|
|
const dependencies = await dependenciesGenerator.getDependencies('deb', binaryDir, product.applicationName, debArch);
|
2016-07-20 09:00:43 +00:00
|
|
|
gulp.src('resources/linux/debian/control.template', { base: '.' })
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
|
|
|
.pipe(replace('@@VERSION@@', packageJson.version + '-' + linuxPackageRevision))
|
|
|
|
.pipe(replace('@@ARCHITECTURE@@', debArch))
|
2022-07-19 17:43:05 +00:00
|
|
|
.pipe(replace('@@DEPENDS@@', dependencies.join(', ')))
|
|
|
|
.pipe(replace('@@RECOMMENDS@@', debianRecommendedDependencies.join(', ')))
|
2016-07-20 09:00:43 +00:00
|
|
|
.pipe(replace('@@INSTALLEDSIZE@@', Math.ceil(size / 1024)))
|
|
|
|
.pipe(rename('DEBIAN/control'))
|
|
|
|
.pipe(es.through(function (f) { that.emit('data', f); }, function () { that.emit('end'); }));
|
|
|
|
}));
|
|
|
|
|
|
|
|
const prerm = gulp.src('resources/linux/debian/prerm.template', { base: '.' })
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
2016-09-05 10:38:25 +00:00
|
|
|
.pipe(rename('DEBIAN/prerm'));
|
2016-07-20 09:00:43 +00:00
|
|
|
|
|
|
|
const postrm = gulp.src('resources/linux/debian/postrm.template', { base: '.' })
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
2016-09-05 10:38:25 +00:00
|
|
|
.pipe(rename('DEBIAN/postrm'));
|
2016-07-20 09:00:43 +00:00
|
|
|
|
|
|
|
const postinst = gulp.src('resources/linux/debian/postinst.template', { base: '.' })
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
2016-09-05 10:38:25 +00:00
|
|
|
.pipe(rename('DEBIAN/postinst'));
|
2016-07-20 09:00:43 +00:00
|
|
|
|
2020-04-19 11:57:06 +00:00
|
|
|
const all = es.merge(control, postinst, postrm, prerm, desktops, appdata, workspaceMime, icon, bash_completion, zsh_completion, code);
|
2016-07-20 09:00:43 +00:00
|
|
|
|
2016-09-05 10:38:25 +00:00
|
|
|
return all.pipe(vfs.dest(destination));
|
2016-07-20 09:00:43 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-02-28 22:32:12 +00:00
|
|
|
/**
|
|
|
|
* @param {string} arch
|
|
|
|
*/
|
2016-07-20 09:00:43 +00:00
|
|
|
function buildDebPackage(arch) {
|
|
|
|
const debArch = getDebPackageArch(arch);
|
2024-06-06 15:54:06 +00:00
|
|
|
const cwd = `.build/linux/deb/${debArch}`;
|
|
|
|
|
|
|
|
return async () => {
|
|
|
|
await exec(`chmod 755 ${product.applicationName}-${debArch}/DEBIAN/postinst ${product.applicationName}-${debArch}/DEBIAN/prerm ${product.applicationName}-${debArch}/DEBIAN/postrm`, { cwd });
|
|
|
|
await exec('mkdir -p deb', { cwd });
|
|
|
|
await exec(`fakeroot dpkg-deb -b ${product.applicationName}-${debArch} deb`, { cwd });
|
|
|
|
};
|
2016-07-20 09:00:43 +00:00
|
|
|
}
|
|
|
|
|
2022-02-28 22:32:12 +00:00
|
|
|
/**
|
|
|
|
* @param {string} rpmArch
|
|
|
|
*/
|
2016-07-20 09:00:43 +00:00
|
|
|
function getRpmBuildPath(rpmArch) {
|
|
|
|
return '.build/linux/rpm/' + rpmArch + '/rpmbuild';
|
|
|
|
}
|
|
|
|
|
2022-02-28 22:32:12 +00:00
|
|
|
/**
|
|
|
|
* @param {string} arch
|
|
|
|
*/
|
2016-07-20 09:00:43 +00:00
|
|
|
function getRpmPackageArch(arch) {
|
2020-09-08 18:57:07 +00:00
|
|
|
return { x64: 'x86_64', armhf: 'armv7hl', arm64: 'aarch64' }[arch];
|
2016-07-20 09:00:43 +00:00
|
|
|
}
|
|
|
|
|
2022-02-28 22:32:12 +00:00
|
|
|
/**
|
|
|
|
* @param {string} arch
|
|
|
|
*/
|
2016-07-20 09:00:43 +00:00
|
|
|
function prepareRpmPackage(arch) {
|
|
|
|
const binaryDir = '../VSCode-linux-' + arch;
|
|
|
|
const rpmArch = getRpmPackageArch(arch);
|
|
|
|
|
|
|
|
return function () {
|
|
|
|
const desktop = gulp.src('resources/linux/code.desktop', { base: '.' })
|
|
|
|
.pipe(rename('BUILD/usr/share/applications/' + product.applicationName + '.desktop'));
|
|
|
|
|
2018-08-18 01:47:54 +00:00
|
|
|
const desktopUrlHandler = gulp.src('resources/linux/code-url-handler.desktop', { base: '.' })
|
|
|
|
.pipe(rename('BUILD/usr/share/applications/' + product.applicationName + '-url-handler.desktop'));
|
|
|
|
|
2018-11-06 15:08:02 +00:00
|
|
|
const desktops = es.merge(desktop, desktopUrlHandler)
|
|
|
|
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
|
|
|
.pipe(replace('@@NAME_SHORT@@', product.nameShort))
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
2019-09-10 15:12:45 +00:00
|
|
|
.pipe(replace('@@EXEC@@', `/usr/share/${product.applicationName}/${product.applicationName}`))
|
2019-03-08 19:17:38 +00:00
|
|
|
.pipe(replace('@@ICON@@', product.linuxIconName))
|
2018-11-06 15:08:02 +00:00
|
|
|
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));
|
2018-09-13 09:14:33 +00:00
|
|
|
|
2016-11-28 19:15:48 +00:00
|
|
|
const appdata = gulp.src('resources/linux/code.appdata.xml', { base: '.' })
|
|
|
|
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
|
|
|
.pipe(replace('@@LICENSE@@', product.licenseName))
|
2023-02-02 09:54:43 +00:00
|
|
|
.pipe(rename('BUILD/usr/share/appdata/' + product.applicationName + '.appdata.xml'));
|
2016-11-28 19:15:48 +00:00
|
|
|
|
2020-09-10 12:10:36 +00:00
|
|
|
const workspaceMime = gulp.src('resources/linux/code-workspace.xml', { base: '.' })
|
2020-04-19 11:57:06 +00:00
|
|
|
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
|
|
|
.pipe(rename('BUILD/usr/share/mime/packages/' + product.applicationName + '-workspace.xml'));
|
|
|
|
|
2017-03-31 08:30:29 +00:00
|
|
|
const icon = gulp.src('resources/linux/code.png', { base: '.' })
|
2019-03-08 19:17:38 +00:00
|
|
|
.pipe(rename('BUILD/usr/share/pixmaps/' + product.linuxIconName + '.png'));
|
2016-07-20 09:00:43 +00:00
|
|
|
|
2019-01-07 22:40:15 +00:00
|
|
|
const bash_completion = gulp.src('resources/completions/bash/code')
|
|
|
|
.pipe(replace('@@APPNAME@@', product.applicationName))
|
|
|
|
.pipe(rename('BUILD/usr/share/bash-completion/completions/' + product.applicationName));
|
2018-08-17 11:18:07 +00:00
|
|
|
|
2019-01-07 22:40:15 +00:00
|
|
|
const zsh_completion = gulp.src('resources/completions/zsh/_code')
|
|
|
|
.pipe(replace('@@APPNAME@@', product.applicationName))
|
|
|
|
.pipe(rename('BUILD/usr/share/zsh/site-functions/_' + product.applicationName));
|
2018-08-17 11:18:07 +00:00
|
|
|
|
2016-07-20 09:00:43 +00:00
|
|
|
const code = gulp.src(binaryDir + '/**/*', { base: binaryDir })
|
|
|
|
.pipe(rename(function (p) { p.dirname = 'BUILD/usr/share/' + product.applicationName + '/' + p.dirname; }));
|
|
|
|
|
2023-12-12 10:39:00 +00:00
|
|
|
const spec = code.pipe(es.through(
|
|
|
|
async function () {
|
|
|
|
const that = this;
|
|
|
|
const dependencies = await dependenciesGenerator.getDependencies('rpm', binaryDir, product.applicationName, rpmArch);
|
|
|
|
gulp.src('resources/linux/rpm/code.spec.template', { base: '.' })
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
|
|
|
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
|
|
|
.pipe(replace('@@ICON@@', product.linuxIconName))
|
|
|
|
.pipe(replace('@@VERSION@@', packageJson.version))
|
|
|
|
.pipe(replace('@@RELEASE@@', linuxPackageRevision))
|
|
|
|
.pipe(replace('@@ARCHITECTURE@@', rpmArch))
|
|
|
|
.pipe(replace('@@LICENSE@@', product.licenseName))
|
|
|
|
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
|
|
|
|
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
|
|
|
|
.pipe(replace('@@DEPENDENCIES@@', dependencies.join(', ')))
|
|
|
|
.pipe(rename('SPECS/' + product.applicationName + '.spec'))
|
|
|
|
.pipe(es.through(function (f) { that.emit('data', f); }, function () { that.emit('end'); }));
|
|
|
|
}));
|
2016-07-20 09:00:43 +00:00
|
|
|
|
|
|
|
const specIcon = gulp.src('resources/linux/rpm/code.xpm', { base: '.' })
|
|
|
|
.pipe(rename('SOURCES/' + product.applicationName + '.xpm'));
|
|
|
|
|
2020-04-19 11:57:06 +00:00
|
|
|
const all = es.merge(code, desktops, appdata, workspaceMime, icon, bash_completion, zsh_completion, spec, specIcon);
|
2016-07-20 09:00:43 +00:00
|
|
|
|
2016-09-05 10:38:25 +00:00
|
|
|
return all.pipe(vfs.dest(getRpmBuildPath(rpmArch)));
|
|
|
|
};
|
2016-07-20 09:00:43 +00:00
|
|
|
}
|
|
|
|
|
2022-02-28 22:32:12 +00:00
|
|
|
/**
|
|
|
|
* @param {string} arch
|
|
|
|
*/
|
2016-07-20 09:00:43 +00:00
|
|
|
function buildRpmPackage(arch) {
|
|
|
|
const rpmArch = getRpmPackageArch(arch);
|
|
|
|
const rpmBuildPath = getRpmBuildPath(rpmArch);
|
2024-06-06 15:54:06 +00:00
|
|
|
const rpmOut = `${rpmBuildPath}/RPMS/${rpmArch}`;
|
|
|
|
const destination = `.build/linux/rpm/${rpmArch}`;
|
|
|
|
|
|
|
|
return async () => {
|
|
|
|
await exec(`mkdir -p ${destination}`);
|
|
|
|
await exec(`HOME="$(pwd)/${destination}" rpmbuild -bb ${rpmBuildPath}/SPECS/${product.applicationName}.spec --target=${rpmArch}`);
|
|
|
|
await exec(`cp "${rpmOut}/$(ls ${rpmOut})" ${destination}/`);
|
|
|
|
};
|
2016-07-20 09:00:43 +00:00
|
|
|
}
|
2018-11-06 12:02:08 +00:00
|
|
|
|
2022-02-28 22:32:12 +00:00
|
|
|
/**
|
|
|
|
* @param {string} arch
|
|
|
|
*/
|
2017-09-26 18:18:00 +00:00
|
|
|
function getSnapBuildPath(arch) {
|
|
|
|
return `.build/linux/snap/${arch}/${product.applicationName}-${arch}`;
|
|
|
|
}
|
|
|
|
|
2022-02-28 22:32:12 +00:00
|
|
|
/**
|
|
|
|
* @param {string} arch
|
|
|
|
*/
|
2017-09-26 18:18:00 +00:00
|
|
|
function prepareSnapPackage(arch) {
|
|
|
|
const binaryDir = '../VSCode-linux-' + arch;
|
|
|
|
const destination = getSnapBuildPath(arch);
|
|
|
|
|
|
|
|
return function () {
|
2019-09-10 15:12:45 +00:00
|
|
|
// A desktop file that is placed in snap/gui will be placed into meta/gui verbatim.
|
2017-09-26 18:18:00 +00:00
|
|
|
const desktop = gulp.src('resources/linux/code.desktop', { base: '.' })
|
2019-09-10 15:12:45 +00:00
|
|
|
.pipe(rename(`snap/gui/${product.applicationName}.desktop`));
|
2019-03-22 10:12:57 +00:00
|
|
|
|
2019-09-10 15:12:45 +00:00
|
|
|
// A desktop file that is placed in snap/gui will be placed into meta/gui verbatim.
|
2019-03-22 10:12:57 +00:00
|
|
|
const desktopUrlHandler = gulp.src('resources/linux/code-url-handler.desktop', { base: '.' })
|
2019-09-10 15:12:45 +00:00
|
|
|
.pipe(rename(`snap/gui/${product.applicationName}-url-handler.desktop`));
|
2019-03-22 10:12:57 +00:00
|
|
|
|
|
|
|
const desktops = es.merge(desktop, desktopUrlHandler)
|
2017-09-26 18:18:00 +00:00
|
|
|
.pipe(replace('@@NAME_LONG@@', product.nameLong))
|
|
|
|
.pipe(replace('@@NAME_SHORT@@', product.nameShort))
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
2019-09-11 11:31:42 +00:00
|
|
|
.pipe(replace('@@EXEC@@', `${product.applicationName} --force-user-env`))
|
2019-09-10 15:12:45 +00:00
|
|
|
.pipe(replace('@@ICON@@', `\${SNAP}/meta/gui/${product.linuxIconName}.png`))
|
2019-03-22 10:12:57 +00:00
|
|
|
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));
|
2017-09-26 18:18:00 +00:00
|
|
|
|
2019-09-10 15:12:45 +00:00
|
|
|
// An icon that is placed in snap/gui will be placed into meta/gui verbatim.
|
2017-09-26 18:18:00 +00:00
|
|
|
const icon = gulp.src('resources/linux/code.png', { base: '.' })
|
2019-09-10 15:12:45 +00:00
|
|
|
.pipe(rename(`snap/gui/${product.linuxIconName}.png`));
|
2017-09-26 18:18:00 +00:00
|
|
|
|
|
|
|
const code = gulp.src(binaryDir + '/**/*', { base: binaryDir })
|
2018-02-08 17:09:12 +00:00
|
|
|
.pipe(rename(function (p) { p.dirname = `usr/share/${product.applicationName}/${p.dirname}`; }));
|
2017-09-26 18:18:00 +00:00
|
|
|
|
|
|
|
const snapcraft = gulp.src('resources/linux/snap/snapcraft.yaml', { base: '.' })
|
|
|
|
.pipe(replace('@@NAME@@', product.applicationName))
|
2018-12-19 14:06:16 +00:00
|
|
|
.pipe(replace('@@VERSION@@', commit.substr(0, 8)))
|
2020-12-10 22:12:47 +00:00
|
|
|
// Possible run-on values https://snapcraft.io/docs/architectures
|
|
|
|
.pipe(replace('@@ARCHITECTURE@@', arch === 'x64' ? 'amd64' : arch))
|
2017-09-26 18:18:00 +00:00
|
|
|
.pipe(rename('snap/snapcraft.yaml'));
|
|
|
|
|
|
|
|
const electronLaunch = gulp.src('resources/linux/snap/electron-launch', { base: '.' })
|
|
|
|
.pipe(rename('electron-launch'));
|
|
|
|
|
2019-03-22 10:12:57 +00:00
|
|
|
const all = es.merge(desktops, icon, code, snapcraft, electronLaunch);
|
2017-09-26 18:18:00 +00:00
|
|
|
|
|
|
|
return all.pipe(vfs.dest(destination));
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-02-28 22:32:12 +00:00
|
|
|
/**
|
|
|
|
* @param {string} arch
|
|
|
|
*/
|
2017-09-26 18:18:00 +00:00
|
|
|
function buildSnapPackage(arch) {
|
2024-06-06 15:54:06 +00:00
|
|
|
const cwd = getSnapBuildPath(arch);
|
|
|
|
return () => exec('snapcraft', { cwd });
|
2017-09-26 18:18:00 +00:00
|
|
|
}
|
2016-07-20 09:00:43 +00:00
|
|
|
|
2019-02-05 20:23:25 +00:00
|
|
|
const BUILD_TARGETS = [
|
|
|
|
{ arch: 'x64' },
|
2020-09-08 07:41:28 +00:00
|
|
|
{ arch: 'armhf' },
|
2019-02-05 20:23:25 +00:00
|
|
|
{ arch: 'arm64' },
|
|
|
|
];
|
|
|
|
|
2020-09-08 14:24:51 +00:00
|
|
|
BUILD_TARGETS.forEach(({ arch }) => {
|
|
|
|
const debArch = getDebPackageArch(arch);
|
2024-06-06 15:54:06 +00:00
|
|
|
const prepareDebTask = task.define(`vscode-linux-${arch}-prepare-deb`, task.series(rimraf(`.build/linux/deb/${debArch}`), prepareDebPackage(arch)));
|
2023-07-21 04:02:56 +00:00
|
|
|
gulp.task(prepareDebTask);
|
|
|
|
const buildDebTask = task.define(`vscode-linux-${arch}-build-deb`, buildDebPackage(arch));
|
2020-09-08 14:24:51 +00:00
|
|
|
gulp.task(buildDebTask);
|
|
|
|
|
|
|
|
const rpmArch = getRpmPackageArch(arch);
|
2024-06-06 15:54:06 +00:00
|
|
|
const prepareRpmTask = task.define(`vscode-linux-${arch}-prepare-rpm`, task.series(rimraf(`.build/linux/rpm/${rpmArch}`), prepareRpmPackage(arch)));
|
2023-07-21 04:02:56 +00:00
|
|
|
gulp.task(prepareRpmTask);
|
|
|
|
const buildRpmTask = task.define(`vscode-linux-${arch}-build-rpm`, buildRpmPackage(arch));
|
2020-09-08 14:24:51 +00:00
|
|
|
gulp.task(buildRpmTask);
|
|
|
|
|
2024-06-06 15:54:06 +00:00
|
|
|
const prepareSnapTask = task.define(`vscode-linux-${arch}-prepare-snap`, task.series(rimraf(`.build/linux/snap/${arch}`), prepareSnapPackage(arch)));
|
2020-09-08 14:24:51 +00:00
|
|
|
gulp.task(prepareSnapTask);
|
|
|
|
const buildSnapTask = task.define(`vscode-linux-${arch}-build-snap`, task.series(prepareSnapTask, buildSnapPackage(arch)));
|
|
|
|
gulp.task(buildSnapTask);
|
2019-02-05 20:23:25 +00:00
|
|
|
});
|