Skip to content
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

Overwrite included Task dependencies #298

Closed
blindzero opened this issue May 22, 2020 · 2 comments
Closed

Overwrite included Task dependencies #298

blindzero opened this issue May 22, 2020 · 2 comments

Comments

@blindzero
Copy link

The primary goal was the following:

  • I have different environments, one AppVeyor CI/CD, one "manual" executing build tasks from local shell
  • when running the Task manually (e.g. TestIntegration), I want to have it depending from Build, Analyze, ...
  • when running the Task in AppVeyor, I want it to have no dependency as AppVeyor itself separates between build_script and test_script. When running TestIntegration with the dependency it would build two times (once in build_script and once in TestIntegration through this dependency
  • I wanted to
    • define "TestIntegration" task without dependency in a separate file
    • separate two different psakeFile.ENVIRONMENT.ps1 for the Invoke-PSake
    • Include TestIntegration.ps1 in one of the psakeFile's as-is
    • Include TestIntegration.ps1 in the other psakeFile and set additional dependency

Expected Behavior

  • Defining PSake Tasks in other files "psake.MyTask.ps1"
Task MyTask {
   Do-Something
}
  • Include PSake Task file
Include psake.MyTask.ps1
  • Add additional dependency
Task MyTask {} -Depends OtherTask

Current Behavior

Doing this above brings up an error:

WindowsPowerShell\Modules\psake\4.9.0\public\Assert.ps1:69 char:9 +         throw ('Assert: {0}' -f $failureMessage) +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: Assert: Task compile has already been defined.

Steps to Reproduce (for bugs)

see expected behaviour

Your Environment

  • Module version used: 4.9.0
  • Operating System and PowerShell version: Win 10 1909 PS 5.1
@UberDoodles
Copy link
Contributor

UberDoodles commented May 22, 2020

What you're trying to do can already be achieved. Our psake build scripts are set up to do similar things.

Task Build {
    Build-Stuff
}

Task Analyze {
    Analyze-Stuff
}

Task MyTask {
    Do-Something
}

Task MyLocalTask -Depends Build,Analyze,MyTask {}

When running locally, you will run the MyLocalTask, but AppVeyor would run MyTask.

@blindzero
Copy link
Author

Hi @UberDoodles
thanks for that reply...yeah would work.
I wanted to avoid to have different names again and wanted simply to use Includes but...accepted ;)
Thanks,
M.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants