Skip to content

refactor(@angular/build): add NG_BUILD_CACHE_STORE environment variable support#33518

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:feat-cache-store-env-option
Jul 6, 2026
Merged

refactor(@angular/build): add NG_BUILD_CACHE_STORE environment variable support#33518
clydin merged 1 commit into
angular:mainfrom
clydin:feat-cache-store-env-option

Conversation

@clydin

@clydin clydin commented Jul 6, 2026

Copy link
Copy Markdown
Member

This change introduces the NG_BUILD_CACHE_STORE environment variable to allow users and developers to customize the backing persistent cache storage mechanism.

Usage:
By default, the build system automatically uses the native LMDB cache store and falls back to the built-in SQLite cache store if LMDB fails to initialize. Users can now explicitly control this behavior by setting NG_BUILD_CACHE_STORE to one of the following values:

  • sqlite: Forces the use of the built-in SQLite cache store. No attempts to load the native LMDB store will be made.
  • lmdb: Forces the use of the native LMDB cache store. If the LMDB store fails to initialize, the build will fail.
  • auto / unset: Standard behavior (attempts LMDB first, falls back to SQLite).

Example:
$ NG_BUILD_CACHE_STORE=sqlite ng build

@clydin clydin added the target: minor This PR is targeted for the next minor release label Jul 6, 2026
@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@clydin

clydin commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@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 introduces the ability to force a specific persistent cache store (either SQLite or LMDB) using the NG_BUILD_CACHE_STORE environment variable. It adds the configuration option, integrates it into the cache store creation logic, and includes corresponding unit tests. A review comment points out that the test assertion logic for LMDB initialization failures is too permissive and can swallow actual test failures if the assertion message contains the word 'lmdb'. It is recommended to restrict the error check to only ignore genuine initialization failures.

Comment thread packages/angular/build/src/tools/esbuild/sqlite-cache-store_spec.ts Outdated
…le support

This change introduces the `NG_BUILD_CACHE_STORE` environment variable to allow users and developers to customize the backing persistent cache storage mechanism.

Usage:
By default, the build system automatically uses the native LMDB cache store and falls back to the built-in SQLite cache store if LMDB fails to initialize. Users can now explicitly control this behavior by setting `NG_BUILD_CACHE_STORE` to one of the following values:

- `sqlite`: Forces the use of the built-in SQLite cache store. No attempts to load the native LMDB store will be made.
- `lmdb`: Forces the use of the native LMDB cache store. If the LMDB store fails to initialize, the build will fail.
- `auto` / unset: Standard behavior (attempts LMDB first, falls back to SQLite).

Example:
$ NG_BUILD_CACHE_STORE=sqlite ng build
@clydin clydin force-pushed the feat-cache-store-env-option branch from ec6600d to 8e370ed Compare July 6, 2026 14:17
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jul 6, 2026
@clydin clydin requested a review from alan-agius4 July 6, 2026 14:17
@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 Jul 6, 2026
@clydin clydin merged commit 92da0d6 into angular:main Jul 6, 2026
68 of 69 checks passed
@clydin

clydin commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

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

@clydin clydin deleted the feat-cache-store-env-option branch July 6, 2026 15:08
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