Skip to content

@ui5/project/build/helpers/TaskUtil

@ui5/project/build/helpers/TaskUtil

Convenience functions for UI5 tasks. An instance of this class is passed to every standard UI5 task that requires it.

Custom tasks that define a specification version >= 2.2 will receive an interface to an instance of this class when called. The set of available functions on that interface depends on the specification version defined for the extension.

Members

Source: project/lib/build/helpers/TaskUtil.js, line 58

Type:

Description: Provides limited access to @ui5/fs/resourceFactory functions

This attribute is only available to custom task extensions defining Specification Version 3.0 and above.

Source: project/lib/build/helpers/TaskUtil.js, line 291

Provides limited access to @ui5/fs/resourceFactory functions

This attribute is only available to custom task extensions defining Specification Version 3.0 and above.

Type:

Methods

clearTag(resource, tag)

Description: Clears the value of a tag stored for the given resource's path. It's like the tag was never set for that resource.

This method is only available to custom task extensions defining Specification Version 2.2 and above.

Source: project/lib/build/helpers/TaskUtil.js, line 131

Parameters:
NameTypeDescription
resource@ui5/fs/ResourceResource-instance the tag should be cleared for
tagstringTag

getDependencies(projectNameopt) → {Array<string>}

Description: Retrieve a list of direct dependencies of a given project from the dependency graph. Note that this list does not include transitive dependencies.

This method is only available to custom task extensions defining Specification Version 3.0 and above.

Source: project/lib/build/helpers/TaskUtil.js, line 256

Parameters:
NameTypeAttributesDescription
projectNamestringoptionalName of the project to retrieve. Defaults to the project currently being built
Throws:

If the requested project is unknown to the graph

Type: Error

Returns:

Names of all direct dependencies

Type: Array<string>

getProject(projectNameOrResourceopt) → {@ui5/project/build/helpers/TaskUtil~ProjectInterface|undefined}

Description: Retrieve a single project from the dependency graph

This method is only available to custom task extensions defining Specification Version 3.0 and above.

Source: project/lib/build/helpers/TaskUtil.js, line 229

Parameters:
NameTypeAttributesDescription
projectNameOrResourcestring | @ui5/fs/ResourceoptionalName of the project to retrieve or a Resource instance to retrieve the associated project for.
Defaults to the name of the project currently being built
Returns:

Specification Version-dependent interface to the Project instance or undefined if the project name is unknown or the provided resource is not associated with any project.

Type: @ui5/project/build/helpers/TaskUtil~ProjectInterface | undefined

getTag(resource, tag) → {string|boolean|integer|undefined}

Description: Retrieves the value for a stored tag. If no value is stored, undefined is returned.

This method is only available to custom task extensions defining Specification Version 2.2 and above.

Source: project/lib/build/helpers/TaskUtil.js, line 110

Parameters:
NameTypeDescription
resource@ui5/fs/ResourceResource-instance the tag should be retrieved for
tagstringName of the tag
Returns:

Tag value for the given resource. undefined if no value is available

Type: string | boolean | integer | undefined

isRootProject() → {boolean}

Description: Check whether the project currently being built is the root project.

This method is only available to custom task extensions defining Specification Version 2.2 and above.

Source: project/lib/build/helpers/TaskUtil.js, line 150

Returns:

true if the currently built project is the root project

Type: boolean

registerCleanupTask(callback)

Description: Register a function that must be executed once the build is finished. This can be used to, for example, clean up files temporarily created on the file system. If the callback returns a Promise, it will be waited for. It will also be executed in cases where the build has failed or has been aborted.

This method is only available to custom task extensions defining Specification Version 2.2 and above.

Source: project/lib/build/helpers/TaskUtil.js, line 189

Parameters:
NameTypeDescription
callback@ui5/project/build/helpers/TaskUtil~cleanupTaskCallbackCallback to
register; it will be waited for if it returns a Promise

setTag(resource, tag, valueopt)

Description: Stores a tag with value for a given resource's path. Note that the tag is independent of the supplied resource instance. For two resource instances with the same path, the same tag value is returned. If the path of a resource is changed, any tag information previously stored for that resource is lost.

This method is only available to custom task extensions defining Specification Version 2.2 and above.

Source: project/lib/build/helpers/TaskUtil.js, line 87

Parameters:
NameTypeAttributesDefaultDescription
resource@ui5/fs/ResourceResource-instance the tag should be stored for
tagstringName of the tag. Currently only the
STANDARD_TAGS are allowed
valuestring | boolean | integeroptionaltrueTag value. Must be primitive

Type Definitions

ProjectInterface

Description: Specification Version-dependent Project interface. For details on individual functions, see Project

Source: project/lib/build/helpers/TaskUtil.js, line 193

Properties:
NameTypeDescription
getTypefunctionGet the project type
getNamefunctionGet the project name
getVersionfunctionGet the project version
getNamespacefunctionGet the project namespace
getRootReaderfunctionGet the project rootReader
getReaderfunctionGet the project reader
getRootPathfunctionGet the local File System path of the project's root directory
getSourcePathfunctionGet the local File System path of the project's source directory
getCustomConfigurationfunctionGet the project Custom Configuration
isFrameworkProjectfunctionCheck whether the project is a UI5-Framework project
getFrameworkNamefunctionGet the project's framework name configuration
getFrameworkVersionfunctionGet the project's framework version configuration
getFrameworkDependenciesfunctionGet the project's framework dependencies configuration

Specification Version-dependent Project interface. For details on individual functions, see Project

Type:
  • object

StandardBuildTags

Description: Standard Build Tags. See UI5 CLI RFC 0008 for details.

Source: project/lib/build/helpers/TaskUtil.js, line 25

Properties:
NameTypeDescription
OmitFromBuildResultstringSetting this tag to true will prevent the resource from being written to the build target directory
IsBundlestringThis tag identifies resources that contain (i.e. bundle) multiple other resources
IsDebugVariantstringThis tag identifies resources that are a debug variant (typically named with a "-dbg" suffix)
of another resource. This tag is part of the build manifest.
HasDebugVariantstringThis tag identifies resources for which a debug variant has been created.
This tag is part of the build manifest.

Standard Build Tags. See UI5 CLI RFC 0008 for details.

Type:
  • object

cleanupTaskCallback(force)

Description: Callback that is executed once the build has finished

Source: project/lib/build/helpers/TaskUtil.js, line 166

Parameters:
NameTypeDescription
forcebooleanWhether the cleanup callback should
gracefully wait for certain jobs to be completed (false)
or enforce immediate termination (true)

resourceFactory

Description: Specification Version-dependent set of @ui5/fs/resourceFactory functions provided to tasks. For details on individual functions, see @ui5/fs/resourceFactory

Source: project/lib/build/helpers/TaskUtil.js, line 260

Properties:
NameTypeDescription
createResourcefunctionCreates a Resource.
Accepts the same parameters as the Resource constructor.
createReaderCollectionfunctionCreates a reader collection:
ReaderCollection
createReaderCollectionPrioritizedfunctionCreates a prioritized reader collection:
ReaderCollectionPrioritized
createFilterReaderfunctionCreate a Filter-Reader with the given reader.
createLinkReaderfunctionCreate a Link-Reader with the given reader.
createFlatReaderfunctionCreate a Link-Reader
where all requests are prefixed with /resources/<namespace>.

Specification Version-dependent set of @ui5/fs/resourceFactory functions provided to tasks. For details on individual functions, see @ui5/fs/resourceFactory

Type:
  • object