diff --git a/packages/builder/lib/tasks/bundlers/generateFlexChangesBundle.js b/packages/builder/lib/tasks/bundlers/generateFlexChangesBundle.js
index 5cc43654a3..123c097eef 100644
--- a/packages/builder/lib/tasks/bundlers/generateFlexChangesBundle.js
+++ b/packages/builder/lib/tasks/bundlers/generateFlexChangesBundle.js
@@ -14,7 +14,7 @@ import semver from "semver";
* at runtime.
* If a change bundle is created, "sap.ui.fl" is added as a dependency to the manifest.json if not already present -
* if the dependency is already listed but lazy-loaded, lazy loading is disabled.
- * If minUI5Version >= 1.73 flexibility-bundle.json will be create.
+ * If minUI5Version >= 1.73 flexibility-bundle.json is created.
* If there are control variants and minUI5Version < 1.73 build will break and throw an error.
*
* @public
@@ -38,29 +38,34 @@ export default async function({workspace, taskUtil, options = {}}) {
pathPrefix = `/resources/${namespace}`;
}
- function updateJson(data) {
- // ensure the existence of the libs section in the dependencies
+ function updateJson(data, bBundleCreated) {
data["sap.ui5"] = data["sap.ui5"] || {};
- data["sap.ui5"].dependencies = data["sap.ui5"].dependencies || {};
- const mLibs = data["sap.ui5"].dependencies.libs = data["sap.ui5"].dependencies.libs || {};
-
- if (mLibs["sap.ui.fl"]) {
- log.verbose("sap.ui.fl found in manifest.json");
- if (mLibs["sap.ui.fl"].lazy) {
- log.verbose("sap.ui.fl 'lazy' attribute found in manifest.json, setting it to false...");
- mLibs["sap.ui.fl"].lazy = false;
+ // explicit set the flag to inform the runtime if a bundle is present before the preload can be interpreted
+ data["sap.ui5"].flexBundle = bBundleCreated;
+
+ if (bBundleCreated) {
+ // ensure the existence of the libs section in the dependencies
+ data["sap.ui5"].dependencies = data["sap.ui5"].dependencies || {};
+ const mLibs = data["sap.ui5"].dependencies.libs = data["sap.ui5"].dependencies.libs || {};
+
+ if (mLibs["sap.ui.fl"]) {
+ log.verbose("sap.ui.fl found in manifest.json");
+ if (mLibs["sap.ui.fl"].lazy) {
+ log.verbose("sap.ui.fl 'lazy' attribute found in manifest.json, setting it to false...");
+ mLibs["sap.ui.fl"].lazy = false;
+ }
+ } else {
+ log.verbose("sap.ui.fl not found in manifest.json, inserting it...");
+ mLibs["sap.ui.fl"] = {};
}
- } else {
- log.verbose("sap.ui.fl not found in manifest.json, inserting it...");
- mLibs["sap.ui.fl"] = {};
}
}
- async function updateFLdependency() {
+ async function updateManifestWithFlDependencyAndFlexBundleFlag(bBundleCreated) {
const manifestResource = await workspace.byPath(`${pathPrefix}/manifest.json`);
const manifestContent = JSON.parse(await manifestResource.getString());
- updateJson(manifestContent);
+ updateJson(manifestContent, bBundleCreated);
manifestResource.setString(JSON.stringify(manifestContent, null, "\t"));
await workspace.write(manifestResource);
@@ -83,6 +88,9 @@ export default async function({workspace, taskUtil, options = {}}) {
log.verbose("Collecting flexibility changes");
const allResources = await workspace.byGlob(
`${pathPrefix}/changes/*.{change,variant,ctrl_variant,ctrl_variant_change,ctrl_variant_management_change}`);
+
+ let bBundleCreated = false;
+
if (allResources.length > 0) {
const versionArray = await readManifestMinUI5Version();
const versions = versionArray.map((version) => semver.coerce(version));
@@ -109,9 +117,7 @@ export default async function({workspace, taskUtil, options = {}}) {
return workspace.write(resource);
}));
// Add the sap.ui.fl dependency if a bundle has been created
- if (processedResources.length > 0) {
- await updateFLdependency();
- }
+ bBundleCreated = processedResources.length > 0;
// Do not write bundled source files to build result
if (taskUtil) {
@@ -120,4 +126,7 @@ export default async function({workspace, taskUtil, options = {}}) {
});
}
}
+
+ // Always append the flexBundle flag to the manifest.json, even if no bundle was created
+ await updateManifestWithFlDependencyAndFlexBundleFlag(bBundleCreated);
}
diff --git a/packages/builder/test/expected/build/application.a/dest-deps-excl/manifest.json b/packages/builder/test/expected/build/application.a/dest-deps-excl/manifest.json
index 781945df9d..42cbc1d978 100644
--- a/packages/builder/test/expected/build/application.a/dest-deps-excl/manifest.json
+++ b/packages/builder/test/expected/build/application.a/dest-deps-excl/manifest.json
@@ -1,13 +1,18 @@
{
- "_version": "1.1.0",
- "sap.app": {
- "_version": "1.1.0",
- "id": "id1",
- "type": "application",
- "applicationVersion": {
- "version": "1.2.2"
- },
- "embeds": ["embedded"],
- "title": "{{title}}"
- }
+ "_version": "1.1.0",
+ "sap.app": {
+ "_version": "1.1.0",
+ "id": "id1",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.2.2"
+ },
+ "embeds": [
+ "embedded"
+ ],
+ "title": "{{title}}"
+ },
+ "sap.ui5": {
+ "flexBundle": false
+ }
}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.a/dest-deps/manifest.json b/packages/builder/test/expected/build/application.a/dest-deps/manifest.json
index 781945df9d..42cbc1d978 100644
--- a/packages/builder/test/expected/build/application.a/dest-deps/manifest.json
+++ b/packages/builder/test/expected/build/application.a/dest-deps/manifest.json
@@ -1,13 +1,18 @@
{
- "_version": "1.1.0",
- "sap.app": {
- "_version": "1.1.0",
- "id": "id1",
- "type": "application",
- "applicationVersion": {
- "version": "1.2.2"
- },
- "embeds": ["embedded"],
- "title": "{{title}}"
- }
+ "_version": "1.1.0",
+ "sap.app": {
+ "_version": "1.1.0",
+ "id": "id1",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.2.2"
+ },
+ "embeds": [
+ "embedded"
+ ],
+ "title": "{{title}}"
+ },
+ "sap.ui5": {
+ "flexBundle": false
+ }
}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.a/dest-depself/manifest.json b/packages/builder/test/expected/build/application.a/dest-depself/manifest.json
index 781945df9d..42cbc1d978 100644
--- a/packages/builder/test/expected/build/application.a/dest-depself/manifest.json
+++ b/packages/builder/test/expected/build/application.a/dest-depself/manifest.json
@@ -1,13 +1,18 @@
{
- "_version": "1.1.0",
- "sap.app": {
- "_version": "1.1.0",
- "id": "id1",
- "type": "application",
- "applicationVersion": {
- "version": "1.2.2"
- },
- "embeds": ["embedded"],
- "title": "{{title}}"
- }
+ "_version": "1.1.0",
+ "sap.app": {
+ "_version": "1.1.0",
+ "id": "id1",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.2.2"
+ },
+ "embeds": [
+ "embedded"
+ ],
+ "title": "{{title}}"
+ },
+ "sap.ui5": {
+ "flexBundle": false
+ }
}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.a/dest-depself/resources/sap-ui-custom.js b/packages/builder/test/expected/build/application.a/dest-depself/resources/sap-ui-custom.js
index caa9622986..4aa9f1948a 100644
--- a/packages/builder/test/expected/build/application.a/dest-depself/resources/sap-ui-custom.js
+++ b/packages/builder/test/expected/build/application.a/dest-depself/resources/sap-ui-custom.js
@@ -9,6 +9,6 @@ sap.ui.predefine("library/d/library", ["sap/ui/core/Lib","sap/ui/core/library"],
*/
sap.ui.predefine("library/d/some", ["./library"],l=>{var o="World";console.log("Hello "+o)});
sap.ui.require.preload({
- "id1/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"id1","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"}}'
+ "id1/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"id1","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"},"sap.ui5":{"flexBundle":false}}'
});
//# sourceMappingURL=sap-ui-custom.js.map
diff --git a/packages/builder/test/expected/build/application.a/dest-self/manifest.json b/packages/builder/test/expected/build/application.a/dest-self/manifest.json
index 781945df9d..42cbc1d978 100644
--- a/packages/builder/test/expected/build/application.a/dest-self/manifest.json
+++ b/packages/builder/test/expected/build/application.a/dest-self/manifest.json
@@ -1,13 +1,18 @@
{
- "_version": "1.1.0",
- "sap.app": {
- "_version": "1.1.0",
- "id": "id1",
- "type": "application",
- "applicationVersion": {
- "version": "1.2.2"
- },
- "embeds": ["embedded"],
- "title": "{{title}}"
- }
+ "_version": "1.1.0",
+ "sap.app": {
+ "_version": "1.1.0",
+ "id": "id1",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.2.2"
+ },
+ "embeds": [
+ "embedded"
+ ],
+ "title": "{{title}}"
+ },
+ "sap.ui5": {
+ "flexBundle": false
+ }
}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.a/dest-self/resources/sap-ui-custom.js b/packages/builder/test/expected/build/application.a/dest-self/resources/sap-ui-custom.js
index bfabf26857..0fcd9347c4 100644
--- a/packages/builder/test/expected/build/application.a/dest-self/resources/sap-ui-custom.js
+++ b/packages/builder/test/expected/build/application.a/dest-self/resources/sap-ui-custom.js
@@ -9,7 +9,7 @@ sap.ui.predefine("library/d/library", ["sap/ui/core/Lib","sap/ui/core/library"],
*/
sap.ui.predefine("library/d/some", ["./library"],l=>{var o="World";console.log("Hello "+o)});
sap.ui.require.preload({
- "id1/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"id1","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"}}',
+ "id1/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"id1","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"},"sap.ui5":{"flexBundle":false}}',
"library/d/manifest.json":'{"_version":"1.21.0","sap.app":{"id":"library.d","type":"library","embeds":[],"applicationVersion":{"version":"1.0.0"},"title":"Library D","description":"Library D","resources":"resources.json","offline":true},"sap.ui":{"technology":"UI5","supportedThemes":[]},"sap.ui5":{"dependencies":{"minUI5Version":"1.0","libs":{}},"library":{"i18n":false,"css":false,"content":{"controls":[],"elements":[],"types":[],"interfaces":[]}}}}'
});
//# sourceMappingURL=sap-ui-custom.js.map
diff --git a/packages/builder/test/expected/build/application.a/dest/manifest.json b/packages/builder/test/expected/build/application.a/dest/manifest.json
index 781945df9d..42cbc1d978 100644
--- a/packages/builder/test/expected/build/application.a/dest/manifest.json
+++ b/packages/builder/test/expected/build/application.a/dest/manifest.json
@@ -1,13 +1,18 @@
{
- "_version": "1.1.0",
- "sap.app": {
- "_version": "1.1.0",
- "id": "id1",
- "type": "application",
- "applicationVersion": {
- "version": "1.2.2"
- },
- "embeds": ["embedded"],
- "title": "{{title}}"
- }
+ "_version": "1.1.0",
+ "sap.app": {
+ "_version": "1.1.0",
+ "id": "id1",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.2.2"
+ },
+ "embeds": [
+ "embedded"
+ ],
+ "title": "{{title}}"
+ },
+ "sap.ui5": {
+ "flexBundle": false
+ }
}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.g/cachebuster/Component-preload.js b/packages/builder/test/expected/build/application.g/cachebuster/Component-preload.js
index 18f436dcbe..6e0b79459b 100644
--- a/packages/builder/test/expected/build/application.g/cachebuster/Component-preload.js
+++ b/packages/builder/test/expected/build/application.g/cachebuster/Component-preload.js
@@ -3,7 +3,7 @@ sap.ui.predefine("application/g/Component", ["sap/ui/core/UIComponent"],function
sap.ui.predefine("application/g/subcomponentA/Component", ["sap/ui/core/UIComponent"],function(n){"use strict";return n.extend("application.g.subcomponentA.Component",{metadata:{manifest:"json"}})});
sap.ui.predefine("application/g/subcomponentB/Component", ["sap/ui/core/UIComponent"],function(n){"use strict";return n.extend("application.g.subcomponentB.Component",{metadata:{manifest:"json"}})});
sap.ui.require.preload({
- "application/g/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.g","type":"application","applicationVersion":{"version":"1.0.0"},"embeds":["embedded"],"title":"{{title}}"},"customCopyrightString":"Some fancy copyright"}',
+ "application/g/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.g","type":"application","applicationVersion":{"version":"1.0.0"},"embeds":["embedded"],"title":"{{title}}"},"customCopyrightString":"Some fancy copyright","sap.ui5":{"flexBundle":false}}',
"application/g/subcomponentA/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.g.subcomponentA","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"}}',
"application/g/subcomponentB/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.g.subcomponentB","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"}}'
});
diff --git a/packages/builder/test/expected/build/application.g/cachebuster/manifest.json b/packages/builder/test/expected/build/application.g/cachebuster/manifest.json
index 6207053349..ff7f65f3f5 100644
--- a/packages/builder/test/expected/build/application.g/cachebuster/manifest.json
+++ b/packages/builder/test/expected/build/application.g/cachebuster/manifest.json
@@ -1,14 +1,19 @@
{
- "_version": "1.1.0",
- "sap.app": {
- "_version": "1.1.0",
- "id": "application.g",
- "type": "application",
- "applicationVersion": {
- "version": "1.0.0"
- },
- "embeds": ["embedded"],
- "title": "{{title}}"
- },
- "customCopyrightString": "Some fancy copyright"
-}
+ "_version": "1.1.0",
+ "sap.app": {
+ "_version": "1.1.0",
+ "id": "application.g",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.0.0"
+ },
+ "embeds": [
+ "embedded"
+ ],
+ "title": "{{title}}"
+ },
+ "customCopyrightString": "Some fancy copyright",
+ "sap.ui5": {
+ "flexBundle": false
+ }
+}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.g/cachebuster_hash/manifest.json b/packages/builder/test/expected/build/application.g/cachebuster_hash/manifest.json
index 6207053349..ff7f65f3f5 100644
--- a/packages/builder/test/expected/build/application.g/cachebuster_hash/manifest.json
+++ b/packages/builder/test/expected/build/application.g/cachebuster_hash/manifest.json
@@ -1,14 +1,19 @@
{
- "_version": "1.1.0",
- "sap.app": {
- "_version": "1.1.0",
- "id": "application.g",
- "type": "application",
- "applicationVersion": {
- "version": "1.0.0"
- },
- "embeds": ["embedded"],
- "title": "{{title}}"
- },
- "customCopyrightString": "Some fancy copyright"
-}
+ "_version": "1.1.0",
+ "sap.app": {
+ "_version": "1.1.0",
+ "id": "application.g",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.0.0"
+ },
+ "embeds": [
+ "embedded"
+ ],
+ "title": "{{title}}"
+ },
+ "customCopyrightString": "Some fancy copyright",
+ "sap.ui5": {
+ "flexBundle": false
+ }
+}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.g/dest/Component-preload.js b/packages/builder/test/expected/build/application.g/dest/Component-preload.js
index 762c8c3336..c8c652aa3a 100644
--- a/packages/builder/test/expected/build/application.g/dest/Component-preload.js
+++ b/packages/builder/test/expected/build/application.g/dest/Component-preload.js
@@ -1,6 +1,6 @@
//@ui5-bundle application/g/Component-preload.js
sap.ui.predefine("application/g/Component", ["sap/ui/core/UIComponent"],function(n){"use strict";return n.extend("application.g.Component",{metadata:{manifest:"json"}})});
sap.ui.require.preload({
- "application/g/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.g","type":"application","applicationVersion":{"version":"1.0.0"},"embeds":["embedded"],"title":"{{title}}"},"customCopyrightString":"Some fancy copyright"}'
+ "application/g/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.g","type":"application","applicationVersion":{"version":"1.0.0"},"embeds":["embedded"],"title":"{{title}}"},"customCopyrightString":"Some fancy copyright","sap.ui5":{"flexBundle":false}}'
});
//# sourceMappingURL=Component-preload.js.map
diff --git a/packages/builder/test/expected/build/application.g/dest/manifest.json b/packages/builder/test/expected/build/application.g/dest/manifest.json
index 6207053349..ff7f65f3f5 100644
--- a/packages/builder/test/expected/build/application.g/dest/manifest.json
+++ b/packages/builder/test/expected/build/application.g/dest/manifest.json
@@ -1,14 +1,19 @@
{
- "_version": "1.1.0",
- "sap.app": {
- "_version": "1.1.0",
- "id": "application.g",
- "type": "application",
- "applicationVersion": {
- "version": "1.0.0"
- },
- "embeds": ["embedded"],
- "title": "{{title}}"
- },
- "customCopyrightString": "Some fancy copyright"
-}
+ "_version": "1.1.0",
+ "sap.app": {
+ "_version": "1.1.0",
+ "id": "application.g",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.0.0"
+ },
+ "embeds": [
+ "embedded"
+ ],
+ "title": "{{title}}"
+ },
+ "customCopyrightString": "Some fancy copyright",
+ "sap.ui5": {
+ "flexBundle": false
+ }
+}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.g/dest2/Component-preload.js b/packages/builder/test/expected/build/application.g/dest2/Component-preload.js
index 762c8c3336..c8c652aa3a 100644
--- a/packages/builder/test/expected/build/application.g/dest2/Component-preload.js
+++ b/packages/builder/test/expected/build/application.g/dest2/Component-preload.js
@@ -1,6 +1,6 @@
//@ui5-bundle application/g/Component-preload.js
sap.ui.predefine("application/g/Component", ["sap/ui/core/UIComponent"],function(n){"use strict";return n.extend("application.g.Component",{metadata:{manifest:"json"}})});
sap.ui.require.preload({
- "application/g/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.g","type":"application","applicationVersion":{"version":"1.0.0"},"embeds":["embedded"],"title":"{{title}}"},"customCopyrightString":"Some fancy copyright"}'
+ "application/g/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.g","type":"application","applicationVersion":{"version":"1.0.0"},"embeds":["embedded"],"title":"{{title}}"},"customCopyrightString":"Some fancy copyright","sap.ui5":{"flexBundle":false}}'
});
//# sourceMappingURL=Component-preload.js.map
diff --git a/packages/builder/test/expected/build/application.h/dest/manifest.json b/packages/builder/test/expected/build/application.h/dest/manifest.json
index 32b7e4a845..0443c1beaf 100644
--- a/packages/builder/test/expected/build/application.h/dest/manifest.json
+++ b/packages/builder/test/expected/build/application.h/dest/manifest.json
@@ -1,13 +1,18 @@
{
- "_version": "1.1.0",
- "sap.app": {
- "_version": "1.1.0",
- "id": "application.h",
- "type": "application",
- "applicationVersion": {
- "version": "1.2.2"
- },
- "embeds": ["embedded"],
- "title": "{{title}}"
- }
-}
+ "_version": "1.1.0",
+ "sap.app": {
+ "_version": "1.1.0",
+ "id": "application.h",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.2.2"
+ },
+ "embeds": [
+ "embedded"
+ ],
+ "title": "{{title}}"
+ },
+ "sap.ui5": {
+ "flexBundle": false
+ }
+}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.h/no-minify/manifest.json b/packages/builder/test/expected/build/application.h/no-minify/manifest.json
index 32b7e4a845..0443c1beaf 100644
--- a/packages/builder/test/expected/build/application.h/no-minify/manifest.json
+++ b/packages/builder/test/expected/build/application.h/no-minify/manifest.json
@@ -1,13 +1,18 @@
{
- "_version": "1.1.0",
- "sap.app": {
- "_version": "1.1.0",
- "id": "application.h",
- "type": "application",
- "applicationVersion": {
- "version": "1.2.2"
- },
- "embeds": ["embedded"],
- "title": "{{title}}"
- }
-}
+ "_version": "1.1.0",
+ "sap.app": {
+ "_version": "1.1.0",
+ "id": "application.h",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.2.2"
+ },
+ "embeds": [
+ "embedded"
+ ],
+ "title": "{{title}}"
+ },
+ "sap.ui5": {
+ "flexBundle": false
+ }
+}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.i/dest/Component-preload.js b/packages/builder/test/expected/build/application.i/dest/Component-preload.js
index c75c4d9080..2cc125be73 100644
--- a/packages/builder/test/expected/build/application.i/dest/Component-preload.js
+++ b/packages/builder/test/expected/build/application.i/dest/Component-preload.js
@@ -4,6 +4,6 @@ sap.ui.predefine("application/i/changes/coding/MyExtension", [],function(){retur
sap.ui.require.preload({
"application/i/changes/changes-bundle.json":'[{"fileName":"id_456_addField","fileType":"change","changeType":"hideControl","component":"application.i.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.i.Component/changes","creation":"2023-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"}},{"fileName":"id_123_addField","fileType":"change","changeType":"hideControl","component":"application.i.Component","content":{},"selector":{"id":"control1"},"layer":"CUSTOMER","texts":{},"namespace":"apps/application.i.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"Max Mustermann"}}]',
"application/i/changes/fragments/MyFragment.fragment.xml":'',
- "application/i/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.i","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"},"sap.ui5":{"dependencies":{"minUI5Version":"1.72","libs":{"sap.ui.layout":{},"sap.ui.core":{},"sap.m":{},"sap.ui.fl":{}}}}}'
+ "application/i/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.i","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"},"sap.ui5":{"dependencies":{"minUI5Version":"1.72","libs":{"sap.ui.layout":{},"sap.ui.core":{},"sap.m":{},"sap.ui.fl":{}}},"flexBundle":true}}'
});
//# sourceMappingURL=Component-preload.js.map
diff --git a/packages/builder/test/expected/build/application.i/dest/manifest.json b/packages/builder/test/expected/build/application.i/dest/manifest.json
index b40142f304..129073297a 100644
--- a/packages/builder/test/expected/build/application.i/dest/manifest.json
+++ b/packages/builder/test/expected/build/application.i/dest/manifest.json
@@ -21,6 +21,7 @@
"sap.m": {},
"sap.ui.fl": {}
}
- }
+ },
+ "flexBundle": true
}
}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.j/dest-resources-json/Component-preload.js b/packages/builder/test/expected/build/application.j/dest-resources-json/Component-preload.js
index 58f6a5a471..be5f817d88 100644
--- a/packages/builder/test/expected/build/application.j/dest-resources-json/Component-preload.js
+++ b/packages/builder/test/expected/build/application.j/dest-resources-json/Component-preload.js
@@ -4,6 +4,6 @@ sap.ui.predefine("application/j/changes/coding/MyExtension", [],function(){retur
sap.ui.require.preload({
"application/j/changes/flexibility-bundle.json":'{"changes":[{"fileName":"id_456_addField","fileType":"change","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2023-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"}},{"fileName":"id_123_addField","fileType":"change","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"CUSTOMER","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"Max Mustermann"}}],"compVariants":[{"fileName":"id_111_compVariants","fileType":"variant","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"},"appDescriptorChange":false}],"variants":[{"fileName":"id_111_test","fileType":"ctrl_variant","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"}}],"variantChanges":[{"fileName":"id_111_test","fileType":"ctrl_variant_change","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"}}],"variantDependentControlChanges":[{"fileName":"id_111_variantDependentControlChange","fileType":"change","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"},"variantReference":"someting here"}],"variantManagementChanges":[{"fileName":"id_111_test","fileType":"ctrl_variant_management_change","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"}}]}',
"application/j/changes/fragments/MyFragment.fragment.xml":'',
- "application/j/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.j","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"},"sap.ui5":{"dependencies":{"minUI5Version":"1.100.2","libs":{"sap.ui.layout":{},"sap.ui.core":{},"sap.m":{},"sap.ui.fl":{"lazy":false}}}}}'
+ "application/j/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.j","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"},"sap.ui5":{"dependencies":{"minUI5Version":"1.100.2","libs":{"sap.ui.layout":{},"sap.ui.core":{},"sap.m":{},"sap.ui.fl":{"lazy":false}}},"flexBundle":true}}'
});
//# sourceMappingURL=Component-preload.js.map
diff --git a/packages/builder/test/expected/build/application.j/dest-resources-json/manifest.json b/packages/builder/test/expected/build/application.j/dest-resources-json/manifest.json
index e9fe49460e..f2892efcfc 100644
--- a/packages/builder/test/expected/build/application.j/dest-resources-json/manifest.json
+++ b/packages/builder/test/expected/build/application.j/dest-resources-json/manifest.json
@@ -23,6 +23,7 @@
"lazy": false
}
}
- }
+ },
+ "flexBundle": true
}
}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.j/dest-resources-json/resources.json b/packages/builder/test/expected/build/application.j/dest-resources-json/resources.json
index 291f07a2f8..cbca97c357 100644
--- a/packages/builder/test/expected/build/application.j/dest-resources-json/resources.json
+++ b/packages/builder/test/expected/build/application.j/dest-resources-json/resources.json
@@ -17,7 +17,7 @@
{
"name": "Component-preload.js",
"module": "application/j/Component-preload.js",
- "size": 3658,
+ "size": 3676,
"merged": true,
"required": [
"sap/m/library.js",
@@ -89,7 +89,7 @@
{
"name": "manifest.json",
"module": "application/j/manifest.json",
- "size": 424
+ "size": 446
},
{
"name": "resources.json",
diff --git a/packages/builder/test/expected/build/application.j/dest/Component-preload.js b/packages/builder/test/expected/build/application.j/dest/Component-preload.js
index 58f6a5a471..be5f817d88 100644
--- a/packages/builder/test/expected/build/application.j/dest/Component-preload.js
+++ b/packages/builder/test/expected/build/application.j/dest/Component-preload.js
@@ -4,6 +4,6 @@ sap.ui.predefine("application/j/changes/coding/MyExtension", [],function(){retur
sap.ui.require.preload({
"application/j/changes/flexibility-bundle.json":'{"changes":[{"fileName":"id_456_addField","fileType":"change","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2023-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"}},{"fileName":"id_123_addField","fileType":"change","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"CUSTOMER","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"Max Mustermann"}}],"compVariants":[{"fileName":"id_111_compVariants","fileType":"variant","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"},"appDescriptorChange":false}],"variants":[{"fileName":"id_111_test","fileType":"ctrl_variant","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"}}],"variantChanges":[{"fileName":"id_111_test","fileType":"ctrl_variant_change","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"}}],"variantDependentControlChanges":[{"fileName":"id_111_variantDependentControlChange","fileType":"change","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"},"variantReference":"someting here"}],"variantManagementChanges":[{"fileName":"id_111_test","fileType":"ctrl_variant_management_change","changeType":"hideControl","component":"application.j.Component","content":{},"selector":{"id":"control1"},"layer":"VENDOR","texts":{},"namespace":"apps/application.j.Component/changes","creation":"2025-10-30T13:52:40.4754350Z","originalLanguage":"","conditions":{},"support":{"generator":"did it","user":"SAP"}}]}',
"application/j/changes/fragments/MyFragment.fragment.xml":'',
- "application/j/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.j","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"},"sap.ui5":{"dependencies":{"minUI5Version":"1.100.2","libs":{"sap.ui.layout":{},"sap.ui.core":{},"sap.m":{},"sap.ui.fl":{"lazy":false}}}}}'
+ "application/j/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.j","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"},"sap.ui5":{"dependencies":{"minUI5Version":"1.100.2","libs":{"sap.ui.layout":{},"sap.ui.core":{},"sap.m":{},"sap.ui.fl":{"lazy":false}}},"flexBundle":true}}'
});
//# sourceMappingURL=Component-preload.js.map
diff --git a/packages/builder/test/expected/build/application.j/dest/manifest.json b/packages/builder/test/expected/build/application.j/dest/manifest.json
index e9fe49460e..f2892efcfc 100644
--- a/packages/builder/test/expected/build/application.j/dest/manifest.json
+++ b/packages/builder/test/expected/build/application.j/dest/manifest.json
@@ -23,6 +23,7 @@
"lazy": false
}
}
- }
+ },
+ "flexBundle": true
}
}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.l/dest/manifest.json b/packages/builder/test/expected/build/application.l/dest/manifest.json
index 2e0d63d4ec..6e0898d776 100644
--- a/packages/builder/test/expected/build/application.l/dest/manifest.json
+++ b/packages/builder/test/expected/build/application.l/dest/manifest.json
@@ -1,13 +1,18 @@
{
- "_version": "1.1.0",
- "sap.app": {
- "_version": "1.1.0",
- "id": "application.l",
- "type": "application",
- "applicationVersion": {
- "version": "1.0.0"
- },
- "embeds": ["embedded"],
- "title": "{{title}}"
- }
-}
+ "_version": "1.1.0",
+ "sap.app": {
+ "_version": "1.1.0",
+ "id": "application.l",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.0.0"
+ },
+ "embeds": [
+ "embedded"
+ ],
+ "title": "{{title}}"
+ },
+ "sap.ui5": {
+ "flexBundle": false
+ }
+}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.m/dest/Component-preload.js b/packages/builder/test/expected/build/application.m/dest/Component-preload.js
index 836b02aafd..9234bece0e 100644
--- a/packages/builder/test/expected/build/application.m/dest/Component-preload.js
+++ b/packages/builder/test/expected/build/application.m/dest/Component-preload.js
@@ -3,6 +3,6 @@ sap.ui.predefine("application/m/Component", ["sap/ui/core/UIComponent","sap/ui/c
sap.ui.predefine("application/m/MyView", ["sap/ui/core/mvc/View","sap/m/Button"],(t,e)=>{"use strict";return t.extend("application.m.MyView",{async createContent(){return new e({id:this.createId("myButton"),text:"My Button"})}})});
sap.ui.require.preload({
- "application/m/manifest.json":'{"_version":"1.21.0","sap.app":{"id":"application.m","type":"application","applicationVersion":{"version":"1.0.0"}},"sap.ui5":{"contentDensities":{"compact":true,"cozy":true},"dependencies":{"minUI5Version":"1.108.0","libs":{"sap.ui.core":{},"sap.m":{}}}}}'
+ "application/m/manifest.json":'{"_version":"1.21.0","sap.app":{"id":"application.m","type":"application","applicationVersion":{"version":"1.0.0"}},"sap.ui5":{"contentDensities":{"compact":true,"cozy":true},"dependencies":{"minUI5Version":"1.108.0","libs":{"sap.ui.core":{},"sap.m":{}}},"flexBundle":false}}'
});
//# sourceMappingURL=Component-preload.js.map
diff --git a/packages/builder/test/expected/build/application.m/dest/manifest.json b/packages/builder/test/expected/build/application.m/dest/manifest.json
index 32aa479477..e05bf77581 100644
--- a/packages/builder/test/expected/build/application.m/dest/manifest.json
+++ b/packages/builder/test/expected/build/application.m/dest/manifest.json
@@ -18,6 +18,7 @@
"sap.ui.core": {},
"sap.m": {}
}
- }
+ },
+ "flexBundle": false
}
-}
+}
\ No newline at end of file
diff --git a/packages/builder/test/expected/build/application.o/dest/Component-preload.js b/packages/builder/test/expected/build/application.o/dest/Component-preload.js
index bb7adb35c1..fb4a1ffdfa 100644
--- a/packages/builder/test/expected/build/application.o/dest/Component-preload.js
+++ b/packages/builder/test/expected/build/application.o/dest/Component-preload.js
@@ -5,6 +5,6 @@ sap.ui.require.preload({
"application/o/i18n/i18n_en.properties":'welcome=Hello EN world',
"application/o/i18n/i18n_en_US.properties":'welcome=Hello EN US world',
"application/o/i18n/i18n_en_US_saptrc.properties":'welcome=Hello EN US saptrc world',
- "application/o/manifest.json":'{"_version":"1.22.0","sap.app":{"id":"application.o","type":"application","applicationVersion":{"version":"1.0.0"},"title":"{{title}}","i18n":{"bundleUrl":"i18n/i18n.properties","supportedLocales":["","en","en-US","en-US-x-saptrc"]}},"sap.ui5":{"models":{"i18n":{"type":"sap.ui.model.resource.ResourceModel","settings":{"bundleName":"application.o.i18n.i18n","supportedLocales":["","en","en-US","en-US-x-saptrc"]}},"i18n-ui5":{"type":"sap.ui.model.resource.ResourceModel","settings":{"bundleUrl":"ui5://application/o/i18n/i18n.properties","supportedLocales":["","en","en-US","en-US-x-saptrc"]}}}}}'
+ "application/o/manifest.json":'{"_version":"1.22.0","sap.app":{"id":"application.o","type":"application","applicationVersion":{"version":"1.0.0"},"title":"{{title}}","i18n":{"bundleUrl":"i18n/i18n.properties","supportedLocales":["","en","en-US","en-US-x-saptrc"]}},"sap.ui5":{"models":{"i18n":{"type":"sap.ui.model.resource.ResourceModel","settings":{"bundleName":"application.o.i18n.i18n","supportedLocales":["","en","en-US","en-US-x-saptrc"]}},"i18n-ui5":{"type":"sap.ui.model.resource.ResourceModel","settings":{"bundleUrl":"ui5://application/o/i18n/i18n.properties","supportedLocales":["","en","en-US","en-US-x-saptrc"]}}},"flexBundle":false}}'
});
//# sourceMappingURL=Component-preload.js.map
diff --git a/packages/builder/test/expected/build/application.o/dest/manifest.json b/packages/builder/test/expected/build/application.o/dest/manifest.json
index 8ca7437348..e5bb0a8f3d 100644
--- a/packages/builder/test/expected/build/application.o/dest/manifest.json
+++ b/packages/builder/test/expected/build/application.o/dest/manifest.json
@@ -1,48 +1,49 @@
{
- "_version": "1.22.0",
- "sap.app": {
- "id": "application.o",
- "type": "application",
- "applicationVersion": {
- "version": "1.0.0"
- },
- "title": "{{title}}",
- "i18n": {
- "bundleUrl": "i18n/i18n.properties",
- "supportedLocales": [
- "",
- "en",
- "en-US",
- "en-US-x-saptrc"
- ]
- }
- },
- "sap.ui5": {
- "models": {
- "i18n": {
- "type": "sap.ui.model.resource.ResourceModel",
- "settings": {
- "bundleName": "application.o.i18n.i18n",
- "supportedLocales": [
- "",
- "en",
- "en-US",
- "en-US-x-saptrc"
- ]
- }
- },
- "i18n-ui5": {
- "type": "sap.ui.model.resource.ResourceModel",
- "settings": {
- "bundleUrl": "ui5://application/o/i18n/i18n.properties",
- "supportedLocales": [
- "",
- "en",
- "en-US",
- "en-US-x-saptrc"
- ]
- }
- }
- }
- }
+ "_version": "1.22.0",
+ "sap.app": {
+ "id": "application.o",
+ "type": "application",
+ "applicationVersion": {
+ "version": "1.0.0"
+ },
+ "title": "{{title}}",
+ "i18n": {
+ "bundleUrl": "i18n/i18n.properties",
+ "supportedLocales": [
+ "",
+ "en",
+ "en-US",
+ "en-US-x-saptrc"
+ ]
+ }
+ },
+ "sap.ui5": {
+ "models": {
+ "i18n": {
+ "type": "sap.ui.model.resource.ResourceModel",
+ "settings": {
+ "bundleName": "application.o.i18n.i18n",
+ "supportedLocales": [
+ "",
+ "en",
+ "en-US",
+ "en-US-x-saptrc"
+ ]
+ }
+ },
+ "i18n-ui5": {
+ "type": "sap.ui.model.resource.ResourceModel",
+ "settings": {
+ "bundleUrl": "ui5://application/o/i18n/i18n.properties",
+ "supportedLocales": [
+ "",
+ "en",
+ "en-US",
+ "en-US-x-saptrc"
+ ]
+ }
+ }
+ },
+ "flexBundle": false
+ }
}
\ No newline at end of file
diff --git "a/packages/builder/test/expected/build/application.\303\270/dest/Component-preload.js" "b/packages/builder/test/expected/build/application.\303\270/dest/Component-preload.js"
index b813d8e3ff..f19bee7c47 100644
--- "a/packages/builder/test/expected/build/application.\303\270/dest/Component-preload.js"
+++ "b/packages/builder/test/expected/build/application.\303\270/dest/Component-preload.js"
@@ -1,6 +1,6 @@
//@ui5-bundle application/ø/Component-preload.js
sap.ui.predefine("application/ø/Component", ["sap/ui/core/UIComponent"],function(n){"use strict";return n.extend("application.ø.Component",{metadata:{manifest:"json"}})});
sap.ui.require.preload({
- "application/ø/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.ø","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"},"sap.ui5":{"dependencies":{"minUI5Version":"1.73.2","libs":{"sap.ui.core":{}}}}}'
+ "application/ø/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.ø","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"},"sap.ui5":{"dependencies":{"minUI5Version":"1.73.2","libs":{"sap.ui.core":{}}},"flexBundle":false}}'
});
//# sourceMappingURL=Component-preload.js.map
diff --git "a/packages/builder/test/expected/build/application.\303\270/dest/manifest.json" "b/packages/builder/test/expected/build/application.\303\270/dest/manifest.json"
index 435adbfeb7..c06085dddd 100644
--- "a/packages/builder/test/expected/build/application.\303\270/dest/manifest.json"
+++ "b/packages/builder/test/expected/build/application.\303\270/dest/manifest.json"
@@ -7,7 +7,9 @@
"applicationVersion": {
"version": "1.2.2"
},
- "embeds": ["embedded"],
+ "embeds": [
+ "embedded"
+ ],
"title": "{{title}}"
},
"sap.ui5": {
@@ -16,6 +18,7 @@
"libs": {
"sap.ui.core": {}
}
- }
+ },
+ "flexBundle": false
}
-}
+}
\ No newline at end of file
diff --git a/packages/builder/test/lib/tasks/bundlers/generateFlexChangesBundle.js b/packages/builder/test/lib/tasks/bundlers/generateFlexChangesBundle.js
index 700adb3726..6acd5e128f 100644
--- a/packages/builder/test/lib/tasks/bundlers/generateFlexChangesBundle.js
+++ b/packages/builder/test/lib/tasks/bundlers/generateFlexChangesBundle.js
@@ -3,18 +3,22 @@ import sinon from "sinon";
import generateFlexChangesBundle from "../../../../lib/tasks/bundlers/generateFlexChangesBundle.js";
-function createPlaceholderResource(content) {
+function createPlaceholderResource(content, path = "unknown") {
+ let currentContent = content;
return {
name: "file",
- getBuffer: async () => JSON.stringify(content),
- getString: () => JSON.stringify(content),
- setString: (string) => undefined
+ getBuffer: async () => JSON.stringify(currentContent),
+ getString: () => JSON.stringify(currentContent),
+ setString: (string) => {
+ currentContent = JSON.parse(string);
+ },
+ getPath: () => path
};
}
function createPlaceholderWorkspace(changes, manifest, flexBundle) {
return {
- byGlob: async (path) => changes.map(createPlaceholderResource),
+ byGlob: async () => changes.map(createPlaceholderResource),
byPath: async (path) => {
if ( path.includes("manifest.json") ) {
return createPlaceholderResource(manifest);
@@ -151,6 +155,19 @@ function createPlaceholderWorkspace(changes, manifest, flexBundle) {
const path = await stub.getCall(0).args[0].getPath();
t.is(path, "/resources/mypath/changes/flexibility-bundle.json");
+
+ const writtenManifest = JSON.parse(await stub.getCall(1).args[0].getString());
+ t.deepEqual(writtenManifest, {
+ "sap.ui5": {
+ dependencies: {
+ minUI5Version: minVersion,
+ libs: {
+ "sap.ui.fl": {}
+ }
+ },
+ flexBundle: true
+ }
+ }, "Result must contain the same content");
});
});
@@ -232,3 +249,333 @@ function createPlaceholderWorkspace(changes, manifest, flexBundle) {
t.is(path, "/resources/mypath/changes/changes-bundle.json");
});
});
+
+test("flexBundle property set to true when bundle is created", async (t) => {
+ const manifest = {
+ "_version": "1.58.0",
+ "sap.app": {
+ "id": "sap.ui.demo.app",
+ "type": "application"
+ },
+ "sap.ui5": {
+ "dependencies": {
+ "minUI5Version": "1.75.0"
+ }
+ }
+ };
+
+ const changeList = [{
+ "fileName": "test_change",
+ "fileType": "change",
+ "changeType": "rename",
+ "reference": "test.Component",
+ "content": {},
+ "selector": {"id": "testId"},
+ "layer": "CUSTOMER"
+ }];
+
+ const placeholderWorkspace = {
+ byGlob: async () => changeList.map(createPlaceholderResource),
+ byPath: async (path) => {
+ if (path.includes("manifest.json")) {
+ return createPlaceholderResource(manifest, path);
+ } else if (path.includes("flexibility-bundle.json")) {
+ // Return non-null to indicate file exists
+ return createPlaceholderResource({}, path);
+ }
+ return null;
+ },
+ write: sinon.stub().returnsArg(0)
+ };
+
+ await generateFlexChangesBundle({
+ workspace: placeholderWorkspace,
+ taskUtil: false,
+ options: {
+ projectNamespace: "sap/ui/demo/app"
+ }
+ });
+
+ // Check that manifest was updated with flexBundle: true
+ t.true(placeholderWorkspace.write.callCount > 0, "workspace.write should be called");
+
+ // Find the manifest write call
+ let manifestCall;
+ for (let i = 0; i < placeholderWorkspace.write.callCount; i++) {
+ const call = placeholderWorkspace.write.getCall(i);
+ const path = call.args[0].getPath ? await call.args[0].getPath() : "unknown";
+ if (path && path.includes("manifest.json")) {
+ manifestCall = call;
+ break;
+ }
+ }
+
+ t.truthy(manifestCall, "Manifest should be written");
+ const manifestContent = JSON.parse(await manifestCall.args[0].getString());
+
+ t.truthy(manifestContent["sap.ui5"], "sap.ui5 section should exist");
+ t.true(manifestContent["sap.ui5"].flexBundle, "flexBundle should be set to true when bundle is created");
+ t.deepEqual(manifestContent["sap.ui5"].dependencies.libs["sap.ui.fl"], {}, "sap.ui.fl dependency should be added");
+});
+
+test("flexBundle property set to true when bundle is created even without existing flexibility-bundle.json",
+ async (t) => {
+ const manifest = {
+ "_version": "1.58.0",
+ "sap.app": {
+ "id": "sap.ui.demo.app",
+ "type": "application"
+ },
+ "sap.ui5": {
+ "dependencies": {
+ "minUI5Version": "1.75.0"
+ }
+ }
+ };
+
+ const changeList = [{
+ "fileName": "test_change",
+ "fileType": "change",
+ "changeType": "rename",
+ "reference": "test.Component",
+ "content": {},
+ "selector": {"id": "testId"},
+ "layer": "CUSTOMER"
+ }];
+
+ const placeholderWorkspace = {
+ byGlob: async () => changeList.map(createPlaceholderResource),
+ byPath: async (path) => {
+ if (path.includes("manifest.json")) {
+ return createPlaceholderResource(manifest, path);
+ } else if (path.includes("flexibility-bundle.json")) {
+ // Return null to indicate file does not exist
+ return null;
+ }
+ return null;
+ },
+ write: sinon.stub().returnsArg(0)
+ };
+
+ await generateFlexChangesBundle({
+ workspace: placeholderWorkspace,
+ taskUtil: false,
+ options: {
+ projectNamespace: "sap/ui/demo/app"
+ }
+ });
+
+ // Check that manifest was updated with flexBundle: true
+ t.true(placeholderWorkspace.write.callCount > 0, "workspace.write should be called");
+
+ // Find the manifest write call
+ let manifestCall;
+ for (let i = 0; i < placeholderWorkspace.write.callCount; i++) {
+ const call = placeholderWorkspace.write.getCall(i);
+ const path = call.args[0].getPath ? await call.args[0].getPath() : "unknown";
+ if (path && path.includes("manifest.json")) {
+ manifestCall = call;
+ break;
+ }
+ }
+
+ t.truthy(manifestCall, "Manifest should be written");
+ const manifestContent = JSON.parse(await manifestCall.args[0].getString());
+
+ t.truthy(manifestContent["sap.ui5"], "sap.ui5 section should exist");
+ t.true(manifestContent["sap.ui5"].flexBundle, "flexBundle should be set to true when bundle is created");
+ t.deepEqual(
+ manifestContent["sap.ui5"].dependencies.libs["sap.ui.fl"], {}, "sap.ui.fl dependency should be added");
+ });
+
+test("sap.ui.fl dependency disables lazy loading if already present", async (t) => {
+ const manifest = {
+ "_version": "1.58.0",
+ "sap.app": {
+ "id": "sap.ui.demo.app",
+ "type": "application"
+ },
+ "sap.ui5": {
+ "dependencies": {
+ "minUI5Version": "1.75.0",
+ "libs": {
+ "sap.ui.fl": {
+ "lazy": true
+ }
+ }
+ }
+ }
+ };
+
+ const changeList = [{
+ "fileName": "test_change",
+ "fileType": "change",
+ "changeType": "rename",
+ "reference": "test.Component",
+ "content": {},
+ "selector": {"id": "testId"},
+ "layer": "CUSTOMER"
+ }];
+
+ const placeholderWorkspace = {
+ byGlob: async () => changeList.map((change) => createPlaceholderResource(change)),
+ byPath: async (path) => {
+ if (path.includes("manifest.json")) {
+ return createPlaceholderResource(manifest, path);
+ } else if (path.includes("flexibility-bundle.json")) {
+ return createPlaceholderResource({}, path);
+ }
+ return null;
+ },
+ write: sinon.stub().returnsArg(0)
+ };
+
+ await generateFlexChangesBundle({
+ workspace: placeholderWorkspace,
+ taskUtil: false,
+ options: {
+ projectNamespace: "sap/ui/demo/app"
+ }
+ });
+
+ // Find the manifest write call
+ let manifestCall;
+ for (let i = 0; i < placeholderWorkspace.write.callCount; i++) {
+ const call = placeholderWorkspace.write.getCall(i);
+ const path = call.args[0].getPath ? await call.args[0].getPath() : "unknown";
+ if (path && path.includes("manifest.json")) {
+ manifestCall = call;
+ break;
+ }
+ }
+
+ t.truthy(manifestCall, "Manifest should be written");
+ const manifestContent = JSON.parse(await manifestCall.args[0].getString());
+
+ const sapUiFlDependency = manifestContent["sap.ui5"].dependencies.libs["sap.ui.fl"];
+ t.false(sapUiFlDependency.lazy, "sap.ui.fl lazy loading should be disabled when bundle is created");
+});
+
+test("manifest updated with flexBundle false when no changes exist", async (t) => {
+ const manifest = {
+ "_version": "1.58.0",
+ "sap.app": {
+ "id": "sap.ui.demo.app",
+ "type": "application"
+ },
+ "sap.ui5": {
+ "dependencies": {
+ "minUI5Version": "1.75.0"
+ }
+ }
+ };
+
+ const placeholderWorkspace = {
+ byGlob: async () => [], // No changes
+ byPath: async (path) => {
+ if (path.includes("manifest.json")) {
+ return createPlaceholderResource(manifest, path);
+ } else if (path.includes("flexibility-bundle.json")) {
+ // Even if file exists, task won't run without changes
+ return createPlaceholderResource({}, path);
+ }
+ return null;
+ },
+ write: sinon.stub().returnsArg(0)
+ };
+
+ await generateFlexChangesBundle({
+ workspace: placeholderWorkspace,
+ taskUtil: false,
+ options: {
+ projectNamespace: "sap/ui/demo/app"
+ }
+ });
+
+ // Manifest should always be updated, even when no changes exist
+ t.is(placeholderWorkspace.write.callCount, 1, "workspace.write should be called to update manifest");
+
+ // Find the manifest write call
+ let manifestCall;
+ for (let i = 0; i < placeholderWorkspace.write.callCount; i++) {
+ const call = placeholderWorkspace.write.getCall(i);
+ const path = call.args[0].getPath ? await call.args[0].getPath() : "unknown";
+ if (path && path.includes("manifest.json")) {
+ manifestCall = call;
+ break;
+ }
+ }
+
+ t.truthy(manifestCall, "Manifest should be written");
+ const manifestContent = JSON.parse(await manifestCall.args[0].getString());
+
+ t.truthy(manifestContent["sap.ui5"], "sap.ui5 section should exist");
+ t.false(manifestContent["sap.ui5"].flexBundle, "flexBundle should be set to false when no bundle is created");
+ t.is(manifestContent["sap.ui5"].dependencies.libs, undefined,
+ "sap.ui.fl dependency should not be added when no bundle is created");
+});
+
+test("flexBundle property overrides existing value when bundle is created", async (t) => {
+ const manifest = {
+ "_version": "1.58.0",
+ "sap.app": {
+ "id": "sap.ui.demo.app",
+ "type": "application"
+ },
+ "sap.ui5": {
+ "dependencies": {
+ "minUI5Version": "1.75.0"
+ },
+ "flexBundle": false // Pre-existing value that should be overridden
+ }
+ };
+
+ const changeList = [{
+ "fileName": "test_change",
+ "fileType": "change",
+ "changeType": "rename",
+ "reference": "test.Component",
+ "content": {},
+ "selector": {"id": "testId"},
+ "layer": "CUSTOMER"
+ }];
+
+ const placeholderWorkspace = {
+ byGlob: async () => changeList.map((change) => createPlaceholderResource(change)),
+ byPath: async (path) => {
+ if (path.includes("manifest.json")) {
+ return createPlaceholderResource(manifest, path);
+ } else if (path.includes("flexibility-bundle.json")) {
+ // Return non-null to indicate file exists
+ return createPlaceholderResource({}, path);
+ }
+ return null;
+ },
+ write: sinon.stub().returnsArg(0)
+ };
+
+ await generateFlexChangesBundle({
+ workspace: placeholderWorkspace,
+ taskUtil: false,
+ options: {
+ projectNamespace: "sap/ui/demo/app"
+ }
+ });
+
+ // Check that manifest was updated and existing flexBundle: false was overridden to true
+ let manifestCall;
+ for (let i = 0; i < placeholderWorkspace.write.callCount; i++) {
+ const call = placeholderWorkspace.write.getCall(i);
+ const path = call.args[0].getPath ? await call.args[0].getPath() : "unknown";
+ if (path && path.includes("manifest.json")) {
+ manifestCall = call;
+ break;
+ }
+ }
+
+ t.truthy(manifestCall, "Manifest should be written");
+ const manifestContent = JSON.parse(await manifestCall.args[0].getString());
+
+ t.true(manifestContent["sap.ui5"].flexBundle, "flexBundle should be overridden to true when bundle is created");
+ t.deepEqual(manifestContent["sap.ui5"].dependencies.libs["sap.ui.fl"], {}, "sap.ui.fl dependency should be added");
+});