Skip to content

Commit

Permalink
[FEATURE] generateFlexChangesBundle: Hide bundle input from build result
Browse files Browse the repository at this point in the history
Flexibility changes files that are bundled are not part of the build
result anymore.

This feature is using the new resource tagging as per RFC 0008:
SAP/ui5-tooling#243
  • Loading branch information
RandomByte committed Aug 11, 2020
1 parent a7074ae commit 001183a
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 232 deletions.
57 changes: 28 additions & 29 deletions lib/tasks/bundlers/generateFlexChangesBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const flexChangesBundler = require("../../processors/bundlers/flexChangesBundler
* @param {string} [parameters.options.namespace] Application Namespace
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
*/
module.exports = function({workspace, options: {namespace}}) {
module.exports = async function({workspace, taskUtil, options: {namespace}}) {
// Use the given namespace if available, otherwise use no namespace
// (e.g. in case no manifest.json is present)
let pathPrefix = "";
Expand Down Expand Up @@ -63,34 +63,33 @@ module.exports = function({workspace, options: {namespace}}) {
}

log.verbose("Collecting flexibility changes");
return workspace.byGlob(`${pathPrefix}/changes/*.{change,variant,ctrl_variant,ctrl_variant_change,ctrl_variant_management_change}`)
.then((allResources) => {
if (allResources.length > 0) {
return readManifestMinUI5Version().then((version) => {
let hasFlexBundleVersion = false;
if (parseFloat(version) >= 1.73) {
hasFlexBundleVersion = true;
}
return flexChangesBundler({
resources: allResources,
options: {
pathPrefix,
hasFlexBundleVersion
}
});
});
const allResources = await workspace.byGlob(
`${pathPrefix}/changes/*.{change,variant,ctrl_variant,ctrl_variant_change,ctrl_variant_management_change}`);
if (allResources.length > 0) {
const version = await readManifestMinUI5Version();
let hasFlexBundleVersion = false;
if (parseFloat(version) >= 1.73) {
hasFlexBundleVersion = true;
}
const processedResources = await flexChangesBundler({
resources: allResources,
options: {
pathPrefix,
hasFlexBundleVersion
}
return [];
})
.then((processedResources) => {
return Promise.all(processedResources.map((resource) => {
log.verbose("Writing flexibility changes bundle");
return workspace.write(resource);
})).then(async () => {
// Add the sap.ui.fl dependency if a bundle has been created
if (processedResources.length > 0) {
await updateFLdependency();
}
});
});
await Promise.all(processedResources.map((resource) => {
log.verbose("Writing flexibility changes bundle");
return workspace.write(resource);
}));
// Add the sap.ui.fl dependency if a bundle has been created
if (processedResources.length > 0) {
await updateFLdependency();
}

// Do not write bundled source files to build result
allResources.forEach((resource) => {
taskUtil.setTag(resource, taskUtil.STANDARD_TAGS.HideFromBuildResult);
});
}
};
1 change: 1 addition & 0 deletions lib/types/application/ApplicationBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class ApplicationBuilder extends AbstractBuilder {
const generateFlexChangesBundle = getTask("generateFlexChangesBundle").task;
return generateFlexChangesBundle({
workspace: resourceCollections.workspace,
taskUtil,
options: {
namespace: project.metadata.namespace
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 001183a

Please sign in to comment.