Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 1 addition & 31 deletions packages/builder/lib/processors/manifestCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,42 +352,12 @@ async function createManifest(
}
}

function collectThemes() {
const themes = Object.create(null);

// find theme resources and determine theme names from their paths
libBundle.getResources(/(?:[^/]+\/)*themes\//).forEach((res) => {
if ( !res.getPath().startsWith(libraryPathPrefix + "themes/") ) {
// only consider themes within direct "themes" sub-directory
return;
}
const match = /\/themes\/([^/]+)\//.exec(res.getPath());
if ( match ) {
themes[match[1]] = true;
}
});

// merge with supportedTheme info from .library file
const elems = findChildren(manifestAppData, "supportedTheme");
if ( elems ) {
elems.forEach((elem) => {
if ( elem._ ) {
themes[elem._];
}
});
}
return Object.keys(themes).sort();
}

const sapUi = {
_version: sectionVersion(APP_DESCRIPTOR_V3_OTHER_SECTIONS),
technology: "UI5",
deviceTypes: deviceTypes(),
supportedThemes: collectThemes()
deviceTypes: deviceTypes()
};

log.verbose(` sap.ui/supportedThemes determined from resources: '${sapUi.supportedThemes.join(", ")}'`);

return sapUi;
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
{
"name": "manifest.json",
"module": "library/h/manifest.json",
"size": 614
"size": 587
},
{
"name": "not-dbg.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": []
}
},
"sap.ui5": {
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": []
}
},
"sap.ui5": {
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": []
}
},
"sap.ui5": {
"dependencies": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": [
"цветя"
]
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down
54 changes: 18 additions & 36 deletions packages/builder/test/lib/processors/manifestCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ const expectedManifestContentObject = () => {
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -385,8 +384,7 @@ test.serial("manifest creation omitMinVersions=true", async (t) => {
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -520,8 +518,8 @@ test.serial("default manifest creation with special characters very small app de
t.is(errorLogStub.callCount, 0);
});

test.serial("manifest creation with themes", async (t) => {
const {manifestCreator, errorLogStub, verboseLogStub, getProjectVersion} = t.context;
test.serial("manifest creation does not emit supportedThemes for theme resources", async (t) => {
const {manifestCreator, errorLogStub, getProjectVersion} = t.context;

const prefix = "/resources/sap/ui/test/";

Expand All @@ -539,10 +537,7 @@ test.serial("manifest creation with themes", async (t) => {
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": [
"base", "sap_foo"
]
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -595,9 +590,6 @@ test.serial("manifest creation with themes", async (t) => {
t.is(await result.getString(), expectedManifestContent, "Correct result returned");

t.is(errorLogStub.callCount, 0);
t.is(verboseLogStub.callCount, 7);
t.is(verboseLogStub.getCall(4).args[0],
" sap.ui/supportedThemes determined from resources: 'base, sap_foo'");
});

test.serial("manifest creation for sap/apf", async (t) => {
Expand Down Expand Up @@ -637,7 +629,7 @@ test.serial("manifest creation for sap/apf", async (t) => {

t.is(errorLogStub.callCount, 0);

t.is(verboseLogStub.callCount, 10);
t.is(verboseLogStub.callCount, 9);
t.is(verboseLogStub.getCall(0).args[0], "sap.app/i18n taken from .library appData: 'i18n/i18n.properties'");
t.is(verboseLogStub.getCall(1).args[0],
"Checking component at /resources/sap/apf");
Expand All @@ -663,8 +655,7 @@ test.serial("manifest creation for sap/ui/core", async (t) => {
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -705,7 +696,7 @@ test.serial("manifest creation for sap/ui/core", async (t) => {

t.is(errorLogStub.callCount, 0);

t.is(verboseLogStub.callCount, 8);
t.is(verboseLogStub.callCount, 7);
t.is(verboseLogStub.getCall(1).args[0],
" sap.app/id taken from .library: 'sap.ui.core'");
});
Expand All @@ -727,8 +718,7 @@ test.serial("manifest creation with .library / Component.js at same namespace",
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -773,7 +763,7 @@ test.serial("manifest creation with .library / Component.js at same namespace",
"This is not supported by manifests, therefore the component won't be " +
"listed in the library's manifest.");

t.is(verboseLogStub.callCount, 8);
t.is(verboseLogStub.callCount, 7);
t.is(verboseLogStub.getCall(1).args[0],
" sap.app/id taken from .library: 'sap.lib1'");
});
Expand All @@ -797,8 +787,7 @@ test.serial("manifest creation with embedded component", async (t) => {
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -879,8 +868,7 @@ test.serial("manifest creation with embedded component (Missing 'embeddedBy')",
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -957,8 +945,7 @@ test.serial("manifest creation with embedded component ('embeddedBy' doesn't poi
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -1039,8 +1026,7 @@ test.serial("manifest creation with embedded component ('embeddedBy' absolute pa
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -1121,8 +1107,7 @@ test.serial("manifest creation with embedded component ('embeddedBy' empty strin
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -1197,8 +1182,7 @@ test.serial("manifest creation with embedded component ('embeddedBy' object)", a
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -1273,8 +1257,7 @@ test.serial("manifest creation with embedded component (no manifest.json)", asyn
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down Expand Up @@ -1342,8 +1325,7 @@ test.serial("manifest creation with embedded component (invalid manifest.json)",
"offline": true
},
"sap.ui": {
"technology": "UI5",
"supportedThemes": []
"technology": "UI5"
},
"sap.ui5": {
"dependencies": {
Expand Down
Loading
Loading