chore(build): Remove buildDeps task

This commit is contained in:
Christopher Allen
2023-09-08 22:38:15 +01:00
parent fc18cbdad8
commit 39baf01c03
3 changed files with 0 additions and 157 deletions

View File

@@ -44,11 +44,6 @@ const PYTHON = process.platform === 'win32' ? 'python' : 'python3';
*/
const COMPILED_SUFFIX = '_compressed';
/**
* Dependencies file (used by buildCompiled for chunking.
*/
const DEPS_FILE = path.join(BUILD_DIR, 'deps.js');
/**
* Name of an object to be used as a shared "global" namespace by
* chunks generated by the Closure Compiler with the
@@ -315,82 +310,6 @@ function buildJavaScript(done) {
done();
}
/**
* This task updates DEPS_FILE (deps.js), used by
* closure-calculate-chunks when determining how to organise .js
* source files into chunks.
*
* Prerequisite: buildJavaScript.
*/
function buildDeps() {
const roots = [
TSC_OUTPUT_DIR,
];
/** Maximum buffer size, in bytes for child process stdout/stderr. */
const MAX_BUFFER_SIZE = 10 * 1024 * 1024;
/**
* Filter a string to extract lines containing (or not containing) the
* specified target string.
*
* @param {string} text Text to filter.
* @param {string} target String to search for.
* @param {boolean?} exclude If true, extract only non-matching lines.
* @returns {string} Filtered text.
*/
function filter(text, target, exclude) {
return text.split('\n')
.filter((line) => Boolean(line.match(target)) !== Boolean(exclude))
.join('\n');
}
/**
* Log unexpected diagnostics, after removing expected warnings.
*
* @param {string} text Standard error output from closure-make-deps
*/
function log(text) {
for (const line of text.split('\n')) {
if (line &&
!/^WARNING .*: Bounded generic semantics are currently/.test(line) &&
!/^WARNING .*: Missing type declaration/.test(line) &&
!/^WARNING .*: illegal use of unknown JSDoc tag/.test(line)) {
console.error(line);
}
}
}
return new Promise((resolve, reject) => {
const args = '--closure-path ./build/src ' +
roots.map(root => `--root '${root}' `).join('');
exec(
`closure-make-deps ${args}`, {maxBuffer: MAX_BUFFER_SIZE},
(error, stdout, stderr) => {
if (error) {
// Remove warnings from stack trace to show only errors.
error.stack = filter(error.stack, /^WARNING/, true);
// Due to some race condition, the stderr parameter is
// often badly truncated if an error is non-null, so the
// error message might not actually be shown to the user.
// Print a helpful message to the user to help them find
// out what the problem is.
error.stack += `
If you do not see an helpful diagnostic from closure-make-deps in the
error message above, try running:
npx closure-make-deps ${args} 2>&1 |grep -v WARNING`;
reject(error);
} else {
log(stderr);
fs.writeFileSync(DEPS_FILE, stdout);
resolve();
}
});
});
}
/**
* This task regenerates msg/json/en.js and msg/json/qqq.js from
* msg/messages.js.