perf(ngcc): only create tasks for non-processed formats (#35719)
Change the behaviour in `analyzeEntryPoints` to only create tasks for non-processed formats. PR Close #35719
This commit is contained in:
parent
dc40a93317
commit
d7efc45c04
|
@ -61,7 +61,7 @@ export interface Task extends JsonObject {
|
|||
|
||||
/**
|
||||
* The list of all format properties (including `task.formatProperty`) that should be marked as
|
||||
* processed once the taksk has been completed, because they point to the format-path that will be
|
||||
* processed once the task has been completed, because they point to the format-path that will be
|
||||
* processed as part of the task.
|
||||
*/
|
||||
formatPropertiesToMarkAsProcessed: EntryPointJsonProperty[];
|
||||
|
@ -75,9 +75,6 @@ export type TaskCompletedCallback = (task: Task, outcome: TaskProcessingOutcome)
|
|||
|
||||
/** Represents the outcome of processing a `Task`. */
|
||||
export const enum TaskProcessingOutcome {
|
||||
/** The target format property was already processed - didn't have to do anything. */
|
||||
AlreadyProcessed,
|
||||
|
||||
/** Successfully processed the target format property. */
|
||||
Processed,
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import {ParallelTaskQueue} from './execution/task_selection/parallel_task_queue'
|
|||
import {SerialTaskQueue} from './execution/task_selection/serial_task_queue';
|
||||
import {ConsoleLogger, LogLevel} from './logging/console_logger';
|
||||
import {Logger} from './logging/logger';
|
||||
import {hasBeenProcessed, markAsProcessed} from './packages/build_marker';
|
||||
import {hasBeenProcessed} from './packages/build_marker';
|
||||
import {NgccConfiguration} from './packages/configuration';
|
||||
import {EntryPoint, EntryPointJsonProperty, EntryPointPackageJson, SUPPORTED_FORMAT_PROPERTIES, getEntryPointFormat} from './packages/entry_point';
|
||||
import {makeEntryPointBundle} from './packages/entry_point_bundle';
|
||||
|
@ -207,6 +207,12 @@ export function mainNgcc(
|
|||
}
|
||||
|
||||
for (const formatProperty of propertiesToProcess) {
|
||||
if (hasBeenProcessed(entryPoint.packageJson, formatProperty)) {
|
||||
// The format-path which the property maps to is already processed - nothing to do.
|
||||
logger.debug(`Skipping ${entryPoint.name} : ${formatProperty} (already compiled).`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const formatPropertiesToMarkAsProcessed = equivalentPropertiesMap.get(formatProperty) !;
|
||||
tasks.push({entryPoint, formatProperty, formatPropertiesToMarkAsProcessed, processDts});
|
||||
|
||||
|
@ -256,13 +262,6 @@ export function mainNgcc(
|
|||
`${formatProperty} (formatPath: ${formatPath} | format: ${format})`);
|
||||
}
|
||||
|
||||
// The format-path which the property maps to is already processed - nothing to do.
|
||||
if (hasBeenProcessed(packageJson, formatProperty)) {
|
||||
logger.debug(`Skipping ${entryPoint.name} : ${formatProperty} (already compiled).`);
|
||||
onTaskCompleted(task, TaskProcessingOutcome.AlreadyProcessed);
|
||||
return;
|
||||
}
|
||||
|
||||
const bundle = makeEntryPointBundle(
|
||||
fileSystem, entryPoint, formatPath, isCore, format, processDts, pathMappings, true,
|
||||
enableI18nLegacyMessageIdFormat);
|
||||
|
|
|
@ -58,15 +58,8 @@ describe('ClusterWorker', () => {
|
|||
new ClusterWorker(mockLogger, createCompileFnSpy);
|
||||
const onTaskCompleted: TaskCompletedCallback = createCompileFnSpy.calls.argsFor(0)[0];
|
||||
|
||||
onTaskCompleted(null as any, TaskProcessingOutcome.AlreadyProcessed);
|
||||
expect(processSendSpy).toHaveBeenCalledTimes(1);
|
||||
expect(processSendSpy).toHaveBeenCalledWith({
|
||||
type: 'task-completed',
|
||||
outcome: TaskProcessingOutcome.AlreadyProcessed,
|
||||
});
|
||||
|
||||
onTaskCompleted(null as any, TaskProcessingOutcome.Processed);
|
||||
expect(processSendSpy).toHaveBeenCalledTimes(2);
|
||||
expect(processSendSpy).toHaveBeenCalledTimes(1);
|
||||
expect(processSendSpy).toHaveBeenCalledWith({
|
||||
type: 'task-completed',
|
||||
outcome: TaskProcessingOutcome.Processed,
|
||||
|
|
Loading…
Reference in New Issue