-
Notifications
You must be signed in to change notification settings - Fork 510
Have build script add dependent modules (PSSA & Plaster) #1239
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
Have build script add dependent modules (PSSA & Plaster) #1239
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
How about the |
I don't have that in my 1.6.0 modules folder? Where did you get that from? |
OK that is weird. It is another module inside the |
@rkeithhill yeah just checked. That's inside the PowerShellEditorServices folder so it will be included in the vsix that this change generates 😄 |
Looks like Save-Module has minimum and maximum version parameters, which is perfect -- so I'm thinking here would be the right place for us to import some json config file and have a project-wide module version specification. This looks good to go to me! |
@rjmholt Added a modules.json file that includes all of our PowerShell module dependencies that we grab with Save-Module. Note, since PowerShellGet doesn't have a concept of exclusive maximum versions I just put a very high 1.X version to account for any breaking changes that might come in a 2.0. |
Looks like |
Because their versions of PowerShell don't have latest version of PowerShellGet. :( |
Maybe $params= @{
<supportedParams> = <values>
}
if ((Get-Command "Save-Module").Parameters.ContainsKey("AllowPrerelease"))
{
$params += @{ "AllowPrerelease" = $_.Value.AllowPrerelease }
} |
appveyor.yml
Outdated
|
||
build_script: | ||
- ps: Invoke-Build | ||
- powershell.exe -c "Invoke-Build" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have to do this because of updating PowerShellGet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be more explicit here? (e.g. -Command
instead of -c
)
Ok, now the builds will update PowerShellGet and save the modules correctly. Can I get another sign off? |
.travis.yml
Outdated
- sudo powershell -c "Install-Module PowerShellGet -Force" | ||
- powershell -File build/travis.ps1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does -File correctly report exit codes now? At one time it didn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm not sure, I was just adding the install-module above it. Wasn't really focusing on the travis build script itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried pwsh
in Windows 10:
Name Value
---- -----
PSVersion 6.0.1
PSEdition Core
GitCommitId v6.0.1-289-g18d0a0bcbd436b11611ec13f5b2b4b290e58b542
OS Microsoft Windows 10.0.16299
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Writing bad.ps1
as:
throw "Bad!"
Gives:
PS1> pwsh -File .\bad.ps1
Bad!
At C:\Users\roholt\bad.ps1:1 char:1
+ throw "Bad!"
+ ~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Bad!:String) [], RuntimeException
+ FullyQualifiedErrorId : Bad!
PS1> $LASTEXITCODE
1
Changing bad.ps1
to:
exit 1234
gives me:
PS1> pwsh -File .\bad.ps1
PS1> $LASTEXITCODE
1234
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh. Interesting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. Looks like it got fixed somewhere along the way. I just tested in 5.1 and it works there too. See Chris Oldwood's comment on this blog post - https://blogs.msdn.microsoft.com/powershell/2006/10/14/windows-powershell-exit-codes/
That is the behavior I remember.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know! Thanks for that, @rkeithhill.
vscode-powershell.build.ps1
Outdated
@@ -63,6 +65,20 @@ task Restore -If { "Restore" -in $BuildTask -or !(Test-Path "./node_modules") } | |||
exec { & npm install $logLevelParam } | |||
} | |||
|
|||
task RestorePowerShellModules -If { -not (Test-Path "$PSScriptRoot/modules/Plaster") } { | |||
$modules = Get-Content -Raw "./modules.json" | ConvertFrom-Json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quotes aren't needed here, but nbd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added $PSScriptRoot
appveyor.yml
Outdated
|
||
build_script: | ||
- ps: Invoke-Build | ||
- powershell.exe -c "Invoke-Build" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be more explicit here? (e.g. -Command
instead of -c
)
…ershell into appveyor-full-vsix
This will add PSSA and Plaster to our build so that the vsix AppVeyor spits out should be "release quality"
This vsix is a great example:
https://ci.appveyor.com/project/PowerShell/vscode-powershell/build/artifacts