Skip to content

Commit

Permalink
[INTERNAL] TaskUtil: Allow resource path instead of instance
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomByte committed Dec 22, 2021
1 parent a0d94bd commit 342a224
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
18 changes: 9 additions & 9 deletions lib/tasks/TaskUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ class TaskUtil {
* This method is only available to custom task extensions defining
* <b>Specification Version 2.2 and above</b>.
*
* @param {module:@ui5/fs.Resource} resource The resource the tag should be stored for
* @param {string|module:@ui5/fs.Resource} resourcePath Path or resource-instance the tag should be stored for
* @param {string} tag Name of the tag.
* Currently only the [STANDARD_TAGS]{@link module:@ui5/builder.tasks.TaskUtil#STANDARD_TAGS} are allowed
* @param {string|boolean|integer} [value=true] Tag value. Must be primitive
* @public
*/
setTag(resource, tag, value) {
return this._projectBuildContext.getResourceTagCollection().setTag(resource, tag, value);
setTag(resourcePath, tag, value) {
return this._projectBuildContext.getResourceTagCollection().setTag(resourcePath, tag, value);
}

/**
Expand All @@ -68,14 +68,14 @@ class TaskUtil {
* This method is only available to custom task extensions defining
* <b>Specification Version 2.2 and above</b>.
*
* @param {module:@ui5/fs.Resource} resource The resource the tag should be retrieved for
* @param {string|module:@ui5/fs.Resource} resourcePath Path or resource-instance the tag should be retrieved for
* @param {string} tag Name of the tag
* @returns {string|boolean|integer|undefined} Tag value for the given resource.
* <code>undefined</code> if no value is available
* @public
*/
getTag(resource, tag) {
return this._projectBuildContext.getResourceTagCollection().getTag(resource, tag);
getTag(resourcePath, tag) {
return this._projectBuildContext.getResourceTagCollection().getTag(resourcePath, tag);
}

/**
Expand All @@ -86,12 +86,12 @@ class TaskUtil {
* This method is only available to custom task extensions defining
* <b>Specification Version 2.2 and above</b>.
*
* @param {module:@ui5/fs.Resource} resource The resource the tag should be cleared for
* @param {string|module:@ui5/fs.Resource} resourcePath Path or resource-instance the tag should be cleared for
* @param {string} tag Tag
* @public
*/
clearTag(resource, tag) {
return this._projectBuildContext.getResourceTagCollection().clearTag(resource, tag);
clearTag(resourcePath, tag) {
return this._projectBuildContext.getResourceTagCollection().clearTag(resourcePath, tag);
}

getResourceTagCollection() {
Expand Down
5 changes: 3 additions & 2 deletions lib/tasks/bundlers/generateBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ module.exports = function({
// For "unoptimized" bundles, the non-debug files have already been filtered out
// Now rename the debug variants to the same name so that they appear like the original
// resource to the bundler
combo = combo.transformer(function(resource) {
if (taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant)) {
combo = combo.transformer(async function(resourcePath, getClonedResource) {
if (taskUtil.getTag(resourcePath, taskUtil.STANDARD_TAGS.IsDebugVariant)) {
const resource = await getClonedResource();
const nonDbgPath = ModuleName.getNonDebugName(resource.getPath());
if (!nonDbgPath) {
throw new Error(`Failed to resolve non-debug name for ${resource.getPath()}`);
Expand Down

0 comments on commit 342a224

Please sign in to comment.