From 90b109f85402071015d8437ba5a8904b968b7e03 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Sat, 9 Dec 2023 20:13:24 +1100 Subject: [PATCH] Remove old code used to generate & update version (#14889) --- build/azure-pipeline.pre-release.yml | 5 --- build/azure-pipeline.stable.yml | 5 --- gulpfile.js | 64 ---------------------------- package.json | 1 - 4 files changed, 75 deletions(-) diff --git a/build/azure-pipeline.pre-release.yml b/build/azure-pipeline.pre-release.yml index 921f6f983..6facd9572 100644 --- a/build/azure-pipeline.pre-release.yml +++ b/build/azure-pipeline.pre-release.yml @@ -87,11 +87,6 @@ extends: - script: python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r ./requirements.txt displayName: Install Python libs - - script: npm run updateBuildNumber - displayName: Update build number - env: - VSC_BUILD_ID: $(Build.BuildNumber) - - script: npm run prePublishBundlePreRelease displayName: Build env: diff --git a/build/azure-pipeline.stable.yml b/build/azure-pipeline.stable.yml index 2efea23c9..63d05f082 100644 --- a/build/azure-pipeline.stable.yml +++ b/build/azure-pipeline.stable.yml @@ -81,11 +81,6 @@ extends: - script: python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r ./requirements.txt displayName: Install Python libs - - script: npm run updateBuildNumber - displayName: Update build number - env: - VSC_BUILD_ID: $(Build.BuildNumber) - - script: npm run prePublishBundleStable displayName: Build env: diff --git a/gulpfile.js b/gulpfile.js index ae7f18a7d..d49529bc3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -228,70 +228,6 @@ gulp.task('updatePackageJsonForBundle', async () => { } } }); - -gulp.task('updateBuildNumber', async () => { - await updateBuildNumber(); -}); - -/** - * For multi-platform builds We end up generating multiple VSIX in the same pipeline. - * As a result this runs multiple times in the same pipeline, - * and we can have different build numbers for different VSIX. - * - * On CI, we use the Azure Build Number to generate a unique build number. - * The Azure Build Number will contain the date time information of the current build time - */ -function getBuildDate() { - const vscBuildId = process.env.VSC_BUILD_ID || ''; - const buildParts = vscBuildId.split('_'); - if (buildParts.length >= 3) { - return new Date( - parseInt(buildParts[0].substring(0, 4), 10), - parseInt(buildParts[0].substring(4, 6), 10) - 1, - parseInt(buildParts[0].substring(6), 10), - parseInt(buildParts[1], 10), - parseInt(buildParts[2], 10) - ); - } else { - return new Date(); - } -} - -async function updateBuildNumber() { - // Edit the version number from the package.json - const packageJsonContents = await fs.readFile('package.json', 'utf-8'); - const packageJson = JSON.parse(packageJsonContents); - - // Change version number - // 3rd part of version is limited to Max Int32 numbers (in VSC Marketplace). - // Hence build numbers can only be YYYY.MMM.2147483647 - // NOTE: For each of the following strip the first 3 characters from the build number. - // E.g. if we have build number of `build number = 3264527301, then take 4527301 - - // To ensure we can have point releases & insider builds, we're going with the following format: - // Insider & Release builds will be YYYY.MMM.100 - // When we have a hot fix, we update the version to YYYY.MMM.110 - // If we have more hot fixes, they'll be YYYY.MMM.120, YYYY.MMM.130, & so on. - - const versionParts = packageJson.version.split('.'); - // New build is of the form `DDDHHMM` (day of year, hours, minute) (7 digits, as out of the 10 digits first three are reserved for `100` or `101` for patches). - // Use date time for build, this way all subsequent builds are incremental and greater than the others before. - // Example build for 3Jan 12:45 will be `0031245`, and 16 Feb 8:50 will be `0470845` - const today = getBuildDate(); - const dayCount = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; - const dayOfYear = dayCount[today.getMonth()] + today.getDate() + 1; - const buildNumberSuffix = `${dayOfYear.toString().padStart(3, '0')}${(today.getHours() + 1) - .toString() - .padStart(2, '0')}${today.getMinutes().toString().padStart(2, '0')}`; - const buildNumber = `${versionParts[2].substring(0, 3)}${buildNumberSuffix}`; - const newVersion = - versionParts.length > 1 ? `${versionParts[0]}.${versionParts[1]}.${buildNumber}` : packageJson.version; - packageJson.version = newVersion; - console.log('Build Number', newVersion); - // Write back to the package json - await fs.writeFile('package.json', JSON.stringify(packageJson, null, 4), 'utf-8'); -} - async function buildWebPack(webpackConfigName, args, env) { // Remember to perform a case insensitive search. const allowedWarnings = getAllowedWarningsForWebPack(webpackConfigName).map((item) => item.toLowerCase()); diff --git a/package.json b/package.json index 13da62421..17df0a40d 100644 --- a/package.json +++ b/package.json @@ -2263,7 +2263,6 @@ "format": "prettier --write *.js *.json 'src/**/*.ts*' 'build/**/*.js' '.github/**/*.yml' 'build/**/*.yml' 'build/**/*.ts' 'build/**/*.json' gulpfile.js", "format-check": "prettier --check *.js *.json 'src/**/*.ts*' 'build/**/*.js' '.github/**/*.yml' 'build/**/*.yml' 'build/**/*.ts' 'build/**/*.json' gulpfile.js", "clean": "gulp clean", - "updateBuildNumber": "gulp updateBuildNumber", "webpack": "webpack", "download-api": "npx vscode-dts dev", "postdownload-api": "npx vscode-dts main",