Skip to content

Commit a17c32f

Browse files
committed
[RFC] 0001 Type Extensibility
1 parent 21f164c commit a17c32f

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

rfcs/0001-type-extensibility.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
- Start Date: 2018-04-03
2+
- RFC PR: [#4](https://github.com/SAP/ui5-tooling/pull/4)
3+
- Issue: -
4+
- Affected components
5+
+ [x] [ui5-builder](https://github.com/SAP/ui5-builder)
6+
+ [ ] [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+
+ [x] [ui5-project](https://github.com/SAP/ui5-project)
10+
+ [ ] [ui5-logger](https://github.com/SAP/ui5-logger)
11+
12+
# RFC 0001 Type Extensibility
13+
## Summary
14+
Add a feature to customize how a specific UI5 project is being built.
15+
16+
## Motivation
17+
Currently the UI5 build is only capable of building UI5 projects of types "application" and "library" with a fixed set of tasks it executes.
18+
19+
A UI5 project (for example a library) may want to add or modify build steps (for example execute custom bundling). For this, an extensibility mechanism is needed.
20+
21+
Multiple UI5 projects may require the same kind of "customized" build. Therefore reuse should be possible.
22+
23+
## Detailed design
24+
### Extensibility of types
25+
Leverage the existing mechanism of types (currently for application and library), allow for a custom type and do the necessary adaption via regular JS language features (i.e. object-orientation, deriving and overriding).
26+
27+
The `AbstractBuilder` (as well as any subclass-implementation) offers a set of functions which can be overwritten.
28+
29+
#### Combined list of tasks executed by application- and library types
30+
- replaceCopyright
31+
- replaceVersion
32+
- buildThemes
33+
- generateLibraryPreload
34+
- createDebugFiles
35+
- uglify
36+
- generateFlexChangesBundle
37+
- generateManifestBundle
38+
- generateAppPreload
39+
- generateStandaloneAppBundle
40+
- generateVersionInfo
41+
42+
#### Functions of the `AbstractBuilder` ("Phases")
43+
1. preprocess()
44+
- replaceCopyright
45+
- replaceVersion
46+
1. process()
47+
- createDebugFiles()
48+
- buildThemes()
49+
1. bundle()
50+
1. postprocess() / optimize()
51+
- uglify()
52+
53+
A custom types `Builder` module shall extend another types builder or the generic `AbstractBuilder`:
54+
```js
55+
class MyCustomBuilder extends AbstractBuilder {
56+
bundle() {
57+
super.bundle();
58+
myCustomBundle();
59+
}
60+
}
61+
```
62+
63+
### Collecting and applying type extensions
64+
65+
## How we teach this
66+
TBD
67+
68+
## Drawbacks
69+
TBD
70+
71+
## Alternatives
72+
There are ways to consume (and thereby possibly adapt) the existing tooling through its API via taskrunners such as grunt or gulp, or using a custom node.js script. But this offers only limited possibilities, especially when it comes to building transient dependencies.
73+
74+
## Unresolved questions

0 commit comments

Comments
 (0)