diff --git a/.travis.yml b/.travis.yml index 7b69987bbd..81112c66df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,4 +22,5 @@ install: script: - ulimit -n 4096 - - powershell -File build/travis.ps1 \ No newline at end of file + - sudo powershell -Command "Install-Module PowerShellGet -Force" + - powershell -File build/travis.ps1 diff --git a/appveyor.yml b/appveyor.yml index 4b767554c8..4e78546fef 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 -Command "Install-Module PowerShellGet -Force" build_script: - - ps: Invoke-Build + - powershell.exe -Command "Invoke-Build" # The build script takes care of the tests test: off diff --git a/modules.json b/modules.json new file mode 100644 index 0000000000..c47939e30a --- /dev/null +++ b/modules.json @@ -0,0 +1,12 @@ +{ + "PSScriptAnalyzer":{ + "MinimumVersion":"1.0", + "MaximumVersion":"1.99", + "AllowPrerelease":false + }, + "Plaster":{ + "MinimumVersion":"1.0", + "MaximumVersion":"1.99", + "AllowPrerelease":false + } +} \ No newline at end of file diff --git a/vscode-powershell.build.ps1 b/vscode-powershell.build.ps1 index 43b4c20693..99250808e8 100644 --- a/vscode-powershell.build.ps1 +++ b/vscode-powershell.build.ps1 @@ -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 @@ -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 "$PSScriptRoot/modules.json" | ConvertFrom-Json + $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 @@ -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