Skip to content

Commit

Permalink
[FEATURE] TaskRunner: Provide taskName and logger instance to custom …
Browse files Browse the repository at this point in the history
…tasks

New parameters are only provided to custom tasks defining specVersion 3.0
and later
  • Loading branch information
RandomByte committed Nov 24, 2022
1 parent 2e863cf commit 36cd2d8
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 47 deletions.
18 changes: 13 additions & 5 deletions lib/build/TaskRunner.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import composeTaskList from "./helpers/composeTaskList.js";
import logger from "@ui5/logger";

/**
* TaskRunner
Expand Down Expand Up @@ -279,11 +280,18 @@ class TaskRunner {
{@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
{@ui5/fs/AbstractReader} parameters.dependencies
Reader or Collection to read dependency files
{Object} parameters.taskUtil Specification Version dependent interface to a
[TaskUtil]{@link @ui5/project/build/helpers/TaskUtil} instance
{@ui5/project/build/helpers/TaskUtil} parameters.taskUtil Specification Version dependent
interface of a [TaskUtil]{@link @ui5/project/build/helpers/TaskUtil} instance
{@ui5/logger/GroupLogger} [parameters.log] Logger instance to use by the custom task.
This method is only available to custom task extensions defining
<b>Specification Version 3.0 and above</b>.
{Object} parameters.options Options
{string} parameters.options.projectName Project name
{string} [parameters.options.projectNamespace] Project namespace if available
{string|null} parameters.options.projectNamespace Project namespace if available
{string} [parameters.options.taskName] Runtime name of the task.
If a task is executed multiple times, a suffix is added to distinguish the executions.
This attribute is only available to custom task extensions defining
<b>Specification Version 3.0 and above</b>.
{string} [parameters.options.configuration] Task configuration if given in ui5.yaml
Returns:
{Promise<undefined>} Promise resolving with undefined once data has been written
Expand All @@ -302,8 +310,8 @@ class TaskRunner {
}

if (task.getSpecVersion() === "3.0") {
params.log = log;
params.taskName = newTaskName;
params.options.taskName = newTaskName;
params.log = logger.getGroupLogger(`builder:custom-task:${newTaskName}`);
}

const taskUtilInterface = taskUtil.getInterface(task.getSpecVersion());
Expand Down
Loading

0 comments on commit 36cd2d8

Please sign in to comment.