From b43b0d5d291776999be9ec27c2e1f88221be701c Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Wed, 13 May 2020 15:20:02 -0400 Subject: [PATCH 01/29] :memo: README.md: Update python for manual Linux installs We support Python 3 now. Use that in the default instructions, but explain that `python2` or `python` will work in its place. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 23a37611bae..b8b9ff9da6c 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@ An archive is available for people who don't want to install `atom` as root. This version enables you to install multiple Atom versions in parallel. It has been built on Ubuntu 64-bit, but should be compatible with other Linux distributions. -1. Install dependencies (on Ubuntu): `sudo apt install git gconf2 gconf-service libgtk2.0-0 libudev1 libgcrypt20 libnotify4 libxtst6 libnss3 python gvfs-bin xdg-utils libcap2` +1. Install dependencies (on Ubuntu): `sudo apt install git gconf2 gconf-service libgtk2.0-0 libudev1 libgcrypt20 libnotify4 libxtst6 libnss3 python3 gvfs-bin xdg-utils libcap2` + 1. (If the `python3` package isn't available, or is too old (Python 3 should be >= 3.5), either `python2` or `python` will work in its place.) 2. Download `atom-amd64.tar.gz` from the [Atom releases page](https://github.com/atom/atom/releases/latest). 3. Run `tar xf atom-amd64.tar.gz` in the directory where you want to extract the Atom folder. 4. Launch Atom using the installed `atom` command from the newly extracted directory. From 10811f1158d7956fafb78aeff490f3a65de0f137 Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Wed, 13 May 2020 15:28:11 -0400 Subject: [PATCH 02/29] :fire: Lintian overrides These overrides are very outdated. (Haven't been updated since the day they were added, back in 2014.) Even with these applied, Lintian still prints many warns/errors. I think no-one has been running Lintian against the .deb package for a while now. --- resources/linux/debian/lintian-overrides | 7 ------- script/lib/create-debian-package.js | 20 -------------------- 2 files changed, 27 deletions(-) delete mode 100644 resources/linux/debian/lintian-overrides diff --git a/resources/linux/debian/lintian-overrides b/resources/linux/debian/lintian-overrides deleted file mode 100644 index 8a33af0a787..00000000000 --- a/resources/linux/debian/lintian-overrides +++ /dev/null @@ -1,7 +0,0 @@ -atom: arch-dependent-file-in-usr-share -atom: changelog-file-missing-in-native-package -atom: copyright-file-contains-full-apache-2-license -atom: copyright-should-refer-to-common-license-file-for-apache-2 -atom: embedded-library -atom: package-installs-python-bytecode -atom: unstripped-binary-or-object diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index e79d256e88c..af94058aabf 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -54,11 +54,6 @@ module.exports = function(packagedAppPath) { debianPackageShareDirPath, 'pixmaps' ); - const debianPackageLintianOverridesDirPath = path.join( - debianPackageShareDirPath, - 'lintian', - 'overrides' - ); const debianPackageDocsDirPath = path.join( debianPackageShareDirPath, 'doc', @@ -93,7 +88,6 @@ module.exports = function(packagedAppPath) { fs.mkdirpSync(debianPackageShareDirPath); fs.mkdirpSync(debianPackageApplicationsDirPath); fs.mkdirpSync(debianPackageIconsDirPath); - fs.mkdirpSync(debianPackageLintianOverridesDirPath); fs.mkdirpSync(debianPackageDocsDirPath); fs.mkdirpSync(debianPackageBinDirPath); @@ -190,20 +184,6 @@ module.exports = function(packagedAppPath) { path.join(debianPackageDocsDirPath, 'copyright') ); - console.log( - `Copying lintian overrides into "${debianPackageLintianOverridesDirPath}"` - ); - fs.copySync( - path.join( - CONFIG.repositoryRootPath, - 'resources', - 'linux', - 'debian', - 'lintian-overrides' - ), - path.join(debianPackageLintianOverridesDirPath, atomExecutableName) - ); - console.log( `Copying polkit configuration into "${debianPackageShareDirPath}"` ); From b86afa5854c84bfa223a5e4d7ed3866f06b35ca5 Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Fri, 29 May 2020 00:34:00 -0400 Subject: [PATCH 03/29] script: Reimplement node-gyp's find-python library Use this to find python for the verify-machine-requirements.js script. --- script/lib/verify-machine-requirements.js | 114 +++++++++++++++++----- 1 file changed, 87 insertions(+), 27 deletions(-) diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index 51ca5a6cd13..d3f0009ceb1 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -9,9 +9,7 @@ const CONFIG = require('../config'); module.exports = function(ci) { verifyNode(); verifyNpm(ci); - if (process.platform === 'win32') { - verifyPython(); - } + verifyPython(); }; function verifyNode() { @@ -50,36 +48,98 @@ function verifyNpm(ci) { } function verifyPython() { - const systemDrive = process.env.SystemDrive || 'C:\\'; - let pythonExecutable; - if (process.env.PYTHON) { - pythonExecutable = process.env.PYTHON; - } else { - const pythonBinPath = path.join(systemDrive, 'Python27', 'python.exe'); - if (fs.existsSync(pythonBinPath)) { - pythonExecutable = pythonBinPath; - } else { - pythonExecutable = 'python'; + // This function essentially re-implements node-gyp's "find-python.js" library, + // but in a synchronous, bootstrap-script-friendly way. + // It is based off of the logic of the file from node-gyp v5.x: + // https://github.com/nodejs/node-gyp/blob/v5.1.1/lib/find-python.js + // This node-gyp is the version in use by current npm (in mid 2020). + // + // TODO: If apm ships a newer version of node-gyp (v6.x or later), please update this script. + // Particularly, node-gyp v6.x looks for python3 first, then python, then python2. + // (In contrast: node-gyp v5.x looks for python first, then python2, then python3.) + // Also, node-gyp v7.x or later will probably drop the "-2" flag from "py.exe", + // so as to allow finding Python 3 as well, not just Python 2. + // https://github.com/nodejs/node-gyp/pull/2124#issuecomment-633812957 + + var stdout; + var fullVersion; + var usablePythonWasFound; + + function verifyBinary(binary, prependFlag) { + if (binary && !usablePythonWasFound) { + let allFlags = ['-c', 'import platform\nprint(platform.python_version())']; + if (prependFlag) { + // prependFlag is an optional argument, + // used to prepend "-2" for the "py.exe" launcher. + // TODO: Refactor by eliminating prependFlag + // once apm updates to node-gyp v7.x+, when it is anticipated + // that the "-2" flag will be dropped for invoking the py launcher. + allFlags.unshift(prependFlag); + } + + try { + stdout = childProcess.execFileSync( + binary, + allFlags, + { env: process.env, stdio: ['ignore', 'pipe', 'ignore'] } + ); + } catch { + } + + if (stdout) { + if (stdout.indexOf('+') !== -1) stdout = stdout.toString().replace(/\+/g, ''); + if (stdout.indexOf('rc') !== -1) stdout = stdout.toString().replace(/rc(.*)$/gi, ''); + fullVersion = stdout.toString().trim(); + } + + if (fullVersion) { + var versionComponents = fullVersion.split('.'); + var majorVersion = Number(versionComponents[0]); + var minorVersion = Number(versionComponents[1]); + if (majorVersion === 2 && minorVersion === 7 || majorVersion === 3 && minorVersion >= 5) { + usablePythonWasFound = true; + } else { + stdout = ''; + } + } } } - let stdout = childProcess.execFileSync( - pythonExecutable, - ['-c', 'import platform\nprint(platform.python_version())'], - { env: process.env } - ); - if (stdout.indexOf('+') !== -1) stdout = stdout.replace(/\+/g, ''); - if (stdout.indexOf('rc') !== -1) stdout = stdout.replace(/rc(.*)$/gi, ''); - const fullVersion = stdout.toString().trim(); - const versionComponents = fullVersion.split('.'); - const majorVersion = Number(versionComponents[0]); - const minorVersion = Number(versionComponents[1]); - if (majorVersion === 2 && minorVersion === 7) { + function verifyForcedBinary(binary) { + if (typeof binary !== 'undefined' && binary.length > 0) { + verifyBinary(binary); + if (!usablePythonWasFound){ + throw new Error( + `NODE_GYP_FORCE_PYTHON is set to: "${binary}", but this is not a valid Python.\n` + + 'Please set NODE_GYP_FORCE_PYTHON to something valid, or unset it entirely.\n' + + '(Python 2.7 or 3.5+ is required to build Atom.)\n' + ); + } + } + } + + // These first two checks do nothing if the relevant + // environment variables aren't set. + verifyForcedBinary(process.env.NODE_GYP_FORCE_PYTHON); + // All the following checks will no-op if a previous check has succeeded. + verifyBinary(process.env.PYTHON); + verifyBinary('python'); + verifyBinary('python2'); + verifyBinary('python3'); + if (process.platform === 'win32') { + verifyBinary('py.exe', '-2'); + verifyBinary(path.join(process.env.SystemDrive || 'C:', 'Python27', 'python.exe')); + verifyBinary(path.join(process.env.SystemDrive || 'C:', 'Python37', 'python.exe')); + } + + if (usablePythonWasFound) { console.log(`Python:\tv${fullVersion}`); } else { throw new Error( - `Python 2.7 is required to build Atom. ${pythonExecutable} returns version ${fullVersion}.\n` + - `Set the PYTHON env var to '/path/to/Python27/python.exe' if your python is installed in a non-default location.` + 'Python 2.7 or 3.5+ is required to build Atom.\n' + + 'verify-machine-requirements.js was unable to find such a version of Python.\n' + + "Set the PYTHON env var to e.g. 'C:/path/to/Python27/python.exe'\n" + + 'if your Python is installed in a non-default location.\n' ); } } From b383e0a0db889d94f7d3c5f3172b278ca134037c Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Fri, 29 May 2020 23:40:09 -0400 Subject: [PATCH 04/29] :fire: .python-version .python-version specifies which version(s) of Python are in the PATH, and which version runs when you run the python, python2, or python3 commands. That said, it is overly specific for this repository's needs. In order to specify any version, you must enter it down to the patch level, e.g. 3.8.2; Major-minor versions aren't allowed, e.g. 2.7 If users want to add such a file on their own machines, they may... But it's unneccesary for this repository to ship this file as if there were specific "correct" versions of Python to use. Any Python 2.7.x or 3.5.0+ will work at the moment. There are other checks elsewhere in the project, such as in script/bootstrap. These should be sufficient to inform users which Python versions they can use. node-gyp will also tell you. --- .gitignore | 1 + .python-version | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 .python-version diff --git a/.gitignore b/.gitignore index 5457617c540..cd95b89a0e1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ Thumbs.db .svn .nvm-version .vscode +.python-version node_modules npm-debug.log debug.log diff --git a/.python-version b/.python-version deleted file mode 100644 index ecc17b8e90f..00000000000 --- a/.python-version +++ /dev/null @@ -1 +0,0 @@ -2.7.13 From 2c6c14d1977b9f92dbeb702e3b89a652f9fadbe6 Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Sat, 30 May 2020 15:30:05 -0400 Subject: [PATCH 05/29] script: Add attempt logging for verifyPython() Log which Python commands were tried, and the results, if no usable Python was found. Useful for debugging failures. --- script/lib/verify-machine-requirements.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index d3f0009ceb1..27eb73bf45e 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -64,6 +64,7 @@ function verifyPython() { var stdout; var fullVersion; var usablePythonWasFound; + var triedLog = ''; function verifyBinary(binary, prependFlag) { if (binary && !usablePythonWasFound) { @@ -102,6 +103,14 @@ function verifyPython() { stdout = ''; } } + + // Prepare to log which commands were tried, and the results, in case no usable Python can be found. + if (prependFlag) { + var binaryPlusFlag = binary.concat(' ' + prependFlag); + } else { + var binaryPlusFlag = binary; + } + triedLog = triedLog.concat('log message: tried to check version of "' + binaryPlusFlag + '", got: ' + fullVersion + '\n'); } } @@ -136,10 +145,11 @@ function verifyPython() { console.log(`Python:\tv${fullVersion}`); } else { throw new Error( - 'Python 2.7 or 3.5+ is required to build Atom.\n' + - 'verify-machine-requirements.js was unable to find such a version of Python.\n' + - "Set the PYTHON env var to e.g. 'C:/path/to/Python27/python.exe'\n" + - 'if your Python is installed in a non-default location.\n' + `\n${triedLog}\n` + + 'Python 2.7 or 3.5+ is required to build Atom.\n' + + 'verify-machine-requirements.js was unable to find such a version of Python.\n' + + "Set the PYTHON env var to e.g. 'C:/path/to/Python27/python.exe'\n" + + 'if your Python is installed in a non-default location.\n' ); } } From 2656d197144fc6be3b7c1869e4c6a04074800004 Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Sat, 30 May 2020 17:41:59 -0400 Subject: [PATCH 06/29] ci: Update Windows build from Python 2.7 to 3.8 Python 2 is officially end-of-life. We can use Python 3 now. --- script/vsts/platforms/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 23782335a34..d1035135de8 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -22,7 +22,7 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '2.7' + versionSpec: '3.8' - task: NodeTool@0 inputs: From 4d9d6fa1714ba08d26efd3c5b7522047c76d7e91 Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Sat, 30 May 2020 18:40:27 -0400 Subject: [PATCH 07/29] :shirt: Fix lints (verify-machine-requirements.js) --- script/lib/verify-machine-requirements.js | 60 ++++++++++++++--------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index 27eb73bf45e..24b0ccf9fc2 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -1,7 +1,6 @@ 'use strict'; const childProcess = require('child_process'); -const fs = require('fs'); const path = require('path'); const CONFIG = require('../config'); @@ -65,10 +64,14 @@ function verifyPython() { var fullVersion; var usablePythonWasFound; var triedLog = ''; + var binaryPlusFlag; function verifyBinary(binary, prependFlag) { if (binary && !usablePythonWasFound) { - let allFlags = ['-c', 'import platform\nprint(platform.python_version())']; + let allFlags = [ + '-c', + 'import platform\nprint(platform.python_version())' + ]; if (prependFlag) { // prependFlag is an optional argument, // used to prepend "-2" for the "py.exe" launcher. @@ -79,17 +82,17 @@ function verifyPython() { } try { - stdout = childProcess.execFileSync( - binary, - allFlags, - { env: process.env, stdio: ['ignore', 'pipe', 'ignore'] } - ); - } catch { - } + stdout = childProcess.execFileSync(binary, allFlags, { + env: process.env, + stdio: ['ignore', 'pipe', 'ignore'] + }); + } catch {} if (stdout) { - if (stdout.indexOf('+') !== -1) stdout = stdout.toString().replace(/\+/g, ''); - if (stdout.indexOf('rc') !== -1) stdout = stdout.toString().replace(/rc(.*)$/gi, ''); + if (stdout.indexOf('+') !== -1) + stdout = stdout.toString().replace(/\+/g, ''); + if (stdout.indexOf('rc') !== -1) + stdout = stdout.toString().replace(/rc(.*)$/gi, ''); fullVersion = stdout.toString().trim(); } @@ -97,7 +100,10 @@ function verifyPython() { var versionComponents = fullVersion.split('.'); var majorVersion = Number(versionComponents[0]); var minorVersion = Number(versionComponents[1]); - if (majorVersion === 2 && minorVersion === 7 || majorVersion === 3 && minorVersion >= 5) { + if ( + (majorVersion === 2 && minorVersion === 7) || + (majorVersion === 3 && minorVersion >= 5) + ) { usablePythonWasFound = true; } else { stdout = ''; @@ -106,22 +112,28 @@ function verifyPython() { // Prepare to log which commands were tried, and the results, in case no usable Python can be found. if (prependFlag) { - var binaryPlusFlag = binary.concat(' ' + prependFlag); + binaryPlusFlag = binary.concat(' ' + prependFlag); } else { - var binaryPlusFlag = binary; + binaryPlusFlag = binary; } - triedLog = triedLog.concat('log message: tried to check version of "' + binaryPlusFlag + '", got: ' + fullVersion + '\n'); + triedLog = triedLog.concat( + 'log message: tried to check version of "' + + binaryPlusFlag + + '", got: ' + + fullVersion + + '\n' + ); } } function verifyForcedBinary(binary) { if (typeof binary !== 'undefined' && binary.length > 0) { verifyBinary(binary); - if (!usablePythonWasFound){ + if (!usablePythonWasFound) { throw new Error( `NODE_GYP_FORCE_PYTHON is set to: "${binary}", but this is not a valid Python.\n` + 'Please set NODE_GYP_FORCE_PYTHON to something valid, or unset it entirely.\n' + - '(Python 2.7 or 3.5+ is required to build Atom.)\n' + '(Python 2.7 or 3.5+ is required to build Atom.)\n' ); } } @@ -137,8 +149,12 @@ function verifyPython() { verifyBinary('python3'); if (process.platform === 'win32') { verifyBinary('py.exe', '-2'); - verifyBinary(path.join(process.env.SystemDrive || 'C:', 'Python27', 'python.exe')); - verifyBinary(path.join(process.env.SystemDrive || 'C:', 'Python37', 'python.exe')); + verifyBinary( + path.join(process.env.SystemDrive || 'C:', 'Python27', 'python.exe') + ); + verifyBinary( + path.join(process.env.SystemDrive || 'C:', 'Python37', 'python.exe') + ); } if (usablePythonWasFound) { @@ -147,9 +163,9 @@ function verifyPython() { throw new Error( `\n${triedLog}\n` + 'Python 2.7 or 3.5+ is required to build Atom.\n' + - 'verify-machine-requirements.js was unable to find such a version of Python.\n' + - "Set the PYTHON env var to e.g. 'C:/path/to/Python27/python.exe'\n" + - 'if your Python is installed in a non-default location.\n' + 'verify-machine-requirements.js was unable to find such a version of Python.\n' + + "Set the PYTHON env var to e.g. 'C:/path/to/Python27/python.exe'\n" + + 'if your Python is installed in a non-default location.\n' ); } } From 893f84cb5a4ac217fe616e497f3a3d2536deeb6d Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Sat, 30 May 2020 21:50:03 -0400 Subject: [PATCH 08/29] script: Refactor log strings for readability in script/lib/verify-machine-requirements.js --- script/lib/verify-machine-requirements.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index 24b0ccf9fc2..26975ee7a5e 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -112,16 +112,12 @@ function verifyPython() { // Prepare to log which commands were tried, and the results, in case no usable Python can be found. if (prependFlag) { - binaryPlusFlag = binary.concat(' ' + prependFlag); + binaryPlusFlag = binary + ' ' + prependFlag; } else { binaryPlusFlag = binary; } triedLog = triedLog.concat( - 'log message: tried to check version of "' + - binaryPlusFlag + - '", got: ' + - fullVersion + - '\n' + `log message: tried to check version of "${binaryPlusFlag}", got: ${fullVersion}\n` ); } } From b1288ca7bb37a08952a35e37deaa2475c75d047c Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Wed, 3 Jun 2020 16:14:35 -0400 Subject: [PATCH 09/29] script: correct failure logging in verifyPython() Make sure a previously found version isn't erroneously logged, by clearing the "fullVersion" variable before each new check. --- script/lib/verify-machine-requirements.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index 26975ee7a5e..376a0cc85f4 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -68,6 +68,8 @@ function verifyPython() { function verifyBinary(binary, prependFlag) { if (binary && !usablePythonWasFound) { + fullVersion = ''; + let allFlags = [ '-c', 'import platform\nprint(platform.python_version())' @@ -117,7 +119,7 @@ function verifyPython() { binaryPlusFlag = binary; } triedLog = triedLog.concat( - `log message: tried to check version of "${binaryPlusFlag}", got: ${fullVersion}\n` + `log message: tried to check version of "${binaryPlusFlag}", got: "${fullVersion}"\n` ); } } From 8965d32bcbdd65128c013fe83ff9a533ac3c1393 Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Wed, 3 Jun 2020 17:03:40 -0400 Subject: [PATCH 10/29] script: Use "let" not "var" in verifyPython() --- script/lib/verify-machine-requirements.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index 376a0cc85f4..1829f6ca4e7 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -60,11 +60,11 @@ function verifyPython() { // so as to allow finding Python 3 as well, not just Python 2. // https://github.com/nodejs/node-gyp/pull/2124#issuecomment-633812957 - var stdout; - var fullVersion; - var usablePythonWasFound; - var triedLog = ''; - var binaryPlusFlag; + let stdout; + let fullVersion; + let usablePythonWasFound; + let triedLog = ''; + let binaryPlusFlag; function verifyBinary(binary, prependFlag) { if (binary && !usablePythonWasFound) { @@ -99,9 +99,9 @@ function verifyPython() { } if (fullVersion) { - var versionComponents = fullVersion.split('.'); - var majorVersion = Number(versionComponents[0]); - var minorVersion = Number(versionComponents[1]); + let versionComponents = fullVersion.split('.'); + let majorVersion = Number(versionComponents[0]); + let minorVersion = Number(versionComponents[1]); if ( (majorVersion === 2 && minorVersion === 7) || (majorVersion === 3 && minorVersion >= 5) From bb2cfa95553d312d1d094a862bffd290e22964b6 Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Wed, 3 Jun 2020 20:54:50 -0400 Subject: [PATCH 11/29] script: Update comments for node-gyp 7.0 release --- script/lib/verify-machine-requirements.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index 1829f6ca4e7..00c22ee668a 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -56,9 +56,9 @@ function verifyPython() { // TODO: If apm ships a newer version of node-gyp (v6.x or later), please update this script. // Particularly, node-gyp v6.x looks for python3 first, then python, then python2. // (In contrast: node-gyp v5.x looks for python first, then python2, then python3.) - // Also, node-gyp v7.x or later will probably drop the "-2" flag from "py.exe", + // Also, node-gyp v7.x stopped using the "-2" flag for "py.exe", // so as to allow finding Python 3 as well, not just Python 2. - // https://github.com/nodejs/node-gyp/pull/2124#issuecomment-633812957 + // https://github.com/nodejs/node-gyp/blob/master/CHANGELOG.md#v700-2020-06-03 let stdout; let fullVersion; @@ -78,8 +78,8 @@ function verifyPython() { // prependFlag is an optional argument, // used to prepend "-2" for the "py.exe" launcher. // TODO: Refactor by eliminating prependFlag - // once apm updates to node-gyp v7.x+, when it is anticipated - // that the "-2" flag will be dropped for invoking the py launcher. + // once apm updates to node-gyp v7.x or newer, in which + // the "-2" flag has been dropped for invoking the py launcher. allFlags.unshift(prependFlag); } From fa4201a0a8d57a9ed91402a6b737d0c9abac8d78 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 7 Jun 2020 06:19:58 +0000 Subject: [PATCH 12/29] unnecessary directory check --- src/package-manager.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/package-manager.js b/src/package-manager.js index eabfbdf7bd0..a330cf87b43 100644 --- a/src/package-manager.js +++ b/src/package-manager.js @@ -424,8 +424,7 @@ module.exports = class PackageManager { const packageName = path.basename(packagePath); if ( !packageName.startsWith('.') && - !packagesByName.has(packageName) && - fs.isDirectorySync(packagePath) + !packagesByName.has(packageName) ) { packages.push({ name: packageName, From 35f18fd99d11dd8bd48961745514ecf6ad10f490 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 8 Jun 2020 01:38:15 +0000 Subject: [PATCH 13/29] using withFileTypes to filter out non-folders no need to use path.basename --- src/package-manager.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/package-manager.js b/src/package-manager.js index a330cf87b43..243f57da7e2 100644 --- a/src/package-manager.js +++ b/src/package-manager.js @@ -419,13 +419,17 @@ module.exports = class PackageManager { for (const packageDirPath of this.packageDirPaths) { if (fs.isDirectorySync(packageDirPath)) { - for (let packagePath of fs.readdirSync(packageDirPath)) { - packagePath = path.join(packageDirPath, packagePath); - const packageName = path.basename(packagePath); + + const packagePaths = fs.readdirSync(packageDirPath, { withFileTypes: true }) + .filter(dirent => dirent.isDirectory()) + .map(dirent => dirent.name); + + for (const packageName of packagePaths) { if ( !packageName.startsWith('.') && !packagesByName.has(packageName) ) { + const packagePath = path.join(packageDirPath, packageName); packages.push({ name: packageName, path: packagePath, From 6b807f7b29264e6f39a577890cece0f4a5c788cd Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 8 Jun 2020 05:58:05 +0000 Subject: [PATCH 14/29] run prettier --- src/package-manager.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/package-manager.js b/src/package-manager.js index 243f57da7e2..6668d7262b8 100644 --- a/src/package-manager.js +++ b/src/package-manager.js @@ -419,10 +419,11 @@ module.exports = class PackageManager { for (const packageDirPath of this.packageDirPaths) { if (fs.isDirectorySync(packageDirPath)) { - - const packagePaths = fs.readdirSync(packageDirPath, { withFileTypes: true }) - .filter(dirent => dirent.isDirectory()) - .map(dirent => dirent.name); + + const packagePaths = fs + .readdirSync(packageDirPath, { withFileTypes: true }) + .filter((dirent) => dirent.isDirectory()) + .map((dirent) => dirent.name); for (const packageName of packagePaths) { if ( @@ -433,7 +434,7 @@ module.exports = class PackageManager { packages.push({ name: packageName, path: packagePath, - isBundled: false + isBundled: false, }); packagesByName.add(packageName); } From dc44ad2d1692b042c809d3fb4ac0718069866251 Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Wed, 17 Jun 2020 16:33:58 -0400 Subject: [PATCH 15/29] script: Update comment in verifyPython() --- script/lib/verify-machine-requirements.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index 00c22ee668a..6b6a2e96209 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -53,9 +53,10 @@ function verifyPython() { // https://github.com/nodejs/node-gyp/blob/v5.1.1/lib/find-python.js // This node-gyp is the version in use by current npm (in mid 2020). // - // TODO: If apm ships a newer version of node-gyp (v6.x or later), please update this script. - // Particularly, node-gyp v6.x looks for python3 first, then python, then python2. - // (In contrast: node-gyp v5.x looks for python first, then python2, then python3.) + // TODO: If this repo ships a newer version of node-gyp (v6.x or later), please update this script. + // (Currently, the build scripts and apm each depend on npm v6.14, which depends on node-gyp v5.) + // node-gyp v5.x looks for python first, then python2, then python3. + // node-gyp v6.x looks for python3 first, then python, then python2.) // Also, node-gyp v7.x stopped using the "-2" flag for "py.exe", // so as to allow finding Python 3 as well, not just Python 2. // https://github.com/nodejs/node-gyp/blob/master/CHANGELOG.md#v700-2020-06-03 From f8fecadcbb45d92a6d4fd56c7c9b2e7cbcc4ed9f Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Wed, 17 Jun 2020 16:43:38 -0400 Subject: [PATCH 16/29] script: Refactor variable use in verifyPython() --- script/lib/verify-machine-requirements.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index 6b6a2e96209..5181c403955 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -69,6 +69,8 @@ function verifyPython() { function verifyBinary(binary, prependFlag) { if (binary && !usablePythonWasFound) { + // clear re-used "result" variables now that we're checking another python binary. + stdout = ''; fullVersion = ''; let allFlags = [ @@ -108,8 +110,6 @@ function verifyPython() { (majorVersion === 3 && minorVersion >= 5) ) { usablePythonWasFound = true; - } else { - stdout = ''; } } From 6ef38f381037a11ccc4da0e0d0e1e31be6718a2f Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 21 Jun 2020 19:03:04 +0000 Subject: [PATCH 17/29] lint --- src/package-manager.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/package-manager.js b/src/package-manager.js index 6668d7262b8..d42acc9a0e6 100644 --- a/src/package-manager.js +++ b/src/package-manager.js @@ -419,11 +419,10 @@ module.exports = class PackageManager { for (const packageDirPath of this.packageDirPaths) { if (fs.isDirectorySync(packageDirPath)) { - const packagePaths = fs .readdirSync(packageDirPath, { withFileTypes: true }) - .filter((dirent) => dirent.isDirectory()) - .map((dirent) => dirent.name); + .filter(dirent => dirent.isDirectory()) + .map(dirent => dirent.name); for (const packageName of packagePaths) { if ( @@ -434,7 +433,7 @@ module.exports = class PackageManager { packages.push({ name: packageName, path: packagePath, - isBundled: false, + isBundled: false }); packagesByName.add(packageName); } From 2b652eeaffbab98b6daf5815327d4f872c4996a5 Mon Sep 17 00:00:00 2001 From: runner Date: Wed, 24 Jun 2020 00:45:44 +0000 Subject: [PATCH 18/29] :arrow_up: semver@7.3.2 --- package-lock.json | 18 +++++++++++++++--- package.json | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index f486b8833a3..16c6b6c5e73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5200,6 +5200,13 @@ "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } } }, "normalize-url": { @@ -5228,6 +5235,11 @@ "glob": "^7.1.3" } }, + "semver": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", + "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=" + }, "temp": { "version": "0.8.4", "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.4.tgz", @@ -6301,9 +6313,9 @@ } }, "semver": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", - "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=" + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" }, "serializable": { "version": "1.0.3", diff --git a/package.json b/package.json index 51edcb17eda..46a4809af1d 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "scoped-property-store": "^0.17.0", "scrollbar-style": "^3.2", "season": "^6.0.2", - "semver": "^4.3.3", + "semver": "7.3.2", "service-hub": "^0.7.4", "settings-view": "https://www.atom.io/api/packages/settings-view/versions/0.261.4/tarball", "sinon": "1.17.4", From 581b46cfdd77ae1cb652f4338f3911e53089c69d Mon Sep 17 00:00:00 2001 From: runner Date: Tue, 7 Jul 2020 03:11:10 +0000 Subject: [PATCH 19/29] :arrow_up: prebuild-install@5.3.5 --- package-lock.json | 70 ++++++++++++++++++++++++++++++++--------------- package.json | 2 +- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4ab8efdc438..d33fa61f535 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1881,6 +1881,15 @@ "node-releases": "^1.1.50" } }, + "buffer": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", + "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, "buffer-alloc": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", @@ -3844,6 +3853,11 @@ "resolved": "https://registry.npmjs.org/idb/-/idb-4.0.5.tgz", "integrity": "sha512-P+Fk9HT2h1DhXoE1YNK183SY+CRh2GHNh28de94sGwhe0bUA75JJeVJWt3SenE5p0BXK7maflIq29dl6UZHrFw==" }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, "image-size": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", @@ -4964,6 +4978,11 @@ } } }, + "mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, "mocha": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/mocha/-/mocha-2.5.1.tgz", @@ -5569,14 +5588,14 @@ } }, "prebuild-install": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.3.tgz", - "integrity": "sha512-GV+nsUXuPW2p8Zy7SarF/2W/oiK8bFQgJcncoJ0d7kRpekEA0ftChjfEaF9/Y+QJEc/wFR7RAEa8lYByuUIe2g==", + "version": "5.3.5", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.5.tgz", + "integrity": "sha512-YmMO7dph9CYKi5IR/BzjOJlRzpxGGVo1EsLSUZ0mt/Mq0HWZIHOKHHcHdT69yG54C9m6i45GpItwRHpk0Py7Uw==", "requires": { "detect-libc": "^1.0.3", "expand-template": "^2.0.3", "github-from-package": "0.0.0", - "minimist": "^1.2.0", + "minimist": "^1.2.3", "mkdirp": "^0.5.1", "napi-build-utils": "^1.0.1", "node-abi": "^2.7.0", @@ -5591,11 +5610,13 @@ }, "dependencies": { "bl": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.0.tgz", - "integrity": "sha512-EUAyP5UHU5hxF8BPT0LKW8gjYLhq1DQIcneOX/pL/m2Alo+OYDQAJlHq+yseMP50Os2nHXOSic6Ss3vSQeyf4A==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.2.tgz", + "integrity": "sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ==", "requires": { - "readable-stream": "^3.0.1" + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" } }, "decompress-response": { @@ -5607,9 +5628,14 @@ } }, "mimic-response": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.0.0.tgz", - "integrity": "sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", + "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==" + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "pump": { "version": "3.0.0", @@ -5621,9 +5647,9 @@ } }, "readable-stream": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz", - "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -5641,22 +5667,22 @@ } }, "tar-fs": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.0.tgz", - "integrity": "sha512-vaY0obB6Om/fso8a8vakQBzwholQ7v5+uy+tF3Ozvxv1KNezmVQAiWtcNmMHFSFPqL3dJA8ha6gdtFbfX9mcxA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.0.tgz", + "integrity": "sha512-9uW5iDvrIMCVpvasdFHW0wJPez0K4JnMZtsuIeDI7HyMGJNxmDZDOCQROr7lXyS+iL/QMpj07qcjGYTSdRFXUg==", "requires": { "chownr": "^1.1.1", - "mkdirp": "^0.5.1", + "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", "tar-stream": "^2.0.0" } }, "tar-stream": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.0.tgz", - "integrity": "sha512-+DAn4Nb4+gz6WZigRzKEZl1QuJVOLtAwwF+WUxy1fJ6X63CaGaUAxJRD2KEn1OMfcbCjySTYpNC6WmfQoIEOdw==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.2.tgz", + "integrity": "sha512-UaF6FoJ32WqALZGOIAApXx+OdxhekNMChu6axLJR85zMMjXKWFGjbIRe+J6P4UnRGg9rAwWvbTT0oI7hD/Un7Q==", "requires": { - "bl": "^3.0.0", + "bl": "^4.0.1", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", diff --git a/package.json b/package.json index 18840836c9b..8202fd55630 100644 --- a/package.json +++ b/package.json @@ -137,7 +137,7 @@ "pathwatcher": "8.1.0", "postcss": "5.2.4", "postcss-selector-parser": "2.2.1", - "prebuild-install": "^5.3.3", + "prebuild-install": "5.3.5", "property-accessors": "^1.1.3", "random-words": "0.0.1", "resolve": "^1.1.6", From d6cc11af897fc236bf0b43a13d71149650fa28f8 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Wed, 8 Jul 2020 08:55:02 -0500 Subject: [PATCH 20/29] Rename packagePaths to packageNames Co-authored-by: Sadick --- src/package-manager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/package-manager.js b/src/package-manager.js index d42acc9a0e6..14f1c93774c 100644 --- a/src/package-manager.js +++ b/src/package-manager.js @@ -419,12 +419,12 @@ module.exports = class PackageManager { for (const packageDirPath of this.packageDirPaths) { if (fs.isDirectorySync(packageDirPath)) { - const packagePaths = fs + const packageNames = fs .readdirSync(packageDirPath, { withFileTypes: true }) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name); - for (const packageName of packagePaths) { + for (const packageName of packageNames) { if ( !packageName.startsWith('.') && !packagesByName.has(packageName) From f79dd596cedab70d1365bfbee19301988e1c222d Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 9 Jul 2020 23:14:12 -0500 Subject: [PATCH 21/29] no PR triggers on release builds --- script/vsts/release-branch-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/script/vsts/release-branch-build.yml b/script/vsts/release-branch-build.yml index 58c132f7d9e..24635821de7 100644 --- a/script/vsts/release-branch-build.yml +++ b/script/vsts/release-branch-build.yml @@ -2,6 +2,7 @@ trigger: - master - 1.* # VSTS only supports wildcards at the end - electron-* +pr: none # no PR triggers jobs: - job: GetReleaseVersion From bb2cedbff3f860d689a58b0ea046e4e6c188c250 Mon Sep 17 00:00:00 2001 From: Hubot Date: Fri, 10 Jul 2020 10:25:56 -0500 Subject: [PATCH 22/29] 1.51.0-dev --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c4f6497de3d..faac01c2e96 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.50.0-dev", + "version": "1.51.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/main-process/main.js", "repository": { From fef2de59a48438fd0a24e52c9f2c51fa45ef3949 Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Fri, 10 Jul 2020 11:58:17 -0400 Subject: [PATCH 23/29] node-gyp 5.x still accepts Python 2.6 --- README.md | 2 +- script/lib/verify-machine-requirements.js | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b8b9ff9da6c..6d2ae4f8cce 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ This version enables you to install multiple Atom versions in parallel. It has b but should be compatible with other Linux distributions. 1. Install dependencies (on Ubuntu): `sudo apt install git gconf2 gconf-service libgtk2.0-0 libudev1 libgcrypt20 libnotify4 libxtst6 libnss3 python3 gvfs-bin xdg-utils libcap2` - 1. (If the `python3` package isn't available, or is too old (Python 3 should be >= 3.5), either `python2` or `python` will work in its place.) + 1. (If the `python3` package isn't available, or is too old (Python 3 should be >= 3.5), either `python2` or `python` (2.6 or 2.7) will work in its place.) 2. Download `atom-amd64.tar.gz` from the [Atom releases page](https://github.com/atom/atom/releases/latest). 3. Run `tar xf atom-amd64.tar.gz` in the directory where you want to extract the Atom folder. 4. Launch Atom using the installed `atom` command from the newly extracted directory. diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index 5181c403955..ccc4a68411c 100644 --- a/script/lib/verify-machine-requirements.js +++ b/script/lib/verify-machine-requirements.js @@ -55,9 +55,11 @@ function verifyPython() { // // TODO: If this repo ships a newer version of node-gyp (v6.x or later), please update this script. // (Currently, the build scripts and apm each depend on npm v6.14, which depends on node-gyp v5.) - // node-gyp v5.x looks for python first, then python2, then python3. - // node-gyp v6.x looks for python3 first, then python, then python2.) - // Also, node-gyp v7.x stopped using the "-2" flag for "py.exe", + // Differences between major versions of node-gyp: + // node-gyp 5.x looks for python, then python2, then python3. + // node-gyp 6.x looks for python3, then python, then python2.) + // node-gyp 5.x accepts Python ^2.6 || >= 3.5, node-gyp 6+ only accepts Python == 2.7 || >= 3.5. + // node-gyp 7.x stopped using the "-2" flag for "py.exe", // so as to allow finding Python 3 as well, not just Python 2. // https://github.com/nodejs/node-gyp/blob/master/CHANGELOG.md#v700-2020-06-03 @@ -80,9 +82,10 @@ function verifyPython() { if (prependFlag) { // prependFlag is an optional argument, // used to prepend "-2" for the "py.exe" launcher. - // TODO: Refactor by eliminating prependFlag - // once apm updates to node-gyp v7.x or newer, in which - // the "-2" flag has been dropped for invoking the py launcher. + // + // TODO: Refactor this script by eliminating "prependFlag" + // once we update to node-gyp v7.x or newer; + // the "-2" flag is not used in node-gyp v7.x. allFlags.unshift(prependFlag); } @@ -106,7 +109,7 @@ function verifyPython() { let majorVersion = Number(versionComponents[0]); let minorVersion = Number(versionComponents[1]); if ( - (majorVersion === 2 && minorVersion === 7) || + (majorVersion === 2 && minorVersion >= 6) || (majorVersion === 3 && minorVersion >= 5) ) { usablePythonWasFound = true; @@ -132,7 +135,7 @@ function verifyPython() { throw new Error( `NODE_GYP_FORCE_PYTHON is set to: "${binary}", but this is not a valid Python.\n` + 'Please set NODE_GYP_FORCE_PYTHON to something valid, or unset it entirely.\n' + - '(Python 2.7 or 3.5+ is required to build Atom.)\n' + '(Python 2.6, 2.7 or 3.5+ is required to build Atom.)\n' ); } } @@ -161,7 +164,7 @@ function verifyPython() { } else { throw new Error( `\n${triedLog}\n` + - 'Python 2.7 or 3.5+ is required to build Atom.\n' + + 'Python 2.6, 2.7 or 3.5+ is required to build Atom.\n' + 'verify-machine-requirements.js was unable to find such a version of Python.\n' + "Set the PYTHON env var to e.g. 'C:/path/to/Python27/python.exe'\n" + 'if your Python is installed in a non-default location.\n' From 217cee16a895eaf8ec8043a4343b6aa68f8c8214 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 3 Jul 2020 00:04:46 -0500 Subject: [PATCH 24/29] Using windows-latest for vmImage --- script/vsts/nightly-release.yml | 2 ++ script/vsts/pull-requests.yml | 2 ++ script/vsts/release-branch-build.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/script/vsts/nightly-release.yml b/script/vsts/nightly-release.yml index 9e26a05ae41..632238e9e0b 100644 --- a/script/vsts/nightly-release.yml +++ b/script/vsts/nightly-release.yml @@ -1,5 +1,7 @@ jobs: - job: GetReleaseVersion + pool: + vmImage: 'windows-latest' steps: # This has to be done separately because VSTS inexplicably # exits the script block after `npm install` completes. diff --git a/script/vsts/pull-requests.yml b/script/vsts/pull-requests.yml index a21f7d75a3c..c23df709573 100644 --- a/script/vsts/pull-requests.yml +++ b/script/vsts/pull-requests.yml @@ -2,6 +2,8 @@ trigger: none # No CI builds, only PR builds jobs: - job: GetReleaseVersion + pool: + vmImage: 'windows-latest' steps: # This has to be done separately because VSTS inexplicably # exits the script block after `npm install` completes. diff --git a/script/vsts/release-branch-build.yml b/script/vsts/release-branch-build.yml index 24635821de7..f53ffd2c111 100644 --- a/script/vsts/release-branch-build.yml +++ b/script/vsts/release-branch-build.yml @@ -6,6 +6,8 @@ pr: none # no PR triggers jobs: - job: GetReleaseVersion + pool: + vmImage: 'windows-latest' steps: # This has to be done separately because VSTS inexplicably # exits the script block after `npm install` completes. From fa7dddabb3c6c3e0e329c866cade0eb721e9ddad Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 5 Jul 2020 10:19:06 -0500 Subject: [PATCH 25/29] make code-signing conditional --- script/vsts/get-release-version.js | 4 ++++ script/vsts/platforms/macos.yml | 2 +- script/vsts/platforms/windows.yml | 10 +++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/script/vsts/get-release-version.js b/script/vsts/get-release-version.js index 159128eeddf..4e8999d7265 100644 --- a/script/vsts/get-release-version.js +++ b/script/vsts/get-release-version.js @@ -78,6 +78,7 @@ async function getReleaseVersion() { buildBranch.startsWith('electron-') || (buildBranch === 'master' && !process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)); + const SHOULD_SIGN = process.env.SHOULD_SIGN; console.log( `##vso[task.setvariable variable=AppName;isOutput=true]${getAppName( @@ -90,6 +91,9 @@ async function getReleaseVersion() { console.log( `##vso[task.setvariable variable=IsSignedZipBranch;isOutput=true]${isSignedZipBranch}` ); + console.log( + `##vso[task.setvariable variable=SHOULD_SIGN;isOutput=true]${SHOULD_SIGN}` + ); } getReleaseVersion(); diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index a63faa77029..fe03dce7d2a 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -47,7 +47,7 @@ jobs: displayName: Run linter - script: | - if [ $IS_RELEASE_BRANCH == "true" ] || [ $IS_SIGNED_ZIP_BRANCH == "true" ]; then + if [ $SHOULD_SIGN == "true" ] && ([ $IS_RELEASE_BRANCH == "true" ] || [ $IS_SIGNED_ZIP_BRANCH == "true" ]); then script/build --no-bootstrap --code-sign --compress-artifacts else script/build --no-bootstrap --compress-artifacts diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index d1035135de8..b0ec07cc447 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -101,11 +101,19 @@ jobs: SET SQUIRREL_TEMP=C:\tmp IF [%IS_RELEASE_BRANCH%]==[true] ( ECHO Creating production artifacts for release branch %BUILD_SOURCEBRANCHNAME% - node script\vsts\windows-run.js script\build.cmd --no-bootstrap --code-sign --compress-artifacts --create-windows-installer + IF [%SHOULD_SIGN%]==[true] ( + node script\vsts\windows-run.js script\build.cmd --no-bootstrap --code-sign --compress-artifacts --create-windows-installer + ) ELSE ( + node script\vsts\windows-run.js script\build.cmd --no-bootstrap --compress-artifacts --create-windows-installer + ) ) ELSE ( IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( ECHO Creating signed CI artifacts for branch %BUILD_SOURCEBRANCHNAME% + IF [%SHOULD_SIGN%]==[true] ( node script\vsts\windows-run.js script\build.cmd --no-bootstrap --code-sign --compress-artifacts + ) ELSE ( + node script\vsts\windows-run.js script\build.cmd --no-bootstrap --compress-artifacts + ) ) ELSE ( ECHO Pull request build, no code signing will be performed node script\vsts\windows-run.js script\build.cmd --no-bootstrap --compress-artifacts From d0f0f60606f64ba48f8f66e7760f5fdceda8e07b Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 4 Jul 2020 01:36:39 -0500 Subject: [PATCH 26/29] add pull bot configuration --- .github/pull.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/pull.yml diff --git a/.github/pull.yml b/.github/pull.yml new file mode 100644 index 00000000000..23bd9a6a55b --- /dev/null +++ b/.github/pull.yml @@ -0,0 +1,7 @@ +version: "1" +rules: # Array of rules + - base: upstream_master # Required. Target branch + upstream: atom:master # Required. Must be in the same fork network. + mergeMethod: hardreset # Optional, one of [none, merge, squash, rebase, hardreset], Default: none. + mergeUnstable: false # Optional, merge pull request even when the mergeable_state is not clean. Default: false +label: ":arrow_heading_down: pull upstream" # Optional From fc4dc84e4ff717e7cda5fea86bc04726a8b2c520 Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Mon, 6 Jul 2020 21:46:22 -0400 Subject: [PATCH 27/29] CI: Use Cache@2 task in place of Lighthouse --- script/vsts/platforms/linux.yml | 33 ++++++++++------- script/vsts/platforms/macos.yml | 60 ++++++++++++++++++++----------- script/vsts/platforms/windows.yml | 47 ++++++++++-------------- 3 files changed, 78 insertions(+), 62 deletions(-) diff --git a/script/vsts/platforms/linux.yml b/script/vsts/platforms/linux.yml index 7342e3eee97..c2913a97253 100644 --- a/script/vsts/platforms/linux.yml +++ b/script/vsts/platforms/linux.yml @@ -30,12 +30,26 @@ jobs: - script: npm install --global npm@6.12.1 displayName: Update npm - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore node_modules cache + - task: Cache@2 + displayName: Cache node_modules inputs: - keyfile: 'package.json, script/vsts/platforms/linux.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + key: 'npm | "$(Agent.OS)" | package.json, package-lock.json, script/vsts/platforms/linux.yml' + path: 'node_modules' + cacheHitVar: MainNodeModulesRestored + + - task: Cache@2 + displayName: Cache script/node_modules + inputs: + key: 'npm | "$(Agent.OS)" | script/package.json, script/package-lock.json, script/vsts/platforms/linux.yml' + path: 'script/node_modules' + cacheHitVar: ScriptNodeModulesRestored + + - task: Cache@2 + displayName: Cache apm/node_modules + inputs: + key: 'npm | "$(Agent.OS)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/linux.yml' + path: 'apm/node_modules' + cacheHitVar: ApmNodeModulesRestored - script: script/bootstrap displayName: Bootstrap build environment @@ -45,14 +59,7 @@ jobs: CC: clang-5.0 CXX: clang++-5.0 npm_config_clang: 1 - condition: ne(variables['CacheRestored'], 'true') - - - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 - displayName: Save node_modules cache - inputs: - keyfile: 'package.json, script/vsts/platforms/linux.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true')) - script: script/lint displayName: Run linter diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index fe03dce7d2a..cb2115547ac 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -20,12 +20,26 @@ jobs: - script: npm install --global npm@6.12.1 displayName: Update npm - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore node_modules cache + - task: Cache@2 + displayName: Cache node_modules inputs: - keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + key: 'npm | "$(Agent.OS)" | package.json, package-lock.json, script/vsts/platforms/macos.yml' + path: 'node_modules' + cacheHitVar: MainNodeModulesRestored + + - task: Cache@2 + displayName: Cache script/node_modules + inputs: + key: 'npm | "$(Agent.OS)" | script/package.json, script/package-lock.json, script/vsts/platforms/macos.yml' + path: 'script/node_modules' + cacheHitVar: ScriptNodeModulesRestored + + - task: Cache@2 + displayName: Cache apm/node_modules + inputs: + key: 'npm | "$(Agent.OS)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/macos.yml' + path: 'apm/node_modules' + cacheHitVar: ApmNodeModulesRestored - script: script/bootstrap displayName: Bootstrap build environment @@ -34,14 +48,7 @@ jobs: CI_PROVIDER: VSTS NPM_BIN_PATH: /usr/local/bin/npm npm_config_build_from_source: true - condition: ne(variables['CacheRestored'], 'true') - - - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 - displayName: Save node_modules cache - inputs: - keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true')) - script: script/lint displayName: Run linter @@ -121,12 +128,26 @@ jobs: - script: npm install --global npm@6.12.1 displayName: Update npm - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore node_modules cache + - task: Cache@2 + displayName: Cache node_modules inputs: - keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + key: 'npm | "$(Agent.OS)" | package.json, package-lock.json, script/vsts/platforms/macos.yml' + path: 'node_modules' + cacheHitVar: MainNodeModulesRestored + + - task: Cache@2 + displayName: Cache script/node_modules + inputs: + key: 'npm | "$(Agent.OS)" | script/package.json, script/package-lock.json, script/vsts/platforms/macos.yml' + path: 'script/node_modules' + cacheHitVar: ScriptNodeModulesRestored + + - task: Cache@2 + displayName: Cache apm/node_modules + inputs: + key: 'npm | "$(Agent.OS)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/macos.yml' + path: 'apm/node_modules' + cacheHitVar: ApmNodeModulesRestored # The artifact caching task does not work on forks, so we need to # bootstrap again for pull requests coming from forked repositories. @@ -137,8 +158,7 @@ jobs: CI_PROVIDER: VSTS NPM_BIN_PATH: /usr/local/bin/npm npm_config_build_from_source: true - - condition: ne(variables['CacheRestored'], 'true') + condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true')) - task: DownloadBuildArtifacts@0 displayName: Download atom-mac.zip diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index b0ec07cc447..74e551e9a40 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -48,21 +48,26 @@ jobs: npm install displayName: Install Windows build dependencies - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore node_modules cache (x64) + - task: Cache@2 + displayName: Cache node_modules inputs: - keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - condition: eq(variables['buildArch'], 'x64') + key: 'npm | "$(Agent.OS)" | "$(buildArch)" | package.json, package-lock.json, script/vsts/platforms/windows.yml' + path: 'node_modules' + cacheHitVar: MainNodeModulesRestored - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore node_modules cache (x86) + - task: Cache@2 + displayName: Cache script/node_modules inputs: - keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - condition: eq(variables['buildArch'], 'x86') + key: 'npm | "$(Agent.OS)" | "$(buildArch)" | script/package.json, script/package-lock.json, script/vsts/platforms/windows.yml' + path: 'script/node_modules' + cacheHitVar: ScriptNodeModulesRestored + + - task: Cache@2 + displayName: Cache apm/node_modules + inputs: + key: 'npm | "$(Agent.OS)" | "$(buildArch)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/windows.yml' + path: 'apm/node_modules' + cacheHitVar: ApmNodeModulesRestored - script: | node script\vsts\windows-run.js script\bootstrap.cmd @@ -73,23 +78,7 @@ jobs: NPM_BIN_PATH: "C:\\hostedtoolcache\\windows\\node\\12.13.1\\x64\\npm.cmd" npm_config_build_from_source: true displayName: Bootstrap build environment - condition: ne(variables['CacheRestored'], 'true') - - - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 - displayName: Save node_modules cache (x64) - inputs: - keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - condition: eq(variables['buildArch'], 'x64') - - - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 - displayName: Save node_modules cache (x86) - inputs: - keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - condition: eq(variables['buildArch'], 'x86') + condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true')) - script: node script\vsts\windows-run.js script\lint.cmd env: From bcc9e1d11bbd497af211629dc9526b92ddd23ed6 Mon Sep 17 00:00:00 2001 From: aminya Date: Fri, 10 Jul 2020 19:43:16 -0500 Subject: [PATCH 28/29] cache template --- script/vsts/platforms/cache.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 script/vsts/platforms/cache.yml diff --git a/script/vsts/platforms/cache.yml b/script/vsts/platforms/cache.yml new file mode 100644 index 00000000000..992e35bdca0 --- /dev/null +++ b/script/vsts/platforms/cache.yml @@ -0,0 +1,30 @@ +parameters: + - name: OS + displayName: Operating System + type: string + values: + - windows + - linux + - macos + +steps: + - task: Cache@2 + displayName: Cache node_modules + inputs: + key: 'npm | "$(Agent.OS)" | "$(buildArch)" | package.json, package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml' + path: 'node_modules' + cacheHitVar: MainNodeModulesRestored + + - task: Cache@2 + displayName: Cache script/node_modules + inputs: + key: 'npm | "$(Agent.OS)" | "$(buildArch)" | script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml' + path: 'script/node_modules' + cacheHitVar: ScriptNodeModulesRestored + + - task: Cache@2 + displayName: Cache apm/node_modules + inputs: + key: 'npm | "$(Agent.OS)" | "$(buildArch)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml' + path: 'apm/node_modules' + cacheHitVar: ApmNodeModulesRestored From 22858b9723f6a2a331f381f54cbaab64b265f45b Mon Sep 17 00:00:00 2001 From: aminya Date: Fri, 10 Jul 2020 22:08:37 -0500 Subject: [PATCH 29/29] using cache template in the workflows --- script/vsts/platforms/linux.yml | 23 ++-------------- script/vsts/platforms/macos.yml | 46 ++++--------------------------- script/vsts/platforms/windows.yml | 23 ++-------------- 3 files changed, 12 insertions(+), 80 deletions(-) diff --git a/script/vsts/platforms/linux.yml b/script/vsts/platforms/linux.yml index c2913a97253..56ea7468e3e 100644 --- a/script/vsts/platforms/linux.yml +++ b/script/vsts/platforms/linux.yml @@ -30,26 +30,9 @@ jobs: - script: npm install --global npm@6.12.1 displayName: Update npm - - task: Cache@2 - displayName: Cache node_modules - inputs: - key: 'npm | "$(Agent.OS)" | package.json, package-lock.json, script/vsts/platforms/linux.yml' - path: 'node_modules' - cacheHitVar: MainNodeModulesRestored - - - task: Cache@2 - displayName: Cache script/node_modules - inputs: - key: 'npm | "$(Agent.OS)" | script/package.json, script/package-lock.json, script/vsts/platforms/linux.yml' - path: 'script/node_modules' - cacheHitVar: ScriptNodeModulesRestored - - - task: Cache@2 - displayName: Cache apm/node_modules - inputs: - key: 'npm | "$(Agent.OS)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/linux.yml' - path: 'apm/node_modules' - cacheHitVar: ApmNodeModulesRestored + - template: cache.yml + parameters: + OS: linux - script: script/bootstrap displayName: Bootstrap build environment diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index cb2115547ac..a4fe1619d6e 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -20,26 +20,9 @@ jobs: - script: npm install --global npm@6.12.1 displayName: Update npm - - task: Cache@2 - displayName: Cache node_modules - inputs: - key: 'npm | "$(Agent.OS)" | package.json, package-lock.json, script/vsts/platforms/macos.yml' - path: 'node_modules' - cacheHitVar: MainNodeModulesRestored - - - task: Cache@2 - displayName: Cache script/node_modules - inputs: - key: 'npm | "$(Agent.OS)" | script/package.json, script/package-lock.json, script/vsts/platforms/macos.yml' - path: 'script/node_modules' - cacheHitVar: ScriptNodeModulesRestored - - - task: Cache@2 - displayName: Cache apm/node_modules - inputs: - key: 'npm | "$(Agent.OS)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/macos.yml' - path: 'apm/node_modules' - cacheHitVar: ApmNodeModulesRestored + - template: cache.yml + parameters: + OS: macos - script: script/bootstrap displayName: Bootstrap build environment @@ -128,26 +111,9 @@ jobs: - script: npm install --global npm@6.12.1 displayName: Update npm - - task: Cache@2 - displayName: Cache node_modules - inputs: - key: 'npm | "$(Agent.OS)" | package.json, package-lock.json, script/vsts/platforms/macos.yml' - path: 'node_modules' - cacheHitVar: MainNodeModulesRestored - - - task: Cache@2 - displayName: Cache script/node_modules - inputs: - key: 'npm | "$(Agent.OS)" | script/package.json, script/package-lock.json, script/vsts/platforms/macos.yml' - path: 'script/node_modules' - cacheHitVar: ScriptNodeModulesRestored - - - task: Cache@2 - displayName: Cache apm/node_modules - inputs: - key: 'npm | "$(Agent.OS)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/macos.yml' - path: 'apm/node_modules' - cacheHitVar: ApmNodeModulesRestored + - template: cache.yml + parameters: + OS: macos # The artifact caching task does not work on forks, so we need to # bootstrap again for pull requests coming from forked repositories. diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 74e551e9a40..f24e7c9c1ec 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -48,26 +48,9 @@ jobs: npm install displayName: Install Windows build dependencies - - task: Cache@2 - displayName: Cache node_modules - inputs: - key: 'npm | "$(Agent.OS)" | "$(buildArch)" | package.json, package-lock.json, script/vsts/platforms/windows.yml' - path: 'node_modules' - cacheHitVar: MainNodeModulesRestored - - - task: Cache@2 - displayName: Cache script/node_modules - inputs: - key: 'npm | "$(Agent.OS)" | "$(buildArch)" | script/package.json, script/package-lock.json, script/vsts/platforms/windows.yml' - path: 'script/node_modules' - cacheHitVar: ScriptNodeModulesRestored - - - task: Cache@2 - displayName: Cache apm/node_modules - inputs: - key: 'npm | "$(Agent.OS)" | "$(buildArch)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/windows.yml' - path: 'apm/node_modules' - cacheHitVar: ApmNodeModulesRestored + - template: cache.yml + parameters: + OS: windows - script: | node script\vsts\windows-run.js script\bootstrap.cmd