Skip to content

refactor(project): Add TaskDefinitions and task-level build signatures#1412

Open
RandomByte wants to merge 2 commits into
mainfrom
refactor/add-task-build-sig
Open

refactor(project): Add TaskDefinitions and task-level build signatures#1412
RandomByte wants to merge 2 commits into
mainfrom
refactor/add-task-build-sig

Conversation

@RandomByte

@RandomByte RandomByte commented Jun 15, 2026

Copy link
Copy Markdown
Member

Extract the task-list construction out of TaskRunner into a new
TaskDefinitions class which owns the project-type to build-definition
switch, the standard task map, and the custom task validation and
de-duplication loop.

Each standard task in a build definition can expose an async
determineBuildSignature() returning a string contribution; the
fallback is JSON.stringify(taskDef.options). Custom tasks expose the
same via the determineBuildSignature named export of their module,
surfaced through Task#getDetermineBuildSignatureCallback, and must
declare specVersion >= 5.0 to use it. getProjectSignature mixes the
aggregated string in alongside the existing inputs.

Split ProjectBuildContext into a synchronous wiring phase (logger,
TaskUtil, TaskDefinitions) and a static create() that resolves task
signatures, computes the project signature, and constructs the
ProjectBuildCache. create() parameters are reordered to
(buildContext, project, baseSignature, cacheManager).

Add TaskUtil#getReadOnlyInterface(specVersion) for passing into the
determineBuildSignature callback before the task has run.

Also Include builder and fs version into project build signature.

@RandomByte RandomByte requested a review from a team June 15, 2026 12:36
@RandomByte RandomByte changed the title refactor/add task build sig refactor(project): Add TaskDefinitions and task-level build signatures Jun 15, 2026
@RandomByte RandomByte force-pushed the refactor/add-task-build-sig branch from ba93ab7 to a35ade0 Compare June 15, 2026 12:38
Extract the task-list construction out of TaskRunner into a new
TaskDefinitions class which owns the project-type to build-definition
switch, the standard task map, and the custom task validation and
de-duplication loop.

Each standard task in a build definition can expose an async
`determineBuildSignature()` returning a string contribution; the
fallback is `JSON.stringify(taskDef.options)`. Custom tasks expose the
same via the `determineBuildSignature` named export of their module,
surfaced through `Task#getDetermineBuildSignatureCallback`, and must
declare specVersion >= 5.0 to use it. `getProjectSignature` mixes the
aggregated string in alongside the existing inputs.

Split ProjectBuildContext into a synchronous wiring phase (logger,
TaskUtil, TaskDefinitions) and a static `create()` that resolves task
signatures, computes the project signature, and constructs the
ProjectBuildCache. `create()` parameters are reordered to
`(buildContext, project, baseSignature, cacheManager)`.

Add `TaskUtil#getReadOnlyInterface(specVersion)` for passing into the
`determineBuildSignature` callback before the task has run.
@RandomByte RandomByte force-pushed the refactor/add-task-build-sig branch from a35ade0 to 250e4fc Compare June 15, 2026 13:21
* Factory method to create and fully initialize a ProjectBuildContext instance.
*
* Performs the async work that the constructor cannot: collecting task build signatures,
* computing the project build signature, and constructing the {@link ProjectBuildCache}.

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.

the link doesn't really work, does it?

const tasks = new Map();
for (let i = 0; i < projectCustomTasks.length; i++) {
// Add tasks one-by-one to keep order as defined in project configuration
await this._addCustomTask(projectCustomTasks[i], tasks);

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.

_addCustomTask does nothing async; could be changed to sync method, along with _getCustomTasks.

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.

2 participants