Skip to content

Add 'ui5 build for-server' command - #1563

Draft
RandomByte wants to merge 5 commits into
mainfrom
feat/build-for-cache
Draft

Add 'ui5 build for-server' command#1563
RandomByte wants to merge 5 commits into
mainfrom
feat/build-for-cache

Conversation

@RandomByte

@RandomByte RandomByte commented Sep 2, 2026

Copy link
Copy Markdown
Member

This command can be used to warm the cache for a later ui5 serve run. It's supposed to mimic the build that runs within the server (same set of tasks). This change also moves the server's task-exclude configuration to packages/project/lib/build/helpers/composeTaskList.js, where all the other default include and excludes are already placed.

Note that running ui5 build for-server will not write out files to dist and only fill the central cache.

JIRA: CPOUI5FOUNDATION-1354

Introduce a "server" flag on the BuildConfiguration. When set, composeTaskList
disables tasks whose output the server generates on the fly (currently
generateVersionInfo) by default, while still allowing includedTasks to re-enable
them. graph.serve() now sets server:true, giving a single declarative source of
truth for the server task set instead of callers hand-editing excludedTasks.

Also add a cacheOnly option to graph.build(): it runs the build to populate the
shared build cache via ProjectBuilder.build() + closeCacheManager() without
writing the result to a target directory. ProjectBuilder.build() gains a
dependencyIncludes parameter so the cache-only path has the same dependency
selection as buildToTarget().

The server flag participates in the build-cache signature, so a server-aligned
build (e.g. the upcoming "ui5 build for-server") and a running "ui5 serve" hash
to the same cache entries and share results.
…ve()

graph.serve() now runs a server-aligned build (server:true) that disables the
generateVersionInfo task by default, since the versionInfo middleware generates
the version info on the fly. Drop the imperative excludedTasks editing in
stack.js and forward the caller's excludedTasks unchanged, keeping the default
server task set in one place (@ui5/project composeTaskList).
Add a "ui5 build for-server" subcommand that warms the shared build cache the
"ui5 serve" command reuses. It runs a server-aligned build (server:true, so the
generateVersionInfo task is skipped) and only populates the cache (cacheOnly),
without writing the build result to the destination directory.

Because its BuildConfiguration matches what "ui5 serve" produces, the two share
the same build-cache entries, so a subsequent serve can reuse the pre-built
results.
Describe the new "ui5 build for-server" command in the Builder page: it warms
the shared cache that "ui5 serve" reuses by running the server's task set (which
skips generateVersionInfo) without writing a build result. Update the
generateVersionInfo footnote to name both server entry points.
…fault

graph.serve() now runs a server-aligned build (server:true), which disables
generateVersionInfo by default. Because that task collected the version info of
all libraries, it previously forced every library to build on the initial serve.
Without it, serving an application resource builds only application.a; libraries
build lazily when their resources (or a not-found lookup) first reach them.

Update the integration expectations accordingly: drop generateVersionInfo from
the skipped-task lists, expect only the requested projects to build, and rework
the "test exclusion of generateVersionInfo" case to assert the new default
(excluded) plus re-enabling it via includedTasks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant