mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
* Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 * Fix breaks * Extension management fixes * Fix breaks in windows bundling * Fix/skip failing tests * Update distro * Add clear to nuget.config * Add hygiene task * Bump distro * Fix hygiene issue * Add build to hygiene exclusion * Update distro * Update hygiene * Hygiene exclusions * Update tsconfig * Bump distro for server breaks * Update build config * Update darwin path * Add done calls to notebook tests * Skip failing tests * Disable smoke tests
95 lines
3.2 KiB
TypeScript
95 lines
3.2 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
'use strict';
|
|
|
|
import * as fs from 'fs';
|
|
import * as path from 'path';
|
|
import * as vfs from 'vinyl-fs';
|
|
import * as filter from 'gulp-filter';
|
|
import * as json from 'gulp-json-editor';
|
|
import * as _ from 'underscore';
|
|
import * as util from './util';
|
|
|
|
const electron = require('gulp-atom-electron');
|
|
|
|
const root = path.dirname(path.dirname(__dirname));
|
|
const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));
|
|
const commit = util.getVersion(root);
|
|
|
|
const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
|
|
|
|
function darwinBundleDocumentType(extensions: string[], icon: string) {
|
|
return {
|
|
name: product.nameLong + ' document',
|
|
role: 'Editor',
|
|
ostypes: ['TEXT', 'utxt', 'TUTX', '****'],
|
|
extensions: extensions,
|
|
iconFile: icon
|
|
};
|
|
}
|
|
|
|
export const config = {
|
|
version: util.getElectronVersion(),
|
|
productAppName: product.nameLong,
|
|
companyName: 'Microsoft Corporation',
|
|
copyright: 'Copyright (C) 2019 Microsoft. All rights reserved',
|
|
darwinIcon: 'resources/darwin/code.icns',
|
|
darwinBundleIdentifier: product.darwinBundleIdentifier,
|
|
darwinApplicationCategoryType: 'public.app-category.developer-tools',
|
|
darwinHelpBookFolder: 'VS Code HelpBook',
|
|
darwinHelpBookName: 'VS Code HelpBook',
|
|
darwinBundleDocumentTypes: [
|
|
darwinBundleDocumentType(["csv", "json", "sqlplan", "sql", "xml"], 'resources/darwin/code_file.icns'),
|
|
],
|
|
darwinBundleURLTypes: [{
|
|
role: 'Viewer',
|
|
name: product.nameLong,
|
|
urlSchemes: [product.urlProtocol]
|
|
}],
|
|
darwinForceDarkModeSupport: true,
|
|
darwinCredits: darwinCreditsTemplate ? Buffer.from(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : undefined,
|
|
linuxExecutableName: product.applicationName,
|
|
winIcon: 'resources/win32/code.ico',
|
|
token: process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'] || undefined,
|
|
repo: product.electronRepository || undefined
|
|
};
|
|
|
|
function getElectron(arch: string): () => NodeJS.ReadWriteStream {
|
|
return () => {
|
|
const electronOpts = _.extend({}, config, {
|
|
platform: process.platform,
|
|
arch: arch === 'armhf' ? 'arm' : arch,
|
|
ffmpegChromium: true,
|
|
keepDefaultApp: true
|
|
});
|
|
|
|
return vfs.src('package.json')
|
|
.pipe(json({ name: product.nameShort }))
|
|
.pipe(electron(electronOpts))
|
|
.pipe(filter(['**', '!**/app/package.json']))
|
|
.pipe(vfs.dest('.build/electron'));
|
|
};
|
|
}
|
|
|
|
async function main(arch = process.arch): Promise<void> {
|
|
const version = util.getElectronVersion();
|
|
const electronPath = path.join(root, '.build', 'electron');
|
|
const versionFile = path.join(electronPath, 'version');
|
|
const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `${version}`;
|
|
|
|
if (!isUpToDate) {
|
|
await util.rimraf(electronPath)();
|
|
await util.streamToPromise(getElectron(arch)());
|
|
}
|
|
}
|
|
|
|
if (require.main === module) {
|
|
main(process.argv[2]).catch(err => {
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|
|
}
|