@@ -47,22 +47,18 @@ task RestoreEditorServices -If (Get-EditorServicesPath) {
4747 Invoke-Build Build (Get-EditorServicesPath ) - Configuration $Configuration
4848 }
4949 " Release" {
50- # When releasing , we ensure the bits are not symlinked but copied,
51- # and only if they don 't already exist.
52- if ((Get-Item ./ modules - ErrorAction SilentlyContinue).LinkType -eq " SymbolicLink" ) {
53- Write-Build DarkRed " Deleting PSES symbolic link"
50+ # With VSCE --follow-symlinks support , we can now use symlinks in Release mode too.
51+ # Create symlink if it doesn 't exist, ensuring it points to the correct location .
52+ if ((Get-Item ./ modules - ErrorAction SilentlyContinue).LinkType -ne " SymbolicLink" ) {
53+ Write-Build DarkMagenta " Creating symbolic link to PSES "
5454 Remove-BuildItem ./ modules
55+ New-Item - ItemType SymbolicLink - Path ./ modules - Target " $ ( Split-Path (Get-EditorServicesPath )) /module"
5556 }
5657
57- if (! (Test-Path ./ modules)) {
58- # We only build if it hasn't been built at all.
59- if (! (Test-Path " $ ( Split-Path (Get-EditorServicesPath )) /module/PowerShellEditorServices/bin" )) {
60- Write-Build DarkGreen " Building PSES"
61- Invoke-Build Build (Get-EditorServicesPath ) - Configuration $Configuration
62- }
63-
64- Write-Build DarkGreen " Copying PSES"
65- Copy-Item - Recurse - Force " $ ( Split-Path (Get-EditorServicesPath )) /module" ./ modules
58+ # Only build if it hasn't been built at all.
59+ if (! (Test-Path " $ ( Split-Path (Get-EditorServicesPath )) /module/PowerShellEditorServices/bin" )) {
60+ Write-Build DarkGreen " Building PSES"
61+ Invoke-Build Build (Get-EditorServicesPath ) - Configuration $Configuration
6662 }
6763 }
6864 }
@@ -132,14 +128,8 @@ task Package {
132128
133129 Assert-Build (Test-Path ./ dist/ extension.js) " Extension must be built!"
134130
135- # Packaging requires a copy of the modules folder, not a symbolic link. But
136- # we might have built in Debug configuration, not Release, and still want to
137- # package it. So delete the symlink and copy what we just built.
138- if ((Get-Item ./ modules - ErrorAction SilentlyContinue).LinkType -eq " SymbolicLink" ) {
139- Write-Build DarkRed " PSES is a symbolic link, replacing with copy!"
140- Remove-BuildItem ./ modules
141- Copy-Item - Recurse - Force " $ ( Split-Path (Get-EditorServicesPath )) /module" ./ modules
142- }
131+ # With --follow-symlinks flag, VSCE can now package symbolic links directly,
132+ # so we no longer need to convert symlinks to copies.
143133
144134 if ($version.Minor % 2 -ne 0 ) {
145135 Write-Build DarkRed " This is a pre-release!"
0 commit comments