feat(ngcc): lock ngcc when processing (#34722)
Previously, it was possible for multiple instance of ngcc to be running at the same time, but this is not supported and can cause confusing and flakey errors at build time. Now, only one instance of ngcc can run at a time. If a second instance tries to execute it fails with an appropriate error message. See https://github.com/angular/angular/issues/32431#issuecomment-571825781 PR Close #34722
This commit is contained in:

committed by
Andrew Kushnir

parent
d243d851a5
commit
6dd51f1cc2
26
packages/compiler-cli/ngcc/test/helpers/mock_lock_file.ts
Normal file
26
packages/compiler-cli/ngcc/test/helpers/mock_lock_file.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {MockFileSystemNative} from '../../../src/ngtsc/file_system/testing';
|
||||
import {LockFile} from '../../src/execution/lock_file';
|
||||
|
||||
export class MockLockFile extends LockFile {
|
||||
log: string[] = [];
|
||||
constructor(private options: {throwOnCreate?: boolean, throwOnRemove?: boolean} = {}) {
|
||||
// This `MockLockFile` is not used in tests that are run via `runInEachFileSystem()`
|
||||
// So we cannot use `getFileSystem()` but instead just instantiate a mock file-system.
|
||||
super(new MockFileSystemNative());
|
||||
}
|
||||
create() {
|
||||
this.log.push('create()');
|
||||
if (this.options.throwOnCreate) throw new Error('LockFile.create() error');
|
||||
}
|
||||
remove() {
|
||||
this.log.push('remove()');
|
||||
if (this.options.throwOnRemove) throw new Error('LockFile.remove() error');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user