perf(ivy): let ngcc first check marker file before assembling bundle (#27438)
With the bundle info being assembled into a single object before the transform is started, we now greedily create a TypeScript program up-front. If a marker file exists that indicates that the bundle could be skipped the program creation has already taken place which takes a significant amount of time. This commit moves the marker check to occur before the bundle is assembled. PR Close #27438
This commit is contained in:
parent
52544ffaa3
commit
4376ec207c
|
@ -8,6 +8,7 @@
|
|||
import * as path from 'canonical-path';
|
||||
import * as yargs from 'yargs';
|
||||
|
||||
import {checkMarkerFile, writeMarkerFile} from './packages/build_marker';
|
||||
import {DependencyHost} from './packages/dependency_host';
|
||||
import {DependencyResolver} from './packages/dependency_resolver';
|
||||
import {EntryPointFormat} from './packages/entry_point';
|
||||
|
@ -59,6 +60,11 @@ export function mainNgcc(args: string[]): number {
|
|||
const dtsTransformFormat: EntryPointFormat = entryPoint.fesm2015 ? 'fesm2015' : 'esm2015';
|
||||
|
||||
formats.forEach(format => {
|
||||
if (checkMarkerFile(entryPoint, format)) {
|
||||
console.warn(`Skipping ${entryPoint.name} : ${format} (already built).`);
|
||||
return;
|
||||
}
|
||||
|
||||
const bundle =
|
||||
makeEntryPointBundle(entryPoint, isCore, format, format === dtsTransformFormat);
|
||||
if (bundle === null) {
|
||||
|
@ -67,6 +73,9 @@ export function mainNgcc(args: string[]): number {
|
|||
} else {
|
||||
transformer.transform(entryPoint, isCore, bundle);
|
||||
}
|
||||
|
||||
// Write the built-with-ngcc marker
|
||||
writeMarkerFile(entryPoint, format);
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
|
|
|
@ -20,7 +20,6 @@ import {Esm5Renderer} from '../rendering/esm5_renderer';
|
|||
import {EsmRenderer} from '../rendering/esm_renderer';
|
||||
import {FileInfo, Renderer} from '../rendering/renderer';
|
||||
|
||||
import {checkMarkerFile, writeMarkerFile} from './build_marker';
|
||||
import {EntryPoint} from './entry_point';
|
||||
import {EntryPointBundle} from './entry_point_bundle';
|
||||
|
||||
|
@ -53,11 +52,6 @@ export class Transformer {
|
|||
* @param bundle the bundle to transform.
|
||||
*/
|
||||
transform(entryPoint: EntryPoint, isCore: boolean, bundle: EntryPointBundle): void {
|
||||
if (checkMarkerFile(entryPoint, bundle.format)) {
|
||||
console.warn(`Skipping ${entryPoint.name} : ${bundle.format} (already built).`);
|
||||
return;
|
||||
}
|
||||
|
||||
console.warn(`Compiling ${entryPoint.name} - ${bundle.format}`);
|
||||
|
||||
const reflectionHost = this.getHost(isCore, bundle);
|
||||
|
@ -73,9 +67,6 @@ export class Transformer {
|
|||
|
||||
// Write out all the transformed files.
|
||||
renderedFiles.forEach(file => this.writeFile(file));
|
||||
|
||||
// Write the built-with-ngcc marker
|
||||
writeMarkerFile(entryPoint, bundle.format);
|
||||
}
|
||||
|
||||
getHost(isCore: boolean, bundle: EntryPointBundle): NgccReflectionHost {
|
||||
|
|
Loading…
Reference in New Issue