You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have generic IRestore and ICompile components which have two different implementations each.
Considered the rare use case for which I want to execute both implementations for one build component (e.g. IRestore) the restore build component is executed twice when having a TryDependentFor to the other build component.
Hey @Sam13 - I haven't traced the issue but would propose you look at the Nuke build project and at the implementation in the Nuke.Components package for the patterns used there. And how the interplay of IRestore, ICompile(link) works
I see it as the intention for your restore case is to:
build your interface for your use case say IAdditionalLegacyRestore
have that interface inherit from IRestore
have that interface call DependsOn<Restore>()
include it in your project Build class inheritance list with any other components
If that interface isn't included in the Build class - it will not be included in the build. Which I think is the key overall approach to components.
Alternatively if it is more of a one off thing, think of your additional restore step as Clean is handled in the Nuke Build project.
I am on Discord if you want to DM me and discuss this more.
Not dismissing that this might be a bug - but pushing you towards the approach the library is using itself.
Hello @ron-myers
Thanks for your help. I will definitely go through the documentation again.
I found this awkward behavior while implementing other more complicated build components and decided to create a reproducible example because this behavior seemed quite strange to me...
Usage Information
Nuke v6.1.2, .NET SDK 6.0.400, .NET 6, all OS
Description
Given the following Nuke build:
https://github.com/Sam13/nuke-build-components-dependencies-investigation/blob/5d17ee622887607c41f694d3a2f4f9a4f0984b09/build/Build.cs
I have generic IRestore and ICompile components which have two different implementations each.
Considered the rare use case for which I want to execute both implementations for one build component (e.g. IRestore) the restore build component is executed twice when having a TryDependentFor to the other build component.
Nuke summary output:
Removal of TryDependentFor https://github.com/Sam13/nuke-build-components-dependencies-investigation/blob/5d17ee622887607c41f694d3a2f4f9a4f0984b09/build/Build.cs#L23 fixes the problem.
Also other declaration of build component interface implementations will fix the problem (see commits 68d969e22843171b4073d5cb359300e3844a62fe, 999f1e1ef70d61d16860f92cf04ed9e05d3290c9).
Is this a bug or incorrect usage of build components?
Reproduction Steps
Execute https://raw.githubusercontent.com/Sam13/nuke-build-components-dependencies-investigation/5d17ee622887607c41f694d3a2f4f9a4f0984b09/build/Build.cs
Expected Behavior
Build component Restore only executed once
Actual Behavior
Build component Restore executed twice (different implementations)
Regression?
Don't know
Known Workarounds
https://github.com/Sam13/nuke-build-components-dependencies-investigation/blob/68d969e22843171b4073d5cb359300e3844a62fe/build/Build.cs
or
https://github.com/Sam13/nuke-build-components-dependencies-investigation/blob/999f1e1ef70d61d16860f92cf04ed9e05d3290c9/build/Build.cs
The text was updated successfully, but these errors were encountered: