Skip to content

fix(@angular/build): scope cache directory by project and builder name - #34240

Merged
alan-agius4 merged 2 commits into
angular:mainfrom
alan-agius4:fix/library-output-path-bazel
Oct 2, 2026
Merged

alan-agius4 merged 2 commits into
angular:mainfrom
alan-agius4:fix/library-output-path-bazel

Conversation

@alan-agius4

@alan-agius4 alan-agius4 commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Accept optional projectName and builderName parameters in normalizeCacheOptions to consistently scope path and localPath per project and builder across the application, dev-server, library, ng-packagr, and unit-test builders.

Without scoping the cache path by builderName, builders such as ng test (unit-test) and ng build (application) share the same project cache directory and overwrite shared cache files such as .tsbuildinfo, causing incremental caching not to work properly.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the validation check that prevents the library builder's output path from being the project root, containing the project root, or being located within the project root. The review feedback highlights that while allowing the output path to be within the project root is desirable, we must still prevent it from being exactly the project root or containing the project root to avoid accidental deletion of source files. Suggestions are provided to restore a modified validation check, retain the 'isSubDirectory' import, and reuse the resolved output path variable.

Comment thread packages/angular/build/src/builders/library/options.ts
Comment thread packages/angular/build/src/builders/library/options.ts
Comment thread packages/angular/build/src/builders/library/options.ts Outdated
@alan-agius4 alan-agius4 changed the title fix(@angular/build): allow library outputPath within project root fix(@angular/build): allow library outputPath in project root and scope cache by project Oct 2, 2026
@alan-agius4
alan-agius4 force-pushed the fix/library-output-path-bazel branch from 2c197db to 4bdbfa2 Compare October 2, 2026 08:00
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release labels Oct 2, 2026
@alan-agius4
alan-agius4 force-pushed the fix/library-output-path-bazel branch from 4bdbfa2 to dd9bf8a Compare October 2, 2026 08:18
@alan-agius4 alan-agius4 changed the title fix(@angular/build): allow library outputPath in project root and scope cache by project fix(@angular/build): allow library outputPath in project root and scope cache by project and builder Oct 2, 2026
@alan-agius4 alan-agius4 changed the title fix(@angular/build): allow library outputPath in project root and scope cache by project and builder fix(@angular/build): scope cache directory by project and builder name Oct 2, 2026
@alan-agius4
alan-agius4 force-pushed the fix/library-output-path-bazel branch 2 times, most recently from 14dd9e5 to ead7184 Compare October 2, 2026 08:36
@alan-agius4
alan-agius4 requested a review from clydin October 2, 2026 08:37
Accept optional `projectName` and `builderName` parameters in
`normalizeCacheOptions` to consistently scope `path` and `localPath`
per project and builder across the application, dev-server, library,
ng-packagr, and unit-test builders.

Without scoping the cache path by `builderName`, builders that invoke
the application build pipeline (such as `unit-test` during `ng test`
and `application` during `ng build`) share the same project cache
directory and overwrite shared cache artifacts such as `.tsbuildinfo`
files, preventing incremental caching from working properly.
@alan-agius4
alan-agius4 force-pushed the fix/library-output-path-bazel branch from ead7184 to 431414e Compare October 2, 2026 09:38

@clydin clydin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like ng-packagr and unit-test already have some logic to add the builder name to the cache path. To avoid duplicate path segments, we should also remove/consolidate that logic.

Comment thread packages/angular/build/src/builders/dev-server/vite/server.ts Outdated
Comment thread packages/angular/build/src/utils/normalize-cache.ts
@alan-agius4
alan-agius4 requested a review from clydin October 2, 2026 18:02
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 2, 2026
@alan-agius4
alan-agius4 merged commit 5ffed3f into angular:main Oct 2, 2026
40 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

@alan-agius4
alan-agius4 deleted the fix/library-output-path-bazel branch October 2, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants