@@ -33,39 +33,15 @@ 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+ # Always use a symlink for ./modules pointing to PSES
37+ if ((Get-Item ./ modules - ErrorAction SilentlyContinue).LinkType -ne " SymbolicLink" ) {
38+ Write-Build DarkMagenta " Creating symbolic link to PSES"
39+ Remove-BuildItem ./ modules
40+ New-Item - ItemType SymbolicLink - Path ./ modules - Target " $ ( Split-Path (Get-EditorServicesPath )) /module"
6841 }
42+
43+ Write-Build DarkGreen " Building PSES"
44+ Invoke-Build Build (Get-EditorServicesPath ) - Configuration $Configuration
6945}
7046
7147# endregion
@@ -131,15 +107,7 @@ task Package {
131107 New-Item - ItemType Directory - Force out | Out-Null
132108
133109 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- }
110+ Assert-Build (Test-Path ./ modules/ PowerShellEditorServices/ bin) " PSES must be built!"
143111
144112 if ($version.Minor % 2 -ne 0 ) {
145113 Write-Build DarkRed " This is a pre-release!"
0 commit comments