fix(ngcc): do not crash on entry-point that fails to compile (#36083)
Previously, when an entry-point contained code that caused its compilation to fail, ngcc would exit in the middle of processing, possibly leaving other entry-points in a corrupt state. This change adds a new `errorOnFailedEntryPoint` option to `mainNgcc` that specifies whether ngcc should exit immediately or log an error and continue processing other entry-points. The default is `false` so that ngcc will not error but continue processing as much as possible. This is useful in post-install hooks, and async CLI integration, where we do not have as much control over which entry-points should be processed. The option is forced to true if the `targetEntryPointPath` is provided, such as the sync integration with the CLI, since in that case it is targeting an entry-point that will actually be used in the current project so we do want ngcc to exit with an error at that point. PR Close #36083
This commit is contained in:

committed by
Andrew Kushnir

parent
1790b63a5d
commit
ff665b9e6a
@ -9,6 +9,7 @@
|
||||
import {PartiallyOrderedTasks, TaskQueue} from '../../../../src/execution/tasks/api';
|
||||
import {ParallelTaskQueue} from '../../../../src/execution/tasks/queues/parallel_task_queue';
|
||||
import {computeTaskDependencies} from '../../../../src/execution/tasks/utils';
|
||||
import {MockLogger} from '../../../helpers/mock_logger';
|
||||
import {createTasksAndGraph} from '../../helpers';
|
||||
|
||||
describe('ParallelTaskQueue', () => {
|
||||
@ -36,7 +37,7 @@ describe('ParallelTaskQueue', () => {
|
||||
const {tasks, graph} =
|
||||
createTasksAndGraph(entryPointCount, tasksPerEntryPointCount, entryPointDeps);
|
||||
const dependencies = computeTaskDependencies(tasks, graph);
|
||||
return {tasks, queue: new ParallelTaskQueue(tasks.slice(), dependencies)};
|
||||
return {tasks, queue: new ParallelTaskQueue(new MockLogger(), tasks.slice(), dependencies)};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,6 +11,7 @@ import {PartiallyOrderedTasks, Task, TaskQueue} from '../../../../src/execution/
|
||||
import {SerialTaskQueue} from '../../../../src/execution/tasks/queues/serial_task_queue';
|
||||
import {computeTaskDependencies} from '../../../../src/execution/tasks/utils';
|
||||
import {EntryPoint} from '../../../../src/packages/entry_point';
|
||||
import {MockLogger} from '../../../helpers/mock_logger';
|
||||
|
||||
|
||||
describe('SerialTaskQueue', () => {
|
||||
@ -38,7 +39,7 @@ describe('SerialTaskQueue', () => {
|
||||
graph.addNode(entryPoint.path);
|
||||
}
|
||||
const dependencies = computeTaskDependencies(tasks, graph);
|
||||
return {tasks, queue: new SerialTaskQueue(tasks.slice(), dependencies)};
|
||||
return {tasks, queue: new SerialTaskQueue(new MockLogger(), tasks.slice(), dependencies)};
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user