Skip to content

Commit 891bca8

Browse files
committed
Change build to use PSES build file, change over PSES asset paths
1 parent aa9ee8b commit 891bca8

File tree

5 files changed

+36
-49
lines changed

5 files changed

+36
-49
lines changed

modules.json

-12
This file was deleted.

src/process.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class PowerShellProcess {
2323

2424
constructor(
2525
public exePath: string,
26+
private bundledModulesPath: string,
2627
private title: string,
2728
private log: Logger,
2829
private startArgs: string,
@@ -40,7 +41,8 @@ export class PowerShellProcess {
4041
const startScriptPath =
4142
path.resolve(
4243
__dirname,
43-
"../../../PowerShellEditorServices/module/Start-EditorServices.ps1");
44+
this.bundledModulesPath,
45+
"../scripts/Start-EditorServices.ps1");
4446

4547
const editorServicesLogPath = this.log.getLogFilePath(logFileName);
4648

src/session.ts

+10-16
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export class SessionManager implements Middleware {
5353
private languageServerClient: LanguageClient = undefined;
5454
private sessionSettings: Settings.ISettings = undefined;
5555
private sessionDetails: utils.IEditorServicesSessionDetails;
56+
private bundledModulesPath: string;
5657

5758
// When in development mode, VS Code's session ID is a fake
5859
// value of "someValue.machineId". Use that to detect dev
@@ -144,18 +145,17 @@ export class SessionManager implements Middleware {
144145

145146
if (this.powerShellExePath) {
146147

147-
let bundledModulesPath = path.resolve(__dirname, "../../modules");
148+
this.bundledModulesPath = path.resolve(__dirname, this.sessionSettings.bundledModulesPath);
148149

149150
if (this.inDevelopmentMode) {
150151
const devBundledModulesPath =
151152
path.resolve(
152153
__dirname,
153-
this.sessionSettings.developer.bundledModulesPath ||
154-
"../../../PowerShellEditorServices/module");
154+
this.sessionSettings.developer.bundledModulesPath);
155155

156156
// Make sure the module's bin path exists
157157
if (fs.existsSync(path.join(devBundledModulesPath, "PowerShellEditorServices/bin"))) {
158-
bundledModulesPath = devBundledModulesPath;
158+
this.bundledModulesPath = devBundledModulesPath;
159159
} else {
160160
this.log.write(
161161
"\nWARNING: In development mode but PowerShellEditorServices dev module path cannot be " +
@@ -169,7 +169,7 @@ export class SessionManager implements Middleware {
169169
"-HostProfileId 'Microsoft.VSCode' " +
170170
"-HostVersion '" + this.hostVersion + "' " +
171171
"-AdditionalModules @('PowerShellEditorServices.VSCode') " +
172-
"-BundledModulesPath '" + bundledModulesPath + "' " +
172+
"-BundledModulesPath '" + this.bundledModulesPath + "' " +
173173
"-EnableConsoleRepl ";
174174

175175
if (this.sessionSettings.developer.editorServicesWaitForDebugger) {
@@ -179,11 +179,7 @@ export class SessionManager implements Middleware {
179179
this.editorServicesArgs += "-LogLevel '" + this.sessionSettings.developer.editorServicesLogLevel + "' ";
180180
}
181181

182-
this.startPowerShell(
183-
this.powerShellExePath,
184-
this.sessionSettings.developer.powerShellExeIsWindowsDevBuild,
185-
bundledModulesPath,
186-
this.editorServicesArgs);
182+
this.startPowerShell();
187183
} else {
188184
this.setSessionFailure("PowerShell could not be started, click 'Show Logs' for more details.");
189185
}
@@ -235,6 +231,7 @@ export class SessionManager implements Middleware {
235231
this.debugSessionProcess =
236232
new PowerShellProcess(
237233
this.powerShellExePath,
234+
this.bundledModulesPath,
238235
"[TEMP] PowerShell Integrated Console",
239236
this.log,
240237
this.editorServicesArgs + "-DebugServiceOnly ",
@@ -444,11 +441,7 @@ export class SessionManager implements Middleware {
444441
];
445442
}
446443

447-
private startPowerShell(
448-
powerShellExePath: string,
449-
isWindowsDevBuild: boolean,
450-
bundledModulesPath: string,
451-
startArgs: string) {
444+
private startPowerShell() {
452445

453446
this.setSessionStatus(
454447
"Starting PowerShell...",
@@ -461,9 +454,10 @@ export class SessionManager implements Middleware {
461454
this.languageServerProcess =
462455
new PowerShellProcess(
463456
this.powerShellExePath,
457+
this.bundledModulesPath,
464458
"PowerShell Integrated Console",
465459
this.log,
466-
startArgs,
460+
this.editorServicesArgs,
467461
sessionFilePath,
468462
this.sessionSettings);
469463

src/settings.ts

+20-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export interface IDeveloperSettings {
5151

5252
export interface ISettings {
5353
powerShellExePath?: string;
54+
bundledModulesPath?: string;
5455
startAutomatically?: boolean;
5556
useX86Host?: boolean;
5657
enableProfileLoading?: boolean;
@@ -88,7 +89,7 @@ export function load(): ISettings {
8889
const defaultDeveloperSettings: IDeveloperSettings = {
8990
featureFlags: [],
9091
powerShellExePath: undefined,
91-
bundledModulesPath: undefined,
92+
bundledModulesPath: "../../../PowerShellEditorServices/module/",
9293
editorServicesLogLevel: "Normal",
9394
editorServicesWaitForDebugger: false,
9495
powerShellExeIsWindowsDevBuild: false,
@@ -117,6 +118,8 @@ export function load(): ISettings {
117118
configuration.get<boolean>("startAutomatically", true),
118119
powerShellExePath:
119120
configuration.get<string>("powerShellExePath", undefined),
121+
bundledModulesPath:
122+
"../modules/",
120123
useX86Host:
121124
configuration.get<boolean>("useX86Host", false),
122125
enableProfileLoading:
@@ -126,7 +129,7 @@ export function load(): ISettings {
126129
debugging:
127130
configuration.get<IDebuggingSettings>("debugging", defaultDebuggingSettings),
128131
developer:
129-
configuration.get<IDeveloperSettings>("developer", defaultDeveloperSettings),
132+
getWorkspaceSettingsWithDefaults<IDeveloperSettings>(configuration, "developer", defaultDeveloperSettings),
130133
codeFormatting:
131134
configuration.get<ICodeFormattingSettings>("codeFormatting", defaultCodeFormattingSettings),
132135
integratedConsole:
@@ -143,3 +146,18 @@ export function change(settingName: string, newValue: any, global: boolean = fal
143146

144147
return configuration.update(settingName, newValue, global);
145148
}
149+
150+
function getWorkspaceSettingsWithDefaults<TSettings>(
151+
workspaceConfiguration: vscode.WorkspaceConfiguration,
152+
settingName: string,
153+
defaultSettings: TSettings): TSettings {
154+
155+
const importedSettings: TSettings = workspaceConfiguration.get<TSettings>(settingName, defaultSettings);
156+
157+
for (const setting in importedSettings) {
158+
if (importedSettings[setting]) {
159+
defaultSettings[setting] = importedSettings[setting];
160+
}
161+
}
162+
return defaultSettings;
163+
}

vscode-powershell.build.ps1

+3-18
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ task ResolveEditorServicesPath -Before CleanEditorServices, BuildEditorServices
5353
}
5454
}
5555

56-
task Restore RestoreNodeModules, RestorePowerShellModules -Before Build
56+
task Restore RestoreNodeModules -Before Build
5757

5858
task RestoreNodeModules -If { -not (Test-Path "$PSScriptRoot/node_modules") } {
5959

@@ -65,20 +65,6 @@ task RestoreNodeModules -If { -not (Test-Path "$PSScriptRoot/node_modules") } {
6565
exec { & npm install $logLevelParam }
6666
}
6767

68-
task RestorePowerShellModules -If { -not (Test-Path "$PSScriptRoot/modules/Plaster") } {
69-
$modules = Get-Content -Raw "$PSScriptRoot/modules.json" | ConvertFrom-Json
70-
$modules.PSObject.Properties | ForEach-Object {
71-
$params = @{
72-
Name = $_.Name
73-
MinimumVersion = $_.Value.MinimumVersion
74-
MaximumVersion = $_.Value.MaximumVersion
75-
AllowPrerelease = $_.Value.AllowPrerelease
76-
Path = "$PSScriptRoot/modules/"
77-
}
78-
Save-Module @params
79-
}
80-
}
81-
8268
task Clean {
8369
Write-Host "`n### Cleaning vscode-powershell`n" -ForegroundColor Green
8470
Remove-Item .\out -Recurse -Force -ErrorAction Ignore
@@ -122,15 +108,14 @@ task Package {
122108

123109
if ($script:psesBuildScriptPath) {
124110
Write-Host "`n### Copying PowerShellEditorServices module files" -ForegroundColor Green
125-
Copy-Item -Recurse -Force ..\PowerShellEditorServices\module\PowerShellEditorServices .\modules
126-
Copy-Item -Recurse -Force ..\PowerShellEditorServices\module\PowerShellEditorServices.VSCode .\modules
111+
Copy-Item -Recurse -Force ..\PowerShellEditorServices\module\* .\modules
127112
}
128113

129114
Write-Host "`n### Packaging PowerShell-insiders.vsix`n" -ForegroundColor Green
130115
exec { & node ./node_modules/vsce/out/vsce package }
131116

132117
# Change the package to have a static name for automation purposes
133-
Move-Item .\PowerShell-$($script:ExtensionVersion).vsix .\PowerShell-insiders.vsix
118+
Move-Item -Force .\PowerShell-$($script:ExtensionVersion).vsix .\PowerShell-insiders.vsix
134119
}
135120

136121
task UploadArtifacts -If { $env:AppVeyor } {

0 commit comments

Comments
 (0)