Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] 0001 Type Extensibility #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

[RFC] 0001 Type Extensibility #4

wants to merge 3 commits into from

Conversation

RandomByte
Copy link
Member

@RandomByte RandomByte commented Apr 3, 2018

A feature to customize how a specific UI5 project is being built.

CC: @tommyvinhlam @matz3

@RandomByte RandomByte added the RFC Request for Comment (pull request) label Apr 3, 2018
RandomByte added a commit to SAP/ui5-project that referenced this pull request Apr 9, 2018
See [RFC0001](SAP/ui5-tooling#4).

Identify and apply extensions in dependency tree so that they can
influence the actual project processing.
As discussed today between @matz3, @tommyvinhlam, @codeworrior, @RandomByte

Build phases would allow for more precise extensibility of a types build
execution. Mainly scenarios where only a single task should be replaced
or added could overwrite one of the build phases to hook in-between of
certain sets of tasks.

Instead, they will have to overwrite the whole build function containing
all tasks. The main reason for this decision is the lack of known
extensibility use-cases. Therefore we do not want to decide on the
naming and semantics of any build phases yet as changing them later on
will hardly be possible.
@RandomByte
Copy link
Member Author

RandomByte commented Apr 12, 2018

a63033f: Removed build phases as discussed today between @matz3, @tommyvinhlam, @codeworrior, @RandomByte

Build phases would allow for more precise extensibility of a types build execution. Mainly scenarios where only a single task should be replaced or added could overwrite one of the build phases to hook in-between of certain sets of tasks.

Instead, they will have to overwrite the whole build function containing all tasks. The main reason for this decision is the lack of known extensibility use-cases. Therefore we do not want to decide on the naming and semantics of any build phases yet as changing them later on will hardly be possible.

RandomByte added a commit to SAP/ui5-project that referenced this pull request Jun 14, 2018
See [RFC0001](SAP/ui5-tooling#4).

Identify and apply extensions in dependency tree so that they can
influence the actual project processing.
@themasch
Copy link

themasch commented Jun 28, 2018

As suggested in https://github.com/SAP/ui5-builder/issues/32 I'd like to add thoughts about this topic in the mix.

(Disclaimer: this is a lot of text and I'd like to say sorry for that. I'm not good at being brief.)

I really like the idea of being able to extend and "personalize" the whole build process to be able to tweak the tooling to a project's needs and those of its developers.
But I'm not yet sure if replacing the whole build process with a custom one is really what I want to do all the time. I'm kind of wearing my "composition over inheritance"-Fanboy-Shirt on this topic. But maybe we are talking about total different use cases so I guess I'll just explain mine and someone tells me where I'm wrong ;)

I experimented with the use of babel to translate modern es6/esnext syntax to something even the poor little IE11 can understand. When working on a UI5 application I can run the application from source in chrome, even run the test in chrome (manually or using karma) and iterate quickly while doing tests on the compiled/bundled versions of the application on demand or even as late as on the CI.

Our toolchain (described in a gruntfile) looks something like this

  [src]        [build]              
  babel ---,-> openui5_preload -,-> [dist] -- nwabap-ui5uploader / npm publish --> target
  copy  --´    copy_debug -----´|
  copy_static------------------´

With the ui5-tooling I could replace the gruntfile with just the ui5.yml and get 4 / 6 steps from just that (+ a lot of cool new things the grunt setup cannot do, like standalone builds).
The only bits missing are deployment and babel.
While deployment might be out of scope for the ui5-tooling it is currently kind of hard to work around the lack of Babel. I guess it would be possible to use grunt to babelify & copy the assets to a build dir and launch ui5-build on that, but that requires another task runner to be involved what kind of defeats the idea.

I currently think that my "ideal version of reality" would look something like this:
When I want my assets to be compiled with babel before building the preloads I just install a "@ui5/babel-plugin" from npm and make a configuration in my ui5.yml that says "build_plugins: [ 'babel' ]" or something like that.

The babel-plugin is then loaded when setting up the build and is able to hook into the build process on clearly defined interfaces. Since the whole idea of the ui5-tooling (as I understand it) is to be an "opinionated tool runner" purposed for ui5 application/library/extension development there is no need to allow the configuration of bells and whistles. Destination and source directory and pretty much set in stone.

Coming back to the actual PR after this short journey, to solve this problem with a type extension I'd need to define a new 'babel-compiled-application', extend the base application in a class and inject babel in that pipeline. If I want to build a library using babel as a transpiler I'd need to do the same thing for a 'babel-compiled-library'.
Let's say I want to use scss on some of these projects as well, so I need to extend my babel-compiled-something to a "babel-compiled-something-with-scss-support".

Very long story short: While I like to be able to extend and configure everything, I'm not sure if that's the best way to allow a configurable build process. I'd like to be able to build a process by picking add-ons/plugins over having to replace the whole thing. But I may have misunderstood the purpose of this PR.

@RandomByte RandomByte mentioned this pull request Jul 4, 2018
2 tasks
@cschuff
Copy link

cschuff commented Jul 4, 2018

@themasch

I'd like to be able to build a process by picking add-ons/plugins over having to replace the whole thing.

I'm totally with you on that.

I'd like to see ui5-tooling as a set of functions/tasks that I can stick together and run however I want with placing additional stuff before, after or right in the middle of it. That is why I prefer gulp over grunt a lot.

@RandomByte
Copy link
Member Author

In our internal discussions, one of the most controversial topics is whether the UI5 Tooling shall have characteristics of a task runner or that of a collection of tasks.

Personally I don't want to build another task runner here. There are plenty of those out there. However, with the CLI and Types we kind of already built one. So I have to agree that it makes sense for people to customize and enhance what ui5 build does to a project.

The main questions I would like to get clarified as a starter here are:

  • What defines the execution order of a types tasks?
  • And how can a project inject one or more additional tasks into that?

I'll add my ideas once I can think of something simpler than an enormous configuration architecture like Maven and others have 😑

@RandomByte
Copy link
Member Author

We discussed this again internally and would like to go forward with a simpler approach very similar to the proposal of @themasch.

RFC 0004 Simple Build Extensibility

Please have a read. Any feedback on the concept is appreciated.

Also, thank you @themasch and @cschuff for your feedback so far!

RandomByte added a commit to SAP/ui5-project that referenced this pull request Oct 8, 2018
See [RFC0001](SAP/ui5-tooling#4).

Identify and apply extensions in dependency tree so that they can
influence the actual project processing.
RandomByte added a commit to SAP/ui5-project that referenced this pull request Oct 8, 2018
See [RFC0001](SAP/ui5-tooling#4).

Identify and apply extensions in dependency tree so that they can
influence the actual project processing.
RandomByte added a commit to SAP/ui5-project that referenced this pull request Oct 12, 2018
See [RFC0001](SAP/ui5-tooling#4).

Identify and apply extensions in dependency tree so that they can
influence the actual project processing.
RandomByte added a commit to SAP/ui5-project that referenced this pull request Oct 16, 2018
See [RFC0001](SAP/ui5-tooling#4).

Identify and apply extensions in dependency tree so that they can
influence the actual project processing.
@flovogt flovogt changed the base branch from master to main November 3, 2022 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request for Comment (pull request)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants