mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
perf(compiler-cli): reduce analysis work during incremental rebuilds (#44731)
This commit reduces the analysis work that needs to happen during an incremental rebuild by properly recording files for which no traits were found in the set of files that have no traits, such that the same file doesn't have to be reanalyzed during subsequent rebuilds. It also excludes shim files from analysis. PR Close #44731
This commit is contained in:
parent
4307b82058
commit
5efebf87be
2 changed files with 10 additions and 1 deletions
|
|
@ -17,6 +17,7 @@ ts_library(
|
|||
"//packages/compiler-cli/src/ngtsc/indexer",
|
||||
"//packages/compiler-cli/src/ngtsc/perf",
|
||||
"//packages/compiler-cli/src/ngtsc/reflection",
|
||||
"//packages/compiler-cli/src/ngtsc/shims",
|
||||
"//packages/compiler-cli/src/ngtsc/translator",
|
||||
"//packages/compiler-cli/src/ngtsc/typecheck/api",
|
||||
"//packages/compiler-cli/src/ngtsc/typecheck/extended/api",
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import {SemanticDepGraphUpdater, SemanticSymbol} from '../../incremental/semanti
|
|||
import {IndexingContext} from '../../indexer';
|
||||
import {PerfEvent, PerfRecorder} from '../../perf';
|
||||
import {ClassDeclaration, DeclarationNode, Decorator, isNamedClassDeclaration, ReflectionHost} from '../../reflection';
|
||||
import {isShim} from '../../shims';
|
||||
import {ProgramTypeCheckAdapter, TypeCheckContext} from '../../typecheck/api';
|
||||
import {ExtendedTemplateChecker} from '../../typecheck/extended/api';
|
||||
import {getSourceFile, isExported} from '../../util/src/typescript';
|
||||
|
|
@ -118,7 +119,7 @@ export class TraitCompiler implements ProgramTypeCheckAdapter {
|
|||
private analyze(sf: ts.SourceFile, preanalyze: true): Promise<void>|undefined;
|
||||
private analyze(sf: ts.SourceFile, preanalyze: boolean): Promise<void>|undefined {
|
||||
// We shouldn't analyze declaration files.
|
||||
if (sf.isDeclarationFile) {
|
||||
if (sf.isDeclarationFile || isShim(sf)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
@ -153,6 +154,13 @@ export class TraitCompiler implements ProgramTypeCheckAdapter {
|
|||
|
||||
visit(sf);
|
||||
|
||||
if (!this.fileToClasses.has(sf)) {
|
||||
// If no traits were detected in the source file we record the source file itself to not have
|
||||
// any traits, such that analysis of the source file can be skipped during incremental
|
||||
// rebuilds.
|
||||
this.filesWithoutTraits.add(sf);
|
||||
}
|
||||
|
||||
if (preanalyze && promises.length > 0) {
|
||||
return Promise.all(promises).then(() => undefined as void);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue