PowerShellBuild icon indicating copy to clipboard operation
PowerShellBuild copied to clipboard

Discussion: Version with loosened dependencies?

Open JustinGrote opened this issue 6 years ago • 1 comments

Since this is aiming to be a "library" of tasks and a framework to use for opinionated templates, perhaps some of the dependency ordering should be loosened?

For instance, maybe I don't want Publish to depend on Test, or maybe I don't want Test to be dependent on Pester because I want to use my own testing framework.

I was thinking of a variable(s?) to make these dependencies conditional. The dependencies would be on by default, but you could set the variable that would effectively remove all the dependencies and then you can pick-and-choose the tasks/jobs and assign dependencies as required in the downstream template.

This would be an "at-your-own-risk" item, but also should probably focus on individual tasks also being autonomous and not being "truly" dependent on each other (e.g. won't fail if a dependency isn't met)

For tasks that require interoperation, could define high level tasks like "Build", "Test", "Publish" but those are just empty tasks with dependencies, so that those could be overridden in the script.

JustinGrote avatar Nov 21 '18 17:11 JustinGrote

@JustinGrote I was thinking the same thing. We can define default dependencies via $PSBPreference properties and allow the user to modify those if needed.

Default Publish task dependency in build.properties.ps1

$PSBPreference.TaskDependencies.Publish = 'Test'

psakeFile.ps1

task Publish -depends $PSBPreference.TaskDependencies.Publish {
    ...
}

Override Publish task dependency in your psakeFile.ps1

$PSBPreference.TaskDependencies.Publish = 'MyOwnTest'

devblackops avatar Nov 21 '18 20:11 devblackops