mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
scripts/code.sh picks up marketplace built-in extensions automatically
This commit is contained in:
parent
53a2781d80
commit
5bdb90de36
4
build/builtInExtensions.json
Normal file
4
build/builtInExtensions.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
{ "name": "ms-vscode.node-debug", "version": "1.20.3" },
|
||||
{ "name": "ms-vscode.node-debug2", "version": "1.20.1" }
|
||||
]
|
|
@ -44,14 +44,13 @@ const nodeModules = ['electron', 'original-fs']
|
|||
|
||||
// Build
|
||||
|
||||
const builtInExtensions = [
|
||||
{ name: 'ms-vscode.node-debug', version: '1.20.3' },
|
||||
{ name: 'ms-vscode.node-debug2', version: '1.20.1' }
|
||||
];
|
||||
const builtInExtensions = require('./builtInExtensions');
|
||||
|
||||
const excludedExtensions = [
|
||||
'vscode-api-tests',
|
||||
'vscode-colorize-tests'
|
||||
'vscode-colorize-tests',
|
||||
'ms-vscode.node-debug',
|
||||
'ms-vscode.node-debug2',
|
||||
];
|
||||
|
||||
const vscodeEntryPoints = _.flatten([
|
||||
|
@ -584,3 +583,20 @@ gulp.task('generate-vscode-configuration', () => {
|
|||
console.error(e.toString());
|
||||
});
|
||||
});
|
||||
|
||||
//#region Built-In Extensions
|
||||
gulp.task('clean-builtInExtensions', util.rimraf('.build/builtInExtensions'));
|
||||
|
||||
gulp.task('builtInExtensions', ['clean-builtInExtensions'], function() {
|
||||
const marketplaceExtensions = es.merge(...builtInExtensions.map(extension => {
|
||||
return ext.fromMarketplace(extension.name, extension.version)
|
||||
.pipe(rename(p => p.dirname = `${extension.name}/${p.dirname}`));
|
||||
}));
|
||||
|
||||
return (
|
||||
marketplaceExtensions
|
||||
.pipe(util.setExecutableBit(['**/*.sh']))
|
||||
.pipe(vfs.dest('.build/builtInExtensions'))
|
||||
);
|
||||
});
|
||||
//#endregion
|
||||
|
|
32
build/lib/builtInExtensions.js
Normal file
32
build/lib/builtInExtensions.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* 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 fs = require('fs');
|
||||
const path = require('path');
|
||||
const root = path.dirname(path.dirname(__dirname));
|
||||
|
||||
function isUpToDate(extension) {
|
||||
const packagePath = path.join(root, '.build', 'builtInExtensions', extension.name, 'package.json');
|
||||
if (!fs.existsSync(packagePath)) {
|
||||
return false;
|
||||
}
|
||||
const packageContents = fs.readFileSync(packagePath);
|
||||
try {
|
||||
const diskVersion = JSON.parse(packageContents).version;
|
||||
return (diskVersion === extension.version);
|
||||
} catch(err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const builtInExtensions = require('../builtInExtensions');
|
||||
builtInExtensions.forEach((extension) => {
|
||||
if (!isUpToDate(extension)) {
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
process.exit(0);
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "node-debug-placeholder",
|
||||
"name": "node-debug",
|
||||
"version": "1.6.0",
|
||||
"publisher": "vscode",
|
||||
"publisher": "ms-vscode",
|
||||
"engines": {
|
||||
"vscode": "1.6.x"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "node-debug2-placeholder",
|
||||
"name": "node-debug2",
|
||||
"version": "0.0.3",
|
||||
"publisher": "vscode",
|
||||
"publisher": "ms-vscode",
|
||||
"engines": {
|
||||
"vscode": "1.6.x"
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@ function code() {
|
|||
# Get electron
|
||||
node build/lib/electron.js || ./node_modules/.bin/gulp electron
|
||||
|
||||
# Get built-in extensions
|
||||
node build/lib/builtInExtensions.js || ./node_modules/.bin/gulp builtInExtensions
|
||||
|
||||
# Build
|
||||
test -d out || ./node_modules/.bin/gulp compile
|
||||
|
||||
|
|
|
@ -334,6 +334,10 @@ export class ExtensionScanner {
|
|||
}
|
||||
|
||||
const rawFolders = await pfs.readDirsInDir(absoluteFolderPath);
|
||||
|
||||
// Ensure the same extension order
|
||||
rawFolders.sort();
|
||||
|
||||
let folders: string[] = null;
|
||||
if (isBuiltin) {
|
||||
folders = rawFolders;
|
||||
|
|
|
@ -44,6 +44,7 @@ import * as strings from 'vs/base/common/strings';
|
|||
import { RPCProtocol } from 'vs/workbench/services/extensions/node/rpcProtocol';
|
||||
|
||||
const SystemExtensionsRoot = path.normalize(path.join(URI.parse(require.toUrl('')).fsPath, '..', 'extensions'));
|
||||
const ExtraDevSystemExtensionsRoot = path.normalize(path.join(URI.parse(require.toUrl('')).fsPath, '..', '.build', 'builtInExtensions'));
|
||||
|
||||
// Enable to see detailed message communication between window and extension host
|
||||
const logExtensionHostCommunication = false;
|
||||
|
@ -624,6 +625,36 @@ export class ExtensionService extends Disposable implements IExtensionService {
|
|||
log
|
||||
);
|
||||
|
||||
let finalBuiltinExtensions: TPromise<IExtensionDescription[]> = builtinExtensions;
|
||||
|
||||
if (devMode) {
|
||||
const extraBuiltinExtensions = ExtensionScanner.scanExtensions(new ExtensionScannerInput(version, commit, locale, devMode, ExtraDevSystemExtensionsRoot, true), log);
|
||||
finalBuiltinExtensions = TPromise.join([builtinExtensions, extraBuiltinExtensions]).then(([builtinExtensions, extraBuiltinExtensions]) => {
|
||||
let resultMap: { [id: string]: IExtensionDescription; } = Object.create(null);
|
||||
for (let i = 0, len = builtinExtensions.length; i < len; i++) {
|
||||
resultMap[builtinExtensions[i].id] = builtinExtensions[i];
|
||||
}
|
||||
// Overwrite with extensions found in extra
|
||||
for (let i = 0, len = extraBuiltinExtensions.length; i < len; i++) {
|
||||
resultMap[extraBuiltinExtensions[i].id] = extraBuiltinExtensions[i];
|
||||
}
|
||||
|
||||
let resultArr = Object.keys(resultMap).map((id) => resultMap[id]);
|
||||
resultArr.sort((a, b) => {
|
||||
const aLastSegment = path.basename(a.extensionFolderPath);
|
||||
const bLastSegment = path.basename(b.extensionFolderPath);
|
||||
if (aLastSegment < bLastSegment) {
|
||||
return -1;
|
||||
}
|
||||
if (aLastSegment > bLastSegment) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
return resultArr;
|
||||
});
|
||||
}
|
||||
|
||||
const userExtensions = (
|
||||
environmentService.disableExtensions || !environmentService.extensionsPath
|
||||
? TPromise.as([])
|
||||
|
@ -646,7 +677,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
|
|||
: TPromise.as([])
|
||||
);
|
||||
|
||||
return TPromise.join([builtinExtensions, userExtensions, developedExtensions])
|
||||
return TPromise.join([finalBuiltinExtensions, userExtensions, developedExtensions])
|
||||
.then((extensionDescriptions: IExtensionDescription[][]) => {
|
||||
const system = extensionDescriptions[0];
|
||||
const user = extensionDescriptions[1];
|
||||
|
|
Loading…
Reference in a new issue