-
Notifications
You must be signed in to change notification settings - Fork 365
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
Trigger subsequent targets #119
Comments
At the moment you could create a simple C# method Adding something like |
If you want to give it a shot, this should be the starting point of the build execution |
@werwolfby did you already found a solution? I think it should be solvable with |
@arodus No I didn't. And |
If I understood correctly, I'm having a similar problem:
While I can work around this using C#, because Nuke's design is clever, I'm intrigued how this should be solved with targets. In a traditional
public Target Test => _ => _
.DependsOn(RunPostgres)
.Executes(() => { /* Execute test */ })
.DependsOn(StopPostgres);
public Target Test => _ => _
.DependsOn(RunPostgres)
.DependsOn(StopPostgres)
.Before(StopPostgres)
.Executes(() => { /* Execute test */ });
public Target Test => _ => _
.DependsOn(RunPostgres)
.Executes(() => { /* Execute test */ })
.Finally(StopPostgres);
EDIT: 5) Support Job Objects in a cross-platform way to kill children when a parent dies. |
tl;dr:
NUKE is designed to save the user from running into (WTF) situations, in which the execution of targets is no longer easily comprehendable. Calling targets from within other targets would make it impossible to construct a proper dependency graph and would break features like Another reason why this implementation was chosen, is that nuke is a native c# application wich allows the users to solve nearly every problem in other ways. So, there is no reason to force everything in targets. For example in your case @ljani, I would use something like: public Target TestPostgres => _ => _
.Executes(() =>
{
using (CreatePostgresContainer())
{
//do work
}
});
private IDisposable CreatePostgresContainer() => DelegateDisposable.CreateBracket(StartPostgres, StopPostgres);
private void StartPostgres() { }
private void StopPostgres() { } This would allow the usage of the postgres container everywhere and not just for a complete target. We could introduce
Since it would not break the dependency graph this is something we could think about. Would something like this also work for you @werwolfby ?
I never worked with them but will have a look into it. |
Regarding my poor ideas, yeah, I knew most of them were garbage. I was just brainstorming ways to solve this 😄 Something utilizing
Yes, my use case is a simple one as I'm still evaluating the tool 😄 The thing is that once you drop to C#, you'll lose the dependency graph. If
Yes, this is essentially what I referred as a workaround and I'm doing now.
I'm sure you noticed, but one thing to keep in mind is that multiple targets might depend on the same cleanup function. I don't know if you have any experience with systemd, but some inspiration could be drawn from their dependency graph. |
Although I'm not sure how we can visualize this in |
Documentation could use a little improvement: If either Empirically:
|
@ljani the example used in my comment here is not a good one, as it suggests that this works like For your case to work, you would need to set a flag in the middle part, similar to this:
|
This is not intentionally either. You should use |
Getting back to this: do you think that a |
Thanks for taking interest. I'm still collecting
|
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have 2 targets:
UpdateVersion
- target that update version in AssemblyInfo.csCreateReleaseBranch
- target that create release branch (I'm lazy to do it manually 😄)I want after execute target
CreateReleaseBranch
executeUpdateVersion
as well. So I can't addDependsOn(CreateReleaseBranch)
forUpdateVersion
target because I can callUpdateVersion
sometimes and do not want to executeCreateReleaseBranch
.I understand that I can use
-Skip
to not executeCreateReleaseBranch
when I do runUpdateVersion
but this is ugly workaround because I can forget about this.The only way I can manage right now is to create additional target
CreateReleaseBranchAndUpdateVersion
which has right dependencies and useBefore(UpdateVersion)
onCreateReleaseBranch
. But I want something like this:Because it doesn't make any sense to create release branch without updating version in develop branch.
Is it possible to do it?
If you can point me somewhere in source, I'll create a PR for this feature.
I think it can be useful in some cases.
The text was updated successfully, but these errors were encountered: