perf(compiler): skip type check and emit in bazel in some cases. (#19646)

If no user files changed:
- only type check the changed generated files

Never emit non changed generated files
- we still calculate them, but don’t send them through
  TypeScript to emit them but cache the written files instead.
PR Close #19646
This commit is contained in:
Tobias Bosch
2017-10-10 13:45:42 -07:00
committed by Chuck Jazdzewski
parent 3acf9c7063
commit a22121d65d
21 changed files with 596 additions and 297 deletions

View File

@ -14,7 +14,7 @@ export class GeneratedFile {
public stmts: Statement[]|null;
constructor(
public srcFileUrl: string, public genFileUrl: string, sourceOrStmts: string|Statement[]) {
public srcFileName: string, public genFileName: string, sourceOrStmts: string|Statement[]) {
if (typeof sourceOrStmts === 'string') {
this.source = sourceOrStmts;
this.stmts = null;
@ -25,7 +25,7 @@ export class GeneratedFile {
}
isEquivalent(other: GeneratedFile): boolean {
if (this.genFileUrl !== other.genFileUrl) {
if (this.genFileName !== other.genFileName) {
return false;
}
if (this.source) {
@ -42,7 +42,7 @@ export class GeneratedFile {
export function toTypeScript(file: GeneratedFile, preamble: string = ''): string {
if (!file.stmts) {
throw new Error(`Illegal state: No stmts present on GeneratedFile ${file.genFileUrl}`);
throw new Error(`Illegal state: No stmts present on GeneratedFile ${file.genFileName}`);
}
return new TypeScriptEmitter().emitStatements(file.genFileUrl, file.stmts, preamble);
return new TypeScriptEmitter().emitStatements(file.genFileName, file.stmts, preamble);
}