refactor(compiler): don’t write summaries for jit by default

The default is false externally but true internally at Google.
This commit is contained in:
Tobias Bosch
2017-06-09 14:00:03 -07:00
committed by Alex Rickabaugh
parent d56b7ed96d
commit 90b0713e32
11 changed files with 79 additions and 12 deletions

View File

@ -35,7 +35,8 @@ export class AotCompiler {
private _viewCompiler: ViewCompiler, private _ngModuleCompiler: NgModuleCompiler,
private _outputEmitter: OutputEmitter,
private _summaryResolver: SummaryResolver<StaticSymbol>, private _localeId: string|null,
private _translationFormat: string|null, private _symbolResolver: StaticSymbolResolver) {}
private _translationFormat: string|null, private _enableSummariesForJit: boolean|null,
private _symbolResolver: StaticSymbolResolver) {}
clearCache() { this._metadataResolver.clearCache(); }
@ -204,10 +205,12 @@ export class AotCompiler {
o.StmtModifier.Exported
]));
});
return [
new GeneratedFile(srcFileUrl, summaryFileName(srcFileUrl), json),
this._codegenSourceModule(srcFileUrl, forJitOutputCtx)
];
const summaryJson = new GeneratedFile(srcFileUrl, summaryFileName(srcFileUrl), json);
if (this._enableSummariesForJit) {
return [summaryJson, this._codegenSourceModule(srcFileUrl, forJitOutputCtx)];
};
return [summaryJson];
}
private _compileModule(outputCtx: OutputContext, ngModuleType: StaticSymbol): void {

View File

@ -70,6 +70,7 @@ export function createAotCompiler(compilerHost: AotCompilerHost, options: AotCom
const compiler = new AotCompiler(
config, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver),
viewCompiler, new NgModuleCompiler(staticReflector), new TypeScriptEmitter(), summaryResolver,
options.locale || null, options.i18nFormat || null, symbolResolver);
options.locale || null, options.i18nFormat || null, options.enableSummariesForJit || null,
symbolResolver);
return {compiler, reflector: staticReflector};
}

View File

@ -14,4 +14,5 @@ export interface AotCompilerOptions {
translations?: string;
missingTranslation?: MissingTranslationStrategy;
enableLegacyTemplate?: boolean;
enableSummariesForJit?: boolean
}