feat: Offer --cache option to control cache mode (Incremental Build)#1368
Conversation
13173d5 to
68a130f
Compare
68a130f to
0c087f8
Compare
e1d781f to
ab65f27
Compare
7aa4cd3 to
95fd5de
Compare
e451d07 to
07a5941
Compare
bbf7099 to
39431de
Compare
0670d94 to
d029efb
Compare
7994eae to
2546932
Compare
2546932 to
4db0fca
Compare
|
Rebased onto base branch |
Fix all unit tests which are NOT failing in base branch ("feat-incremental-build-4")
cafca18 to
f2ff30d
Compare
4be8ab8 to
7164b79
Compare
|
Adding @KlattG since this PR changes a lot of user-facing texts |
6e065f0 to
db051ab
Compare
Co-authored-by: Florian Vogt <florian.vogt@sap.com>
7dec71b to
876b2f3
Compare
c9c4972 to
2862e0f
Compare
KlattG
left a comment
There was a problem hiding this comment.
Nothing major, just a few things I noticed
Co-authored-by: Günter Klatt <guenter.klatt@sap.com>
6b89af1 to
d18fba9
Compare
06d7a70 to
2b2d697
Compare
2b2d697 to
1b9a3ea
Compare
|
I noticed that when using the mode "Off" there are still verbose logs regarding caching, which I did not expect.
|
| # | Issue | Impact |
|---|---|---|
| 1 | #freezeUntransformedSources() writes to SQLite CAS |
Correctness — violates the documented contract. Persistent side effect on disk. |
| 2 | #revalidateSourceIndex() re-globs and hashes all sources |
Performance — O(source size) per build |
| 3 | recordTaskResult() builds hash trees, records requests |
Performance — O(requests × resources) per task |
| 4 | #initSourceIndex() builds Merkle tree |
Performance — O(source size) once per build |
| 5 | CacheManager SQLite DB opened |
Startup cost; minor |
| 6 | In-memory StageCache populated |
Memory; minor |
| 7 | Missing deprecation warning in tree.js |
UX; minor |
| 8 | cacheDir argument silently dropped |
Separate latent bug |
Recommended fix outline
A single guard in the ProjectBuildCache hot path covers issues 1–4 and 6:
- In
allTasksCompleted(), skip#revalidateSourceIndex()and
#freezeUntransformedSources()when#cacheMode === Cache.Off. - In
recordTaskResult(), return early after the stage writer accounting that
the build itself depends on (e.g.#writtenResultResourcePaths) — skip
taskCache.recordRequests,BuildTaskCachecreation, and
stageCache.addSignature. - In
#initSourceIndex()Offbranch, leave#sourceIndexunset (or set to a
cheap sentinel) and ensure no downstream code path dereferences it. (Quick
audit:#getPossibleResultStageSignatures,#getResultStageSignature,
#updateSourceIndex,#revalidateSourceIndex,#freezeUntransformedSources
all touch#sourceIndex; all of them are reachable only through paths that
should be Off-gated.) - In
BuildContext.getCacheManager(), return a no-op manager (or skip
initialization entirely) whenbuildConfig.cache === Cache.Off. This also
removes the SQLite open cost (issue 5).
Tests that should be added to ProjectBuilder.integration.js /
BuildServer.integration.js:
- After a
cache=Offbuild, assert that~/.ui5/buildCache/v0_7/cache.db
contains no rows for the project under test (or that the file is not
created at all when no other project ever wrote to it). - Spy on
CacheManager.writeStageCache/putCompressedContent/
writeIndexCache/writeResultMetadataand assert zero calls during a
cache=Offbuild.
Part of Incremental Build: #1267
JIRA: CPOUI5FOUNDATION-1208
--cachewith values "Default", "ReadOnly", "Force" and "Off" for commands "ui5 build" and "ui5 serve"--cache-modeto--snapshot-cache