nightroman / Invoke-Build

Build Automation in PowerShell

Home Page:https://github.com/nightroman/Invoke-Build/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to change the name of the build in Build-Parallel?

max-ieremenko opened this issue · comments

I am using the following script to run builds in parallel (simplified):

Build-Parallel @(
    @{ File="build.ps1"; name="foo" }
    @{ File="build.ps1"; name="bar" }
)

the log output is

Start (1/2) build.ps1
Start (2/2) build.ps1
...

is it possible to have the log like

Start (1/2) build.ps1 "foo"
Start (2/2) build.ps1 "bar"
...

This is not possible as such. The script has no customization like this.

I am not sure about "name" for such header info. For IB it is just a particular
parameter name and IB does not know it. Other authors may prefer "Title" or
"BuildName", etc.

But IB knows about "File" (and shows it) and "Task". In theory IB may also show
task names in headers in addition to files.

Then, for example, you may add/have tasks foo and bar to your scripts.

Then call:

Build-Parallel @(
    @{ File="build.ps1"; Task="foo" }
    @{ File="build.ps1"; Task="bar" }
    @{ File="build.ps1"; Task="task1", "task2" }
)

outputs something like:

Start (1/3) build.ps1 foo
Start (2/3) build.ps1 bar
Start (3/3) build.ps1 task1, task2
...

This kind of change is possible and probably useful out of box.
What do you think?

Unfortunately, your version won't help me. In my case all parallels have the same file and task, but different parameters.

Thank you for the clarification.

You can can create artificial / bespoke tasks designed for exactly this purpose.

Sorry, closed by mistake. What about showing all parameters then?
NB This may be not quite secure, probably should be opt in.

We can add the parameter ShowParameter ([string[]] for one or more).

Example:

Build-Parallel -ShowParameter Name @(
    @{ File="build.ps1"; Name="foo" }
    @{ File="build.ps1"; Name="bar" }
)

outputs something like:

Start (1/3) build.ps1 Name='foo'
Start (2/3) build.ps1 Name='bar'
...

I think this solves your issue.
And it is "secure", it's up to an author to use or not.

This is exactly what i'm looking for.
Many thanks!