web - get product config through build and not via API
This commit is contained in:
parent
ab10e26096
commit
ecc8571a79
|
@ -6,158 +6,11 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const gulp = require('gulp');
|
const gulp = require('gulp');
|
||||||
const path = require('path');
|
|
||||||
const es = require('event-stream');
|
|
||||||
const util = require('./lib/util');
|
|
||||||
const task = require('./lib/task');
|
|
||||||
const common = require('./lib/optimize');
|
|
||||||
const product = require('../product.json');
|
|
||||||
const rename = require('gulp-rename');
|
|
||||||
const filter = require('gulp-filter');
|
|
||||||
const json = require('gulp-json-editor');
|
|
||||||
const _ = require('underscore');
|
|
||||||
const deps = require('./dependencies');
|
|
||||||
const vfs = require('vinyl-fs');
|
|
||||||
const packageJson = require('../package.json');
|
|
||||||
const { compileBuildTask } = require('./gulpfile.compile');
|
|
||||||
|
|
||||||
const REPO_ROOT = path.dirname(__dirname);
|
const noop = () => { return Promise.resolve(); };
|
||||||
const commit = util.getVersion(REPO_ROOT);
|
|
||||||
const BUILD_ROOT = path.dirname(REPO_ROOT);
|
|
||||||
const WEB_FOLDER = path.join(REPO_ROOT, 'remote', 'web');
|
|
||||||
|
|
||||||
const productionDependencies = deps.getProductionDependencies(WEB_FOLDER);
|
gulp.task('minify-vscode-web', noop);
|
||||||
|
gulp.task('vscode-web', noop);
|
||||||
const nodeModules = Object.keys(product.dependencies || {})
|
gulp.task('vscode-web-min', noop);
|
||||||
.concat(_.uniq(productionDependencies.map(d => d.name)));
|
gulp.task('vscode-web-ci', noop);
|
||||||
|
gulp.task('vscode-web-min-ci', noop);
|
||||||
const vscodeWebResources = [
|
|
||||||
|
|
||||||
// Workbench
|
|
||||||
'out-build/vs/{base,platform,editor,workbench}/**/*.{svg,png}',
|
|
||||||
'out-build/vs/code/browser/workbench/*.html',
|
|
||||||
'out-build/vs/base/browser/ui/octiconLabel/octicons/**',
|
|
||||||
'out-build/vs/**/markdown.css',
|
|
||||||
|
|
||||||
// Webview
|
|
||||||
'out-build/vs/workbench/contrib/webview/browser/pre/*.js',
|
|
||||||
|
|
||||||
// Extension Worker
|
|
||||||
'out-build/vs/workbench/services/extensions/worker/extensionHostWorkerMain.js',
|
|
||||||
|
|
||||||
// Excludes
|
|
||||||
'!out-build/vs/**/{node,electron-browser,electron-main}/**',
|
|
||||||
'!out-build/vs/editor/standalone/**',
|
|
||||||
'!out-build/vs/workbench/**/*-tb.png',
|
|
||||||
'!**/test/**'
|
|
||||||
];
|
|
||||||
|
|
||||||
const buildfile = require('../src/buildfile');
|
|
||||||
|
|
||||||
const vscodeWebEntryPoints = _.flatten([
|
|
||||||
buildfile.entrypoint('vs/workbench/workbench.web.api'),
|
|
||||||
buildfile.base,
|
|
||||||
buildfile.workerExtensionHost,
|
|
||||||
buildfile.keyboardMaps,
|
|
||||||
buildfile.workbenchWeb
|
|
||||||
]);
|
|
||||||
|
|
||||||
const optimizeVSCodeWebTask = task.define('optimize-vscode-web', task.series(
|
|
||||||
util.rimraf('out-vscode-web'),
|
|
||||||
common.optimizeTask({
|
|
||||||
src: 'out-build',
|
|
||||||
entryPoints: _.flatten(vscodeWebEntryPoints),
|
|
||||||
otherSources: [],
|
|
||||||
resources: vscodeWebResources,
|
|
||||||
loaderConfig: common.loaderConfig(nodeModules),
|
|
||||||
out: 'out-vscode-web',
|
|
||||||
bundleInfo: undefined
|
|
||||||
})
|
|
||||||
));
|
|
||||||
|
|
||||||
const minifyVSCodeWebTask = task.define('minify-vscode-web', task.series(
|
|
||||||
optimizeVSCodeWebTask,
|
|
||||||
util.rimraf('out-vscode-web-min'),
|
|
||||||
common.minifyTask('out-vscode-web', `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`)
|
|
||||||
));
|
|
||||||
gulp.task(minifyVSCodeWebTask);
|
|
||||||
|
|
||||||
function packageTask(sourceFolderName, destinationFolderName) {
|
|
||||||
const destination = path.join(BUILD_ROOT, destinationFolderName);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
const src = gulp.src(sourceFolderName + '/**', { base: '.' })
|
|
||||||
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); }))
|
|
||||||
.pipe(filter(['**', '!**/*.js.map']));
|
|
||||||
|
|
||||||
const sources = es.merge(src);
|
|
||||||
|
|
||||||
let version = packageJson.version;
|
|
||||||
const quality = product.quality;
|
|
||||||
|
|
||||||
if (quality && quality !== 'stable') {
|
|
||||||
version += '-' + quality;
|
|
||||||
}
|
|
||||||
|
|
||||||
const name = product.nameShort;
|
|
||||||
const packageJsonStream = gulp.src(['remote/web/package.json'], { base: 'remote/web' })
|
|
||||||
.pipe(json({ name, version }));
|
|
||||||
|
|
||||||
const date = new Date().toISOString();
|
|
||||||
|
|
||||||
const productJsonStream = gulp.src(['product.json'], { base: '.' })
|
|
||||||
.pipe(json({ commit, date }));
|
|
||||||
|
|
||||||
const license = gulp.src(['remote/LICENSE'], { base: 'remote' });
|
|
||||||
|
|
||||||
const dependenciesSrc = _.flatten(productionDependencies.map(d => path.relative(REPO_ROOT, d.path)).map(d => [`${d}/**`, `!${d}/**/{test,tests}/**`, `!${d}/.bin/**`]));
|
|
||||||
|
|
||||||
const deps = gulp.src(dependenciesSrc, { base: 'remote/web', dot: true })
|
|
||||||
.pipe(filter(['**', '!**/package-lock.json']))
|
|
||||||
.pipe(util.cleanNodeModules(path.join(__dirname, '.nativeignore')));
|
|
||||||
|
|
||||||
const favicon = gulp.src('resources/server/favicon.ico', { base: 'resources/server' });
|
|
||||||
const manifest = gulp.src('resources/server/manifest.json', { base: 'resources/server' });
|
|
||||||
const pwaicons = es.merge(
|
|
||||||
gulp.src('resources/server/code-192.png', { base: 'resources/server' }),
|
|
||||||
gulp.src('resources/server/code-512.png', { base: 'resources/server' })
|
|
||||||
);
|
|
||||||
|
|
||||||
let all = es.merge(
|
|
||||||
packageJsonStream,
|
|
||||||
productJsonStream,
|
|
||||||
license,
|
|
||||||
sources,
|
|
||||||
deps,
|
|
||||||
favicon,
|
|
||||||
manifest,
|
|
||||||
pwaicons
|
|
||||||
);
|
|
||||||
|
|
||||||
let result = all
|
|
||||||
.pipe(util.skipDirectories())
|
|
||||||
.pipe(util.fixWin32DirectoryPermissions());
|
|
||||||
|
|
||||||
return result.pipe(vfs.dest(destination));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const dashed = (str) => (str ? `-${str}` : ``);
|
|
||||||
|
|
||||||
['', 'min'].forEach(minified => {
|
|
||||||
const sourceFolderName = `out-vscode-web${dashed(minified)}`;
|
|
||||||
const destinationFolderName = `vscode-web`;
|
|
||||||
|
|
||||||
const vscodeWebTaskCI = task.define(`vscode-web${dashed(minified)}-ci`, task.series(
|
|
||||||
minified ? minifyVSCodeWebTask : optimizeVSCodeWebTask,
|
|
||||||
util.rimraf(path.join(BUILD_ROOT, destinationFolderName)),
|
|
||||||
packageTask(sourceFolderName, destinationFolderName)
|
|
||||||
));
|
|
||||||
gulp.task(vscodeWebTaskCI);
|
|
||||||
|
|
||||||
const vscodeWebTask = task.define(`vscode-web${dashed(minified)}`, task.series(
|
|
||||||
compileBuildTask,
|
|
||||||
vscodeWebTaskCI
|
|
||||||
));
|
|
||||||
gulp.task(vscodeWebTask);
|
|
||||||
});
|
|
||||||
|
|
21
src/vs/platform/product/browser/product.ts
Normal file
21
src/vs/platform/product/browser/product.ts
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import { IProductConfiguration } from 'vs/platform/product/common/product';
|
||||||
|
import { assign } from 'vs/base/common/objects';
|
||||||
|
|
||||||
|
// Built time configuration (do NOT modify)
|
||||||
|
const product = { /*BUILD->INSERT_PRODUCT_CONFIGURATION*/ } as IProductConfiguration;
|
||||||
|
|
||||||
|
// Running out of sources
|
||||||
|
if (Object.keys(product).length === 0) {
|
||||||
|
assign(product, {
|
||||||
|
version: '1.38.0-dev',
|
||||||
|
nameLong: 'Visual Studio Code Web Dev',
|
||||||
|
nameShort: 'VSCode Web Dev'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default product;
|
|
@ -13,7 +13,8 @@ import { Workbench } from 'vs/workbench/browser/workbench';
|
||||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||||
import { REMOTE_FILE_SYSTEM_CHANNEL_NAME, RemoteExtensionsFileSystemProvider } from 'vs/platform/remote/common/remoteAgentFileSystemChannel';
|
import { REMOTE_FILE_SYSTEM_CHANNEL_NAME, RemoteExtensionsFileSystemProvider } from 'vs/platform/remote/common/remoteAgentFileSystemChannel';
|
||||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||||
import { IProductService, IProductConfiguration } from 'vs/platform/product/common/product';
|
import { IProductService } from 'vs/platform/product/common/product';
|
||||||
|
import product from 'vs/platform/product/browser/product';
|
||||||
import { RemoteAgentService } from 'vs/workbench/services/remote/browser/remoteAgentServiceImpl';
|
import { RemoteAgentService } from 'vs/workbench/services/remote/browser/remoteAgentServiceImpl';
|
||||||
import { RemoteAuthorityResolverService } from 'vs/platform/remote/browser/remoteAuthorityResolverService';
|
import { RemoteAuthorityResolverService } from 'vs/platform/remote/browser/remoteAuthorityResolverService';
|
||||||
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||||
|
@ -131,7 +132,13 @@ class CodeRendererMain extends Disposable {
|
||||||
serviceCollection.set(IWorkbenchEnvironmentService, environmentService);
|
serviceCollection.set(IWorkbenchEnvironmentService, environmentService);
|
||||||
|
|
||||||
// Product
|
// Product
|
||||||
const productService = this.createProductService();
|
const productService = {
|
||||||
|
_serviceBrand: undefined,
|
||||||
|
...{
|
||||||
|
...product, // dev or built time config
|
||||||
|
...{ urlProtocol: '' } // web related overrides from us
|
||||||
|
}
|
||||||
|
};
|
||||||
serviceCollection.set(IProductService, productService);
|
serviceCollection.set(IProductService, productService);
|
||||||
|
|
||||||
// Remote
|
// Remote
|
||||||
|
@ -220,18 +227,6 @@ class CodeRendererMain extends Disposable {
|
||||||
fileService.registerProvider(Schemas.userData, this.configuration.userDataProvider);
|
fileService.registerProvider(Schemas.userData, this.configuration.userDataProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
private createProductService(): IProductService {
|
|
||||||
const productConfiguration = {
|
|
||||||
...this.configuration.productConfiguration ? this.configuration.productConfiguration : {
|
|
||||||
version: '1.38.0-unknown',
|
|
||||||
nameLong: 'Unknown',
|
|
||||||
extensionAllowedProposedApi: [],
|
|
||||||
}, ...{ urlProtocol: '' }
|
|
||||||
} as IProductConfiguration;
|
|
||||||
|
|
||||||
return { _serviceBrand: undefined, ...productConfiguration };
|
|
||||||
}
|
|
||||||
|
|
||||||
private async createStorageService(payload: IWorkspaceInitializationPayload, environmentService: IWorkbenchEnvironmentService, fileService: IFileService, logService: ILogService): Promise<BrowserStorageService> {
|
private async createStorageService(payload: IWorkspaceInitializationPayload, environmentService: IWorkbenchEnvironmentService, fileService: IFileService, logService: ILogService): Promise<BrowserStorageService> {
|
||||||
const storageService = new BrowserStorageService(environmentService, fileService);
|
const storageService = new BrowserStorageService(environmentService, fileService);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import { IWebSocketFactory } from 'vs/platform/remote/browser/browserSocketFacto
|
||||||
import { ICredentialsProvider } from 'vs/workbench/services/credentials/browser/credentialsService';
|
import { ICredentialsProvider } from 'vs/workbench/services/credentials/browser/credentialsService';
|
||||||
import { IExtensionManifest } from 'vs/platform/extensions/common/extensions';
|
import { IExtensionManifest } from 'vs/platform/extensions/common/extensions';
|
||||||
import { IURLCallbackProvider } from 'vs/workbench/services/url/browser/urlService';
|
import { IURLCallbackProvider } from 'vs/workbench/services/url/browser/urlService';
|
||||||
import { IProductConfiguration } from 'vs/platform/product/common/product';
|
|
||||||
import { LogLevel } from 'vs/platform/log/common/log';
|
import { LogLevel } from 'vs/platform/log/common/log';
|
||||||
|
|
||||||
export interface IWorkbenchConstructionOptions {
|
export interface IWorkbenchConstructionOptions {
|
||||||
|
@ -74,11 +73,6 @@ export interface IWorkbenchConstructionOptions {
|
||||||
*/
|
*/
|
||||||
urlCallbackProvider?: IURLCallbackProvider;
|
urlCallbackProvider?: IURLCallbackProvider;
|
||||||
|
|
||||||
/**
|
|
||||||
* Experimental: Support for product configuration.
|
|
||||||
*/
|
|
||||||
productConfiguration?: IProductConfiguration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current logging level. Default is `LogLevel.Info`.
|
* Current logging level. Default is `LogLevel.Info`.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue