-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
additional Build task dependencies listed in $PSBPreference.Build.Dependencies do not run. #37
Comments
@joeypiccola tl:dr: It's an ordering issue in the way psake loads the tasks. When you tell psake to load tasks from a module, it runs the When you tell psake to load a task from a module, you can override things like Try this: task Build -FromModule PowerShellBuild -depends @('StageFiles', 'BuildHelp', 'BumpVersion')
task BumpVersion {
'Bump version'
} This will give the behavior you want, but ideally we also want to way to do the same when modifying ``$PSBPreference`. |
@devblackops Thanks for the help, much appreciated.
So what is the intended usage of PowerShellBuilds's As for what you suggested trying, the following results in the task task default -depends Test
task Test -FromModule PowerShellBuild -Version '0.3.0'
task Build -FromModule PowerShellBuild -Version '0.3.0' -depends @('StageFiles', 'BuildHelp', 'testTask')
task testTask {
'my test task'
} OUTPUT
|
This appears to still remain an issue. Was there a better way of handling the Shared Task dependencies? |
I'm having the same issue. My project includes a .NET Framework DLL written in C# which needs to be compiled, and the output staged with the PowerShell module files prior to building the module itself. I was thinking a good way to do this would be to add my task as a dependency to Build but I'm unable to get my task to run when specifying it in $PSBPreference or in the -depends task parameter. For now, I think I'll work around it by using a separate psakeFile and calling both from build.ps1. |
Looks like you can change the task import order to make your 2nd example work: task default -depends Test
task Build -FromModule PowerShellBuild -Version '0.6.1' -depends @('StageFiles', 'BuildHelp', 'testTask')
task Test -FromModule PowerShellBuild -Version '0.6.1'
task testTask{
'my test task'
} Compared to your original (2nd) example, I swapped the order of I assume this is related to the same ordering issue originally mentioned. So, a Task with overridden dependencies needs to be specified prior to importing another task that itself depends on the task with overridden dependencies. @devblackops - being able to hook custom tasks into the build chain seems like a pretty common use case. Is this the correct method? |
I have the task
BumpVersion
that I want theBuild
task to depend on. That said, I found$PSBPreference.Build.Dependencies
and have supplied the following array@('StageFiles', 'BuildHelp', 'BumpVersion')
. However,BumpVersion
never runs.StageFiles
andBuildHelp
do run.Expected Behavior
When running the
Build
task, additional dependencies listed in$PSBPreference.Build.Dependencies
should also run.Current Behavior
When running the
Build
task, additional dependencies listed in$PSBPreference.Build.Dependencies
do not run. Strangely enough, when supplying$PSBPreference.Build.Dependencies
with onlyBumpVersion
the default build task dependenciesStageFiles
andBuildHelp
still run making me think$PSBPreference.Build.Dependencies
is not even being correctly passed.Possible Solution
I've verified
$PSBPreference.Build.Dependencies
is being supplied to theBuild
task here:PowerShellBuild/PowerShellBuild/psakeFile.ps1
Line 54 in 11e1b94
Steps to Reproduce (for bugs)
$PSBPreference.Build.Dependencies
in theproperties
block of apsakeFile.ps1
with the value of @('MyExtraBuildTask')psakeFile.ps1
e.g...Context
I have a few extra tasks that I want to run as part of the build. Specifically, a task that bumps the module version if it has not already been incremented and also a task that uploads test results to appveyor when the BuildSystem is appveyor.
Your Environment
PowerShellBuild = 0.3.0
Psake = 4.8.0
MacOS 10.14.6
PowerShell = 6.2.0
The text was updated successfully, but these errors were encountered: