diff --git a/package.json b/package.json index 9d3dba87a6..1a4e350f33 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "watch": "npm run compile -- --watch", "lint": "eslint src test --ext .ts", "format": "prettier --check '**/*.{ts,json,yml,mjs,code-workspace}'", - "package": "vsce package --out out/ --no-gitHubIssueLinking", + "package": "vsce package --out out/ --no-gitHubIssueLinking --follow-symlinks", "publish": "vsce publish", "pretest": "npm run compile", "test": "vscode-test" diff --git a/vscode-powershell.build.ps1 b/vscode-powershell.build.ps1 index 4bcc737e33..8f98b0e873 100644 --- a/vscode-powershell.build.ps1 +++ b/vscode-powershell.build.ps1 @@ -33,39 +33,15 @@ task RestoreNodeOptional -If { !(Test-Path ./node_modules/eslint) } { } task RestoreEditorServices -If (Get-EditorServicesPath) { - switch ($Configuration) { - "Debug" { - # When debugging, we always rebuild PSES and ensure its symlinked so - # that developers always have the latest local bits. - if ((Get-Item ./modules -ErrorAction SilentlyContinue).LinkType -ne "SymbolicLink") { - Write-Build DarkMagenta "Creating symbolic link to PSES" - Remove-BuildItem ./modules - New-Item -ItemType SymbolicLink -Path ./modules -Target "$(Split-Path (Get-EditorServicesPath))/module" - } - - Write-Build DarkGreen "Building PSES" - Invoke-Build Build (Get-EditorServicesPath) -Configuration $Configuration - } - "Release" { - # When releasing, we ensure the bits are not symlinked but copied, - # and only if they don't already exist. - if ((Get-Item ./modules -ErrorAction SilentlyContinue).LinkType -eq "SymbolicLink") { - Write-Build DarkRed "Deleting PSES symbolic link" - Remove-BuildItem ./modules - } - - if (!(Test-Path ./modules)) { - # We only build if it hasn't been built at all. - if (!(Test-Path "$(Split-Path (Get-EditorServicesPath))/module/PowerShellEditorServices/bin")) { - Write-Build DarkGreen "Building PSES" - Invoke-Build Build (Get-EditorServicesPath) -Configuration $Configuration - } - - Write-Build DarkGreen "Copying PSES" - Copy-Item -Recurse -Force "$(Split-Path (Get-EditorServicesPath))/module" ./modules - } - } + # Always use a symlink for ./modules pointing to PSES + if ((Get-Item ./modules -ErrorAction SilentlyContinue).LinkType -ne "SymbolicLink") { + Write-Build DarkMagenta "Creating symbolic link to PSES" + Remove-BuildItem ./modules + New-Item -ItemType SymbolicLink -Path ./modules -Target "$(Split-Path (Get-EditorServicesPath))/module" } + + Write-Build DarkGreen "Building PSES" + Invoke-Build Build (Get-EditorServicesPath) -Configuration $Configuration } #endregion @@ -131,15 +107,7 @@ task Package { New-Item -ItemType Directory -Force out | Out-Null Assert-Build (Test-Path ./dist/extension.js) "Extension must be built!" - - # Packaging requires a copy of the modules folder, not a symbolic link. But - # we might have built in Debug configuration, not Release, and still want to - # package it. So delete the symlink and copy what we just built. - if ((Get-Item ./modules -ErrorAction SilentlyContinue).LinkType -eq "SymbolicLink") { - Write-Build DarkRed "PSES is a symbolic link, replacing with copy!" - Remove-BuildItem ./modules - Copy-Item -Recurse -Force "$(Split-Path (Get-EditorServicesPath))/module" ./modules - } + Assert-Build (Test-Path ./modules/PowerShellEditorServices/bin) "PSES must be built!" if ($version.Minor % 2 -ne 0) { Write-Build DarkRed "This is a pre-release!"