@@ -33,39 +33,16 @@ task RestoreNodeOptional -If { !(Test-Path ./node_modules/eslint) } {
3333}
3434
3535task RestoreEditorServices - If (Get-EditorServicesPath ) {
36- switch ($Configuration ) {
37- " Debug" {
38- # When debugging, we always rebuild PSES and ensure its symlinked so
39- # that developers always have the latest local bits.
40- if ((Get-Item ./ modules - ErrorAction SilentlyContinue).LinkType -ne " SymbolicLink" ) {
41- Write-Build DarkMagenta " Creating symbolic link to PSES"
42- Remove-BuildItem ./ modules
43- New-Item - ItemType SymbolicLink - Path ./ modules - Target " $ ( Split-Path (Get-EditorServicesPath )) /module"
44- }
45-
46- Write-Build DarkGreen " Building PSES"
47- Invoke-Build Build (Get-EditorServicesPath ) - Configuration $Configuration
48- }
49- " 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"
54- Remove-BuildItem ./ modules
55- }
56-
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
66- }
67- }
36+ # With VSCE --follow-symlinks support, we can now use symlinks consistently
37+ # for both Debug and Release configurations.
38+ if ((Get-Item ./ modules - ErrorAction SilentlyContinue).LinkType -ne " SymbolicLink" ) {
39+ Write-Build DarkMagenta " Creating symbolic link to PSES"
40+ Remove-BuildItem ./ modules
41+ New-Item - ItemType SymbolicLink - Path ./ modules - Target " $ ( Split-Path (Get-EditorServicesPath )) /module"
6842 }
43+
44+ Write-Build DarkGreen " Building PSES"
45+ Invoke-Build Build (Get-EditorServicesPath ) - Configuration $Configuration
6946}
7047
7148# endregion
@@ -131,15 +108,7 @@ task Package {
131108 New-Item - ItemType Directory - Force out | Out-Null
132109
133110 Assert-Build (Test-Path ./ dist/ extension.js) " Extension must be built!"
134-
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- }
111+ Assert-Build (Test-Path ./ modules/ PowerShellEditorServices/ bin) " PowerShell Editor Services must be built under modules!"
143112
144113 if ($version.Minor % 2 -ne 0 ) {
145114 Write-Build DarkRed " This is a pre-release!"
0 commit comments