|
| 1 | +- Start Date: 2024-04-16 |
| 2 | +- RFC PR: [#946](https://github.com/SAP/ui5-tooling/pull/946) |
| 3 | +- Issue: - |
| 4 | +- Affected components <!-- Check affected components by writing an "X" into the brackets --> |
| 5 | + + [x] [ui5-builder](https://github.com/SAP/ui5-builder) |
| 6 | + + [x] [ui5-server](https://github.com/SAP/ui5-server) |
| 7 | + + [ ] [ui5-cli](https://github.com/SAP/ui5-cli) |
| 8 | + + [ ] [ui5-fs](https://github.com/SAP/ui5-fs) |
| 9 | + + [ ] [ui5-project](https://github.com/SAP/ui5-project) |
| 10 | + + [ ] [ui5-logger](https://github.com/SAP/ui5-logger) |
| 11 | + |
| 12 | + |
| 13 | +# RFC 0016 Library Source Manifest |
| 14 | + |
| 15 | +## Summary |
| 16 | +<!-- You can either remove the following explanatory text or move it into this comment for later reference --> |
| 17 | + |
| 18 | +Enable (and eventually encourage) UI5 libraries to place a manifest.json in their source while preserving any features of the dynamic manifest creation currently in place. |
| 19 | + |
| 20 | +## Motivation |
| 21 | +<!-- You can either remove the following explanatory text or move it into this comment for later reference --> |
| 22 | + |
| 23 | +The manifest.json file is _important_ for the UI5 runtime, and it's absence can lead to unexpected fallback- and default behavior. |
| 24 | + |
| 25 | +Applications are already required to either contain a manifest.json or the alternative manifest.appdescr_variant. This requirement is mainly enforced by UI5 Tooling which uses the file to determine the application's **namespace**. |
| 26 | + |
| 27 | +For libraries however, the presence of a manifest.json is currently optional. Required information like the namespace can alternatively be defined in a .library-XML file or, if that does not exist either, derived from the path of a library.js file (which is required by UI5 runtime and therefore always present). A UI5 Tooling build task "generateManifest" exists to generate a missing manifest.json during the build using information from the .library file. |
| 28 | + |
| 29 | +Our estimate is that currently the majority of UI5 libraries **do not contain a manifest.json file**, with only recently created third-party libraries which may provide the file. |
| 30 | + |
| 31 | +On the other hand however, all UI5-framework libraries as well as most third-party libraries contain a .library file. |
| 32 | + |
| 33 | +With evolving APIs in the UI5 runtime, the absence of a manifest.json becomes more of a problem in the future. Therefore we need to find ways to ensure that the UI5 runtime can rely on the presence of the file. |
| 34 | + |
| 35 | +## Detailed design |
| 36 | +<!-- You can either remove the following explanatory text or move it into this comment for later reference --> |
| 37 | + |
| 38 | +To solve this we intent to implement two plans: |
| 39 | +1. Add dynamic manifest generation to ui5-server |
| 40 | + * Reusing the existing processor of ui5-builder |
| 41 | + * This will ensure that a manifest.json is present at development-time for most of today's libraries |
| 42 | +2. Implement a new component in ui5-builder and ui5-server to dynamically enhance existing manifest.json |
| 43 | + * Reusing what is already being done for `supportedLocales` in https://github.com/SAP/ui5-builder/pull/957 |
| 44 | + * Without this, developers might be discouraged to have a static manifest.json since the dynamic generation would take care of collecting and defining dynamic information like the supported locales and -themes |
| 45 | + |
| 46 | +```mermaid |
| 47 | + flowchart TD |
| 48 | + A[Build/Serve project] --> B{Has manifest.json?}; |
| 49 | + B -->|Yes| C[Enhance manifest.json]; |
| 50 | + B -->|No| D[Generate manifest.json]; |
| 51 | + C & D --> E[Store/Serve manifest.json]; |
| 52 | +``` |
| 53 | + |
| 54 | +### Dynamic Manifest Properties |
| 55 | + |
| 56 | +The following properties contain "dynamic information", which should be filled by either the manifest generation or enhancement process. |
| 57 | + |
| 58 | +Of course a developer should always be able to define any of them statically in the manifest.json, in which case they are not overwritten. |
| 59 | + |
| 60 | +* supported locales (manifest enricher) |
| 61 | +* supportedThemes (manifest enricher) |
| 62 | +* minUi5Version (manifest enricher) |
| 63 | +* minUi5Version of dependencies (manifest enricher, if deps are available) |
| 64 | +* library.content (manifest enricher, like manifestCreator) |
| 65 | + * Note future runtime might only require interface-information |
| 66 | +* openSourceComponents (manifest enricher, from .library) |
| 67 | +* version (should only contain a placeholder) (placeholder replacement) |
| 68 | + |
| 69 | +### Examples Resources |
| 70 | + |
| 71 | +https://ui5.sap.com/resources/sap/esh/search/ui/manifest.json |
| 72 | +https://ui5.sap.com/resources/sap/esh/search/ui/.library |
| 73 | + |
| 74 | +## How we teach this |
| 75 | +<!-- You can either remove the following explanatory text or move it into this comment for later reference --> |
| 76 | + |
| 77 | +tbd |
| 78 | + |
| 79 | +## Drawbacks |
| 80 | +<!-- You can either remove the following explanatory text or move it into this comment for later reference --> |
| 81 | + |
| 82 | +tbd |
| 83 | + |
| 84 | +## Alternatives |
| 85 | +<!-- You can either remove the following explanatory text or move it into this comment for later reference --> |
| 86 | + |
| 87 | +tbd |
| 88 | + |
| 89 | +## Unresolved Questions and Bikeshedding |
| 90 | +<!-- You can either remove the following explanatory text or move it into this comment for later reference --> |
| 91 | + |
| 92 | +- |
0 commit comments