Consistently respect --no-typecheck flag in build (#51575)

This commit is contained in:
Jake Bailey 2022-11-17 12:44:39 -08:00 committed by GitHub
parent 7b85cd6b72
commit 8eed2ca2dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 18 deletions

4
.vscode/tasks.json vendored
View File

@ -14,7 +14,7 @@
// https://github.com/microsoft/vscode/issues/93001
"label": "gulp: tests",
"type": "npm",
"script": "build:tests",
"script": "build:tests -- --no-typecheck",
"group": "build",
"hide": true,
"problemMatcher": [
@ -44,7 +44,7 @@
{
"label": "npm: build:tests",
"type": "npm",
"script": "build:tests",
"script": "build:tests -- --no-typecheck",
"group": "build",
"problemMatcher": [
"$tsc"

View File

@ -328,10 +328,21 @@ function entrypointBuildTask(options) {
},
});
const mainDeps = options.mainDeps?.slice(0) ?? [];
if (cmdLineOptions.bundle) {
mainDeps.push(bundle);
if (cmdLineOptions.typecheck) {
mainDeps.push(build);
}
}
else {
mainDeps.push(build, shim);
}
const main = task({
name: options.name,
description: options.description,
dependencies: (options.mainDeps ?? []).concat(cmdLineOptions.bundle ? [bundle] : [build, shim]),
dependencies: mainDeps,
});
const watch = task({
@ -358,7 +369,7 @@ function entrypointBuildTask(options) {
}
const { main: tsc, build: buildTsc, watch: watchTsc } = entrypointBuildTask({
const { main: tsc, watch: watchTsc } = entrypointBuildTask({
name: "tsc",
description: "Builds the command-line compiler",
buildDeps: [generateDiagnostics],
@ -396,7 +407,7 @@ export const dtsServices = task({
});
const { main: tsserver, build: buildTsserver, watch: watchTsserver } = entrypointBuildTask({
const { main: tsserver, watch: watchTsserver } = entrypointBuildTask({
name: "tsserver",
description: "Builds the language server",
buildDeps: [generateDiagnostics],
@ -414,15 +425,10 @@ const { main: tsserver, build: buildTsserver, watch: watchTsserver } = entrypoin
export { tsserver, watchTsserver };
const buildMin = task({
name: "build-min",
dependencies: [buildTsc, buildTsserver],
});
export const min = task({
name: "min",
description: "Builds only tsc and tsserver",
dependencies: [tsc, tsserver].concat(cmdLineOptions.typecheck ? [buildMin] : []),
dependencies: [tsc, tsserver],
});
export const watchMin = task({
@ -591,15 +597,10 @@ export const watchOtherOutputs = task({
dependencies: [watchCancellationToken, watchTypingsInstaller, watchWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
});
const buildLocal = task({
name: "build-local",
dependencies: [buildTsc, buildTsserver, buildServices, buildLssl]
});
export const local = task({
name: "local",
description: "Builds the full compiler and services",
dependencies: [localize, tsc, tsserver, services, lssl, otherOutputs, dts].concat(cmdLineOptions.typecheck ? [buildLocal] : []),
dependencies: [localize, tsc, tsserver, services, lssl, otherOutputs, dts],
});
export default local;
@ -610,7 +611,7 @@ export const watchLocal = task({
dependencies: [localize, watchTsc, watchTsserver, watchServices, watchLssl, watchOtherOutputs, dts, watchSrc],
});
const runtestsDeps = [tests, generateLibs].concat(cmdLineOptions.typecheck ? [dts, buildSrc] : []);
const runtestsDeps = [tests, generateLibs].concat(cmdLineOptions.typecheck ? [dts] : []);
export const runTests = task({
name: "runtests",

View File

@ -51,6 +51,10 @@ if (options.built) {
options.lkg = false;
}
if (!options.bundle && !options.typecheck) {
throw new Error("--no-typecheck cannot be passed when bundling is disabled");
}
export default options;