Skip to content

TaskUtil to expose the current tasks name #545

@kristian

Description

@kristian

Describe the solution you'd like

For custom task implementations according to [1] it would be helpful to either have TaskUtil expose a getTaskName or have parameters.options contain the taskName.

Describe alternatives you've considered

No alternatives available afaik, in a task function, you cannot find out the task you are running in

Additional context

Imagine you have a decomment-html task. The general implementation of the task also allows to remove comments from XML files however, with a slightly different ruleset. Thus it would make sense to acutally link two custom tasks to the same function like so:

specVersion: "2.4"
kind: extension
metadata:
  name: decomment-html
type: task
task:
  path: lib/decomment.js
---
specVersion: "2.4"
kind: extension
metadata:
  name: decomment-xml
type: task
task:
  path: lib/decomment.js

However the decomment module has no way of knowing the task name, thus it cannot differentiate between both calls. Currently it is required to also create two seperate "wrapper" JavaScript files (decommentHtml.js and decommentXml.js).

[1] https://sap.github.io/ui5-tooling/pages/extensibility/CustomTasks/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions