Skip to content

Commit 1e300d1

Browse files
committed
Add an AppData XML data file to Linux builds
The AppData files provide descriptive data about an application, and is typically used in application managers to display additional information to the user. Having an AppData file is especially important for some graphical application installers: without one, an application manager may not event show an entry for the application. This happens for example in GNOME Software. For the sake of completeness, this commit not only adds the AppData file to the Flatpak build, but also to the Linux .deb and .rpm packages.
1 parent 9599de1 commit 1e300d1

2 files changed

Lines changed: 50 additions & 2 deletions

File tree

build/gulpfile.vscode.linux.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ function prepareDebPackage(arch) {
5757
.pipe(replace('@@NAME@@', product.applicationName))
5858
.pipe(rename('usr/share/applications/' + product.applicationName + '.desktop'));
5959

60+
const appdata = gulp.src('resources/linux/code.appdata.xml', { base: '.' })
61+
.pipe(replace('@@NAME_LONG@@', product.nameLong))
62+
.pipe(replace('@@NAME@@', product.applicationName))
63+
.pipe(replace('@@LICENSE@@', product.licenseName))
64+
.pipe(rename('usr/share/appdata/' + product.applicationName + '.appdata.xml'));
65+
6066
const icon = gulp.src('resources/linux/code.png', { base: '.' })
6167
.pipe(rename('usr/share/pixmaps/' + product.applicationName + '.png'));
6268

@@ -92,7 +98,7 @@ function prepareDebPackage(arch) {
9298
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
9399
.pipe(rename('DEBIAN/postinst'));
94100

95-
const all = es.merge(control, postinst, postrm, prerm, desktop, icon, code);
101+
const all = es.merge(control, postinst, postrm, prerm, desktop, appdata, icon, code);
96102

97103
return all.pipe(vfs.dest(destination));
98104
};
@@ -127,6 +133,12 @@ function prepareRpmPackage(arch) {
127133
.pipe(replace('@@NAME@@', product.applicationName))
128134
.pipe(rename('BUILD/usr/share/applications/' + product.applicationName + '.desktop'));
129135

136+
const appdata = gulp.src('resources/linux/code.appdata.xml', { base: '.' })
137+
.pipe(replace('@@NAME_LONG@@', product.nameLong))
138+
.pipe(replace('@@NAME@@', product.applicationName))
139+
.pipe(replace('@@LICENSE@@', product.licenseName))
140+
.pipe(rename('usr/share/appdata/' + product.applicationName + '.appdata.xml'));
141+
130142
const icon = gulp.src('resources/linux/code.png', { base: '.' })
131143
.pipe(rename('BUILD/usr/share/pixmaps/' + product.applicationName + '.png'));
132144

@@ -148,7 +160,7 @@ function prepareRpmPackage(arch) {
148160
const specIcon = gulp.src('resources/linux/rpm/code.xpm', { base: '.' })
149161
.pipe(rename('SOURCES/' + product.applicationName + '.xpm'));
150162

151-
const all = es.merge(code, desktop, icon, spec, specIcon);
163+
const all = es.merge(code, desktop, appdata, icon, spec, specIcon);
152164

153165
return all.pipe(vfs.dest(getRpmBuildPath(rpmArch)));
154166
};
@@ -195,6 +207,12 @@ function prepareFlatpak(arch) {
195207
.pipe(replace('@@NAME@@', product.applicationName))
196208
.pipe(rename('share/applications/' + flatpakManifest.appId + '.desktop')));
197209

210+
all.push(gulp.src('resources/linux/code.appdata.xml', { base: '.' })
211+
.pipe(replace('@@NAME_LONG@@', product.nameLong))
212+
.pipe(replace('@@NAME@@', flatpakManifest.appId))
213+
.pipe(replace('@@LICENSE@@', product.licenseName))
214+
.pipe(rename('share/appdata/' + flatpakManifest.appId + '.appdata.xml')));
215+
198216
all.push(gulp.src(binaryDir + '/**/*', { base:binaryDir })
199217
.pipe(rename(function (p) {
200218
p.dirname = 'share/' + product.applicationName + '/' + p.dirname;

resources/linux/code.appdata.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="desktop">
3+
<id>@@NAME@@.desktop</id>
4+
<metadata_license>@@LICENSE@@</metadata_license>
5+
<project_license>@@LICENSE@@</project_license>
6+
<name>@@NAME_LONG@@</name>
7+
<url type="homepage">https://code.visualstudio.com</url>
8+
<summary>Code editor for developers supporting integration with existing tools</summary>
9+
<description>
10+
<p>
11+
Visual Studio Code is a lightweight but powerful source code editor which
12+
runs on your desktop and is available for Windows, Mac and Linux. It comes
13+
with built-in support for JavaScript, TypeScript and Node.js and has a rich
14+
ecosystem of extensions for other languages (such as C++, C#, Python, PHP)
15+
and runtimes.
16+
</p>
17+
<p>
18+
The editor includes built-in support for the Git distributed version control
19+
system, intelligent code completion, support for highlighting and completing
20+
many programming languages, and and integrated debugging interface. Additional
21+
functionality is provided by optional extensions.
22+
</p>
23+
</description>
24+
<screenshots>
25+
<screenshot type="default">
26+
<image>https://code.visualstudio.com/home/home-screenshot-linux-lg.png</image>
27+
<caption>Editing TypeScript and searching for extensions</caption>
28+
</screenshot>
29+
</screenshots>
30+
</component>

0 commit comments

Comments
 (0)