SAP/ui5-tooling

exclude-task CLI option is ignored for some standard tasks

BenReim opened this issue · 1 comments

Some task are being run even if included in the --exclude-task CLI option

Current Behavior

When running the build in a library project:

> ui5 build --clean-dest --exclude-task=minify,generateLibraryPreload

info ProjectBuilder Preparing build for project my.library
info Project 1 of 1: ❯ Building library project my.library
[...]
info my.library › Running task minify...
info my.library › Running task generateLibraryPreload...

Context

$ ui5 --version
3.8.0 

Hey @BenReim,

This is an unfortunate combination of two things. First, for CLI options that take multiple values, those values must be separated by a space. Second, in the case of the --include-task/--exclude-task options, we don't check whether the specified tasks actually exist.

So to get your scenario working, replace the comma with a space like this:

ui5 build --clean-dest --exclude-task=minify generateLibraryPreload

I'll try and dig out the reasoning for not checking the provided task names. I remember that we had to remove this during a refactoring, as it caused trouble when building a project with dependencies. For example when building an application with dependencies, while excluding task generateLibraryPreload, the old checks would have complained about not knowing the generateLibraryPreload in the application project.

I'm sure this can be improved, but I'll change this issue to an enhancement as it (unfortunately) works as designed.