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 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 diff --git a/README.md b/README.md index 23a37611bae..6d2ae4f8cce 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` (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/package-lock.json b/package-lock.json index 1065ce967dc..cd441a6a253 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", @@ -5200,6 +5219,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 +5254,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", @@ -5569,14 +5600,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 +5622,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 +5640,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 +5659,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 +5679,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", @@ -6301,9 +6339,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 e437e5e30dd..334e7d6725a 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": { @@ -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.17.0", @@ -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", 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 33c0e38e42e..c354bf67c0f 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); @@ -192,20 +186,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}"` ); diff --git a/script/lib/verify-machine-requirements.js b/script/lib/verify-machine-requirements.js index 51ca5a6cd13..ccc4a68411c 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'); @@ -9,9 +8,7 @@ const CONFIG = require('../config'); module.exports = function(ci) { verifyNode(); verifyNpm(ci); - if (process.platform === 'win32') { - verifyPython(); - } + verifyPython(); }; function verifyNode() { @@ -50,36 +47,127 @@ 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 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.) + // 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 + + let stdout; + let fullVersion; + let usablePythonWasFound; + let triedLog = ''; + let binaryPlusFlag; + + function verifyBinary(binary, prependFlag) { + if (binary && !usablePythonWasFound) { + // clear re-used "result" variables now that we're checking another python binary. + stdout = ''; + fullVersion = ''; + + 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 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); + } + + 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) { + let versionComponents = fullVersion.split('.'); + let majorVersion = Number(versionComponents[0]); + let minorVersion = Number(versionComponents[1]); + if ( + (majorVersion === 2 && minorVersion >= 6) || + (majorVersion === 3 && minorVersion >= 5) + ) { + usablePythonWasFound = true; + } + } + + // Prepare to log which commands were tried, and the results, in case no usable Python can be found. + if (prependFlag) { + binaryPlusFlag = binary + ' ' + prependFlag; + } else { + binaryPlusFlag = binary; + } + triedLog = triedLog.concat( + `log message: tried to check version of "${binaryPlusFlag}", got: "${fullVersion}"\n` + ); } } - 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.6, 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.` + `\n${triedLog}\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' ); } } 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/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/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 diff --git a/script/vsts/platforms/linux.yml b/script/vsts/platforms/linux.yml index 7342e3eee97..56ea7468e3e 100644 --- a/script/vsts/platforms/linux.yml +++ b/script/vsts/platforms/linux.yml @@ -30,12 +30,9 @@ jobs: - script: npm install --global npm@6.12.1 displayName: Update npm - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore 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' + - template: cache.yml + parameters: + OS: linux - script: script/bootstrap displayName: Bootstrap build environment @@ -45,14 +42,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 a63faa77029..a4fe1619d6e 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -20,12 +20,9 @@ jobs: - script: npm install --global npm@6.12.1 displayName: Update npm - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore 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' + - template: cache.yml + parameters: + OS: macos - script: script/bootstrap displayName: Bootstrap build environment @@ -34,20 +31,13 @@ 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 - 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 @@ -121,12 +111,9 @@ jobs: - script: npm install --global npm@6.12.1 displayName: Update npm - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore 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' + - 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. @@ -137,8 +124,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 23782335a34..f24e7c9c1ec 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: @@ -48,21 +48,9 @@ jobs: npm install displayName: Install Windows build dependencies - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore 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.RestoreCacheV1.RestoreCache@1 - displayName: Restore 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') + - template: cache.yml + parameters: + OS: windows - script: | node script\vsts\windows-run.js script\bootstrap.cmd @@ -73,23 +61,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: @@ -101,11 +73,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 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 58c132f7d9e..f53ffd2c111 100644 --- a/script/vsts/release-branch-build.yml +++ b/script/vsts/release-branch-build.yml @@ -2,9 +2,12 @@ trigger: - master - 1.* # VSTS only supports wildcards at the end - electron-* +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. diff --git a/src/package-manager.js b/src/package-manager.js index eabfbdf7bd0..14f1c93774c 100644 --- a/src/package-manager.js +++ b/src/package-manager.js @@ -419,14 +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 packageNames = fs + .readdirSync(packageDirPath, { withFileTypes: true }) + .filter(dirent => dirent.isDirectory()) + .map(dirent => dirent.name); + + for (const packageName of packageNames) { if ( !packageName.startsWith('.') && - !packagesByName.has(packageName) && - fs.isDirectorySync(packagePath) + !packagesByName.has(packageName) ) { + const packagePath = path.join(packageDirPath, packageName); packages.push({ name: packageName, path: packagePath,