From 950bfce4200088fd5f8289ce8fc3b3b3216965ea Mon Sep 17 00:00:00 2001 From: Asher Date: Fri, 2 Aug 2019 20:29:48 -0500 Subject: [PATCH] Add commit, date, and checksums to product.json --- scripts/tasks.bash | 6 +++--- scripts/vscode.patch | 43 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/scripts/tasks.bash b/scripts/tasks.bash index 79f09d2f..68edf764 100755 --- a/scripts/tasks.bash +++ b/scripts/tasks.bash @@ -72,10 +72,10 @@ function build-code-server() { cd "${buildPath}" && yarn --production --force --build-from-source rm "${buildPath}/"{package.json,yarn.lock,.yarnrc} - local json="{\"codeServerVersion\": \"${codeServerVersion}\"}" + local packageJson="{\"codeServerVersion\": \"${codeServerVersion}\"}" cp -r "${sourcePath}/.build/extensions" "${buildPath}" - node "${rootPath}/scripts/merge.js" "${sourcePath}/package.json" "${rootPath}/scripts/package.json" "${buildPath}/package.json" "${json}" - node "${rootPath}/scripts/merge.js" "${sourcePath}/product.json" "${rootPath}/scripts/product.json" "${buildPath}/product.json" + node "${rootPath}/scripts/merge.js" "${sourcePath}/package.json" "${rootPath}/scripts/package.json" "${buildPath}/package.json" "${packageJson}" + node "${rootPath}/scripts/merge.js" "${sourcePath}/.build/product.json" "${rootPath}/scripts/product.json" "${buildPath}/product.json" cp -r "${sourcePath}/out-vscode${min}" "${buildPath}/out" # Only keep production dependencies for the server. diff --git a/scripts/vscode.patch b/scripts/vscode.patch index 87586247..4209e913 100644 --- a/scripts/vscode.patch +++ b/scripts/vscode.patch @@ -11,7 +11,7 @@ index 0dd2e5abf1..fc6875f3c2 100644 // All Build const compileBuildTask = task.define('compile-build', task.parallel(compileClientBuildTask, compileExtensionsBuildTask)); diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js -index 84a6be26e8..7fb43686cd 100644 +index 84a6be26e8..e50618be3a 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -34,7 +34,8 @@ const deps = require('./dependencies'); @@ -85,16 +85,27 @@ index 84a6be26e8..7fb43686cd 100644 ), common.optimizeTask({ src: 'out-build', -@@ -127,6 +134,20 @@ const minifyVSCodeTask = task.define('minify-vscode', task.series( - common.minifyTask('out-vscode', `${sourceMappingURLBase}/core`) +@@ -104,7 +111,8 @@ const optimizeVSCodeTask = task.define('optimize-vscode', task.series( + header: BUNDLED_FILE_HEADER, + out: 'out-vscode', + bundleInfo: undefined +- }) ++ }), ++ () => writeProduct() + )); + + +@@ -124,9 +132,36 @@ const minifyVSCodeTask = task.define('minify-vscode', task.series( + util.rimraf('out-vscode-min'), + optimizeIndexJSTask + ), +- common.minifyTask('out-vscode', `${sourceMappingURLBase}/core`) ++ common.minifyTask('out-vscode', `${sourceMappingURLBase}/core`), ++ () => writeProduct('out-vscode-min') )); +function packageExtensionsTask() { -+ return () => { -+ const destination = path.join(root, ".build"); -+ const sources = ext.packageExtensionsStream(); -+ return sources.pipe(vfs.dest(destination)); -+ }; ++ return () => ext.packageExtensionsStream().pipe(vfs.dest(path.join(root, '.build'))); +} +gulp.task(task.define('extensions-build-package', task.series( + compileExtensionsBuildTask, @@ -102,6 +113,22 @@ index 84a6be26e8..7fb43686cd 100644 +))); +gulp.task(optimizeVSCodeTask); +gulp.task(minifyVSCodeTask); ++function writeProduct(sourceFolderName) { ++ const checksums = sourceFolderName && computeChecksums(sourceFolderName, [ ++ 'vs/workbench/workbench.web.api.js', ++ 'vs/workbench/workbench.web.api.css', ++ 'vs/code/browser/workbench/workbench.html', ++ 'vs/code/browser/workbench/workbench.js', ++ 'vs/server/src/cli.js', ++ 'vs/server/src/uriTransformer.js', ++ 'vs/server/src/login/index.html' ++ ]); ++ const date = new Date().toISOString(); ++ const productJsonUpdate = { commit, date, checksums }; ++ return gulp.src(['product.json'], { base: '.' }) ++ .pipe(json(productJsonUpdate)) ++ .pipe(vfs.dest(path.join(root, '.build'))); ++} + // Package