Skip to content

Commit

Permalink
Auto update package type for windows and linux (#6026)
Browse files Browse the repository at this point in the history
  • Loading branch information
timtmok authored Jan 27, 2025
1 parent c3de859 commit 7a428dc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
14 changes: 14 additions & 0 deletions build/gulpfile.vscode.linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ function prepareDebPackage(arch) {
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));

// --- Start Positron ---
const json = require('gulp-json-editor');

const appdata = gulp.src('resources/linux/positron.appdata.xml', { base: '.' })
.pipe(replace('@@NAME_LONG@@', product.nameLong))
.pipe(replace('@@NAME@@', product.applicationName))
Expand All @@ -74,6 +76,11 @@ function prepareDebPackage(arch) {
// --- Start Positron ---
const icon = gulp.src('resources/linux/positron.png', { base: '.' })
.pipe(rename('usr/share/pixmaps/' + product.linuxIconName + '.png'));

console.log('Updating product.json with DEB package type');
gulp.src([binaryDir + '/resources/app/product.json'], { base: '.' })
.pipe(json({ packageType: 'deb' }))
.pipe(gulp.dest(binaryDir));
// --- End Positron ---

const bash_completion = gulp.src('resources/completions/bash/code')
Expand Down Expand Up @@ -189,11 +196,18 @@ function prepareRpmPackage(arch) {
.pipe(replace('@@URLPROTOCOL@@', product.urlProtocol));

// --- Start Positron ---
const json = require('gulp-json-editor');

const appdata = gulp.src('resources/linux/positron.appdata.xml', { base: '.' })
.pipe(replace('@@NAME_LONG@@', product.nameLong))
.pipe(replace('@@NAME@@', product.applicationName))
.pipe(replace('@@LICENSE@@', product.licenseName))
.pipe(rename('BUILD/usr/share/appdata/' + product.applicationName + '.appdata.xml'));

console.log('Updating product.json with RPM package type');
gulp.src([binaryDir + '/resources/app/product.json'], { base: '.' })
.pipe(json({ packageType: 'rpm' }))
.pipe(gulp.dest(binaryDir));
// --- End Positron ---

const workspaceMime = gulp.src('resources/linux/code-workspace.xml', { base: '.' })
Expand Down
3 changes: 3 additions & 0 deletions src/vs/base/common/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export interface IProductConfiguration {

/** The Positron build number; unique within the Positron version */
readonly positronBuildNumber: number;

/** The linux package type (DEB or RPM) */
readonly packageType?: string;
// --- End Positron ---

readonly date?: string;
Expand Down
3 changes: 1 addition & 2 deletions src/vs/platform/update/electron-main/updateService.linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ export class LinuxUpdateService extends AbstractUpdateService {

protected buildUpdateFeedUrl(channel: string): string {
const arch = process.arch === 'x64' ? 'x86_64' : 'arm64';
const platform = `deb/${arch}`;
const platform = `${this.productService.packageType ?? 'deb'}/${arch}`;
const baseUrl = createUpdateURL(platform, channel, this.productService);

// TODO: properly determine deb or rpm
return `${baseUrl}/releases.json`;
}
// --- End Positron ---
Expand Down
5 changes: 2 additions & 3 deletions src/vs/platform/update/electron-main/updateService.win32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,10 @@ export class Win32UpdateService extends AbstractUpdateService implements IRelaun
// --- Start Positron ---
protected buildUpdateFeedUrl(channel: string): string | undefined {
const platform = `win/${process.arch === 'x64' ? 'x86_64' : 'arm64'}`;
const prefix = getUpdateType() === UpdateType.Setup ? 'system-' : 'user-';
const prefix = this.productService.target;
const baseUrl = createUpdateURL(platform, channel, this.productService);

// TODO: properly determine if this is a user or system install
const url = `${baseUrl}/${prefix}releases.json`;
const url = `${baseUrl}/${prefix}-releases.json`;

return url;
}
Expand Down

0 comments on commit 7a428dc

Please sign in to comment.