Skip to content

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

Merged
merged 9 commits into from
Mar 23, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ install:

script:
- ulimit -n 4096
- powershell -c "Install-Module PowerShellGet -Force"
- powershell -File build/travis.ps1
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ install:
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | Out-Null
Install-Module InvokeBuild -RequiredVersion 3.2.1 -Scope CurrentUser -Force | Out-Null
Install-Module platyPS -RequiredVersion 0.7.6 -Scope CurrentUser -Force | Out-Null
- powershell.exe -c "Install-Module PowerShellGet -Force"

build_script:
- ps: Invoke-Build
- powershell.exe -c "Invoke-Build"
Copy link
Member Author

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

Copy link
Collaborator

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)


# The build script takes care of the tests
test: off
12 changes: 12 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"PSScriptAnalyzer":{
"MinimumVersion":"1.0",
"MaximumVersion":"1.99",
"AllowPrerelease":false
},
"Plaster":{
"MinimumVersion":"1.0",
"MaximumVersion":"1.99",
"AllowPrerelease":false
}
}
19 changes: 18 additions & 1 deletion vscode-powershell.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ task ResolveEditorServicesPath -Before CleanEditorServices, BuildEditorServices
}
}

task Restore -If { "Restore" -in $BuildTask -or !(Test-Path "./node_modules") } -Before Build {
task Restore RestoreNodeModules, RestorePowerShellModules -Before Build

task RestoreNodeModules -If { -not (Test-Path "$PSScriptRoot/node_modules") } {

Write-Host "`n### Restoring vscode-powershell dependencies`n" -ForegroundColor Green

Expand All @@ -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
Copy link
Collaborator

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added $PSScriptRoot

$modules.PSObject.Properties | ForEach-Object {
$params = @{
Name = $_.Name
MinimumVersion = $_.Value.MinimumVersion
MaximumVersion = $_.Value.MaximumVersion
AllowPrerelease = $_.Value.AllowPrerelease
Path = "$PSScriptRoot/modules/"
}
Save-Module @params
}
}

task Clean {
Write-Host "`n### Cleaning vscode-powershell`n" -ForegroundColor Green
Remove-Item .\out -Recurse -Force -ErrorAction Ignore
Expand Down Expand Up @@ -107,6 +123,7 @@ task Package {
if ($script:psesBuildScriptPath) {
Write-Host "`n### Copying PowerShellEditorServices module files" -ForegroundColor Green
Copy-Item -Recurse -Force ..\PowerShellEditorServices\module\PowerShellEditorServices .\modules
Copy-Item -Recurse -Force ..\PowerShellEditorServices\module\PowerShellEditorServices.VSCode .\modules
}

Write-Host "`n### Packaging PowerShell-insiders.vsix`n" -ForegroundColor Green
Expand Down