parallelize clean

This commit is contained in:
Amin Yahyaabadi 2020-10-01 22:02:00 -05:00
parent 619ec1059f
commit 609f2236ec
6 changed files with 30 additions and 18 deletions

View File

@ -26,13 +26,12 @@ if (!ci && process.env.CI === 'true' && process.argv.indexOf('--no-ci') === -1)
verifyMachineRequirements(ci)
if (dependenciesFingerprint.isOutdated()) {
cleanDependencies()
}
if (process.platform === 'win32') deleteMsbuildFromPath()
async function bootstrap() {
if (dependenciesFingerprint.isOutdated()) {
await cleanDependencies()
}
if (process.platform === 'win32') deleteMsbuildFromPath()
installScriptRunnerDependencies()

View File

@ -160,7 +160,7 @@ async function build() {
if (!argv.existingBinaries) {
checkChromedriverVersion()
cleanOutputDirectory()
await cleanOutputDirectory()
await copyAssets()
await transpile()
generateModuleCache()

View File

@ -7,7 +7,13 @@ const cleanDependencies = require('./lib/clean-dependencies')
const cleanOutputDirectory = require('./lib/clean-output-directory')
const killRunningAtomInstances = require('./lib/kill-running-atom-instances')
killRunningAtomInstances()
cleanDependencies()
cleanCaches()
cleanOutputDirectory()
async function clean() {
killRunningAtomInstances()
return Promise.all([
cleanDependencies(),
cleanCaches(),
cleanOutputDirectory()
])
}
clean().then(() => {process.exit(0)}).catch((e) => {throw e;})

View File

@ -20,9 +20,11 @@ module.exports = function() {
path.join(os.tmpdir(), 'atom-build'),
path.join(os.tmpdir(), 'atom-cached-atom-shells')
];
const rmPromises = [];
for (let path of cachePaths) {
console.log(`Cleaning ${path}`);
fs.removeSync(path);
rmPromises.push(fs.remove(path));
}
return Promise.all(rmPromises);
};

View File

@ -10,23 +10,25 @@ module.exports = function() {
const fs = require('fs-extra');
const glob = require('glob');
const rmPromises = [];
const apmDependenciesPath = path.join(CONFIG.apmRootPath, 'node_modules');
console.log(`Cleaning ${apmDependenciesPath}`);
fs.removeSync(apmDependenciesPath);
rmPromises.push(fs.remove(apmDependenciesPath));
const atomDependenciesPath = path.join(
CONFIG.repositoryRootPath,
'node_modules'
);
console.log(`Cleaning ${atomDependenciesPath}`);
fs.removeSync(atomDependenciesPath);
rmPromises.push(fs.remove(atomDependenciesPath));
const scriptDependenciesPath = path.join(
CONFIG.scriptRootPath,
'node_modules'
);
console.log(`Cleaning ${scriptDependenciesPath}`);
fs.removeSync(scriptDependenciesPath);
rmPromises.push(fs.remove(scriptDependenciesPath));
const bundledPackageDependenciesPaths = path.join(
CONFIG.repositoryRootPath,
@ -37,6 +39,8 @@ module.exports = function() {
for (const bundledPackageDependencyPath of glob.sync(
bundledPackageDependenciesPaths
)) {
fs.removeSync(bundledPackageDependencyPath);
rmPromises.push(fs.remove(bundledPackageDependencyPath));
}
return Promise.all(rmPromises);
};

View File

@ -4,6 +4,7 @@ const CONFIG = require('../config');
module.exports = function() {
if (fs.existsSync(CONFIG.buildOutputPath)) {
console.log(`Cleaning ${CONFIG.buildOutputPath}`);
fs.removeSync(CONFIG.buildOutputPath);
return fs.remove(CONFIG.buildOutputPath);
}
return Promise.resolve();
};