Преглед на файлове

fix(sourcemap): add quality to sourcemaps release [skip ci]

Baptiste Augrain преди 6 дни
родител
ревизия
c0ac4bd72e
променени са 2 файла, в които са добавени 34 реда и са изтрити 25 реда
  1. 28 20
      patches/sourcemaps.patch
  2. 6 5
      upload_sourcemaps.sh

+ 28 - 20
patches/sourcemaps.patch

@@ -1,63 +1,71 @@
 diff --git a/build/gulpfile.extensions.js b/build/gulpfile.extensions.js
-index 7826f48..ff0e2f0 100644
+index 7826f48..eca4a1d 100644
 --- a/build/gulpfile.extensions.js
 +++ b/build/gulpfile.extensions.js
-@@ -74,3 +74,3 @@ const compilations = [
+@@ -23,2 +23,3 @@ const plumber = require('gulp-plumber');
+ const ext = require('./lib/extensions');
++const product = require('../product.json');
+ 
+@@ -74,3 +75,3 @@ const compilations = [
  
 -const getBaseUrl = out => `https://main.vscode-cdn.net/sourcemaps/${commit}/${out}`;
-+const getBaseUrl = out => `https://github.com/VSCodium/sourcemaps/releases/download/${commit}/${out.replaceAll('/', '-')}`;
++const getBaseUrl = out => `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}/${out.replaceAll('/', '-')}`;
  
 diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js
-index 10b7b44..895b25b 100644
+index 10b7b44..79861bf 100644
 --- a/build/gulpfile.reh.js
 +++ b/build/gulpfile.reh.js
 @@ -454,3 +454,3 @@ function tweakProductForServerWeb(product) {
  		util.rimraf(`out-vscode-${type}-min`),
 -		optimize.minifyTask(`out-vscode-${type}`, `https://main.vscode-cdn.net/sourcemaps/${commit}/core`)
-+		optimize.minifyTask(`out-vscode-${type}`, `https://github.com/VSCodium/sourcemaps/releases/download/${commit}/core`)
++		optimize.minifyTask(`out-vscode-${type}`, `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}/core`)
  	));
 diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
-index ed06b6a..ebedfc4 100644
+index ed06b6a..9488983 100644
 --- a/build/gulpfile.vscode.js
 +++ b/build/gulpfile.vscode.js
 @@ -147,3 +147,3 @@ gulp.task(bundleVSCodeTask);
  
 -const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${commit}`;
-+const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${commit}`;
++const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}`;
  const minifyVSCodeTask = task.define('minify-vscode', task.series(
 diff --git a/build/gulpfile.vscode.web.js b/build/gulpfile.vscode.web.js
-index 295a977..ba0a598 100644
+index 295a977..318ce92 100644
 --- a/build/gulpfile.vscode.web.js
 +++ b/build/gulpfile.vscode.web.js
 @@ -140,3 +140,3 @@ const minifyVSCodeWebTask = task.define('minify-vscode-web', task.series(
  	util.rimraf('out-vscode-web-min'),
 -	optimize.minifyTask('out-vscode-web', `https://main.vscode-cdn.net/sourcemaps/${commit}/core`)
-+	optimize.minifyTask('out-vscode-web', `https://github.com/VSCodium/sourcemaps/releases/download/${commit}/core`)
++	optimize.minifyTask('out-vscode-web', `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}/core`)
  ));
 diff --git a/build/lib/extensions.js b/build/lib/extensions.js
-index c80a1be..000cf9f 100644
+index c80a1be..25cf259 100644
 --- a/build/lib/extensions.js
 +++ b/build/lib/extensions.js
-@@ -76,3 +76,3 @@ const root = path_1.default.dirname(path_1.default.dirname(__dirname));
+@@ -75,4 +75,5 @@ const vzip = require('gulp-vinyl-zip');
+ const root = path_1.default.dirname(path_1.default.dirname(__dirname));
++const product = JSON.parse(fs_1.default.readFileSync(path_1.default.join(root, 'product.json'), 'utf8'));
  const commit = (0, getVersion_1.getVersion)(root);
 -const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${commit}`;
-+const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${commit}`;
++const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}`;
  function minifyExtensionResources(input) {
-@@ -205,3 +205,3 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName, disableMangle) {
+@@ -205,3 +206,3 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName, disableMangle) {
                          data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) {
 -                            return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path_1.default.basename(extensionPath)}/${relativeOutputPath}/${g1}`;
 +                            return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions-${path_1.default.basename(extensionPath).replaceAll('/', '-')}-${relativeOutputPath.replaceAll('/', '-')}-${g1.replaceAll('/', '-')}`;
                          }), 'utf8');
 diff --git a/build/lib/extensions.ts b/build/lib/extensions.ts
-index 9e7cf9f..e5f7c24 100644
+index 9e7cf9f..eed31ca 100644
 --- a/build/lib/extensions.ts
 +++ b/build/lib/extensions.ts
-@@ -31,3 +31,3 @@ const root = path.dirname(path.dirname(__dirname));
+@@ -30,4 +30,5 @@ const vzip = require('gulp-vinyl-zip');
+ const root = path.dirname(path.dirname(__dirname));
++const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));
  const commit = getVersion(root);
 -const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${commit}`;
-+const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${commit}`;
++const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}`;
  
-@@ -179,3 +179,3 @@ function fromLocalWebpack(extensionPath: string, webpackConfigFileName: string,
+@@ -179,3 +180,3 @@ function fromLocalWebpack(extensionPath: string, webpackConfigFileName: string,
  							data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) {
 -								return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path.basename(extensionPath)}/${relativeOutputPath}/${g1}`;
 +								return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions-${path.basename(extensionPath).replaceAll('/', '-')}-${relativeOutputPath.replaceAll('/', '-')}-${g1.replaceAll('/', '-')}`;
@@ -81,15 +89,15 @@ index d89d0d6..fca30cf 100644
 +	const sourceMappingURL = sourceMapBaseUrl ? ((f: any) => `${sourceMapBaseUrl}-${f.relative.replaceAll('/', '-')}.map`) : undefined;
  
 diff --git a/build/lib/util.js b/build/lib/util.js
-index 389b9e0..9abdb3c 100644
+index 389b9e0..f80d8e5 100644
 --- a/build/lib/util.js
 +++ b/build/lib/util.js
 @@ -235,4 +235,4 @@ function rewriteSourceMappingURL(sourceMappingURLBase) {
          const contents = f.contents.toString('utf8');
 -        const str = `//# sourceMappingURL=${sourceMappingURLBase}/${path_1.default.dirname(f.relative).replace(/\\/g, '/')}/$1`;
 -        f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, str));
-+		const fp = path_1.default.dirname(f.relative).replace(/\\/g, '/').replaceAll('/', '-');
-+		f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, (_m, p) => `//# sourceMappingURL=${sourceMappingURLBase}/${fp}-${p.replaceAll('/', '-')}`));
++        const fp = path_1.default.dirname(f.relative).replace(/\\/g, '/').replaceAll('/', '-');
++        f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, (_m, p) => `//# sourceMappingURL=${sourceMappingURLBase}/${fp}-${p.replaceAll('/', '-')}`));
          return f;
 diff --git a/build/lib/util.ts b/build/lib/util.ts
 index 4931342..833091c 100644

+ 6 - 5
upload_sourcemaps.sh

@@ -33,27 +33,28 @@ checksum -a sha256 checksum.txt > checksum.txt.sha256
 
 REPOSITORY_OWNER="${SOURCEMAPS_REPOSITORY/\/*/}"
 REPOSITORY_NAME="${SOURCEMAPS_REPOSITORY/*\//}"
+RELEASE_TAG="${VSCODE_QUALITY}-${BUILD_SOURCEVERSION}"
 
-gh release create "${BUILD_SOURCEVERSION}" --repo "${SOURCEMAPS_REPOSITORY}" --title "${RELEASE_VERSION}"
+gh release create "${RELEASE_TAG}" --repo "${SOURCEMAPS_REPOSITORY}" --title "${RELEASE_VERSION}"
 
 set +e
 
 for FILE in *; do
   if [[ -f "${FILE}" ]]; then
     echo "::group::Uploading '${FILE}' at $( date "+%T" )"
-    gh release upload --repo "${SOURCEMAPS_REPOSITORY}" "${RELEASE_VERSION}" "${FILE}"
+    gh release upload --repo "${SOURCEMAPS_REPOSITORY}" "${RELEASE_TAG}" "${FILE}"
 
     EXIT_STATUS=$?
     echo "exit: ${EXIT_STATUS}"
 
     if (( "${EXIT_STATUS}" )); then
       for (( i=0; i<10; i++ )); do
-        github-release delete --owner "${REPOSITORY_OWNER}" --repo "${REPOSITORY_NAME}" --tag "${BUILD_SOURCEVERSION}" "${FILE}"
+        github-release delete --owner "${REPOSITORY_OWNER}" --repo "${REPOSITORY_NAME}" --tag "${RELEASE_TAG}" "${FILE}"
 
         sleep $(( 15 * (i + 1)))
 
         echo "RE-Uploading '${FILE}' at $( date "+%T" )"
-        gh release upload --repo "${SOURCEMAPS_REPOSITORY}" "${BUILD_SOURCEVERSION}" "${FILE}"
+        gh release upload --repo "${SOURCEMAPS_REPOSITORY}" "${RELEASE_TAG}" "${FILE}"
 
         EXIT_STATUS=$?
         echo "exit: ${EXIT_STATUS}"
@@ -67,7 +68,7 @@ for FILE in *; do
       if (( "${EXIT_STATUS}" )); then
         echo "'${FILE}' hasn't been uploaded!"
 
-        github-release delete --owner "${REPOSITORY_OWNER}" --repo "${REPOSITORY_NAME}" --tag "${BUILD_SOURCEVERSION}" "${FILE}"
+        github-release delete --owner "${REPOSITORY_OWNER}" --repo "${REPOSITORY_NAME}" --tag "${RELEASE_TAG}" "${FILE}"
 
         exit 1
       fi