Skip to content

Commit

Permalink
Don't nullify driver on cancel of configure or build (#4254)
Browse files Browse the repository at this point in the history
* I don't see any reason to nullify the cmakeDriver just because we stopped a configure or build

* no reason to nullify driver on cancel

* need to reconfigure when a configure is stopped
  • Loading branch information
gcampbell-msft authored Feb 4, 2025
1 parent 078d737 commit 266060f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/cmakeProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2401,7 +2401,6 @@ export class CMakeProject {

return drv.stopCurrentProcess().then(async () => {
await this.activeBuild;
this.cmakeDriver = Promise.resolve(null);
this.isBusy.set(false);
return true;
}, () => false);
Expand All @@ -2415,7 +2414,6 @@ export class CMakeProject {

return drv.stopCurrentProcess().then(async () => {
await this.activeBuild;
this.cmakeDriver = Promise.resolve(null);
return true;
}, () => false);
}
Expand Down
14 changes: 10 additions & 4 deletions src/drivers/cmakeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ export abstract class CMakeDriver implements vscode.Disposable {
return this._isConfiguredAtLeastOnce;
}

protected _needsReconfigure = true;
/**
* Check if we need to reconfigure, such as if an important file has changed
*/
public async checkNeedsReconfigure(): Promise<boolean> {
return this._needsReconfigure;
}

protected async doPreCleanConfigure(): Promise<void> {
return Promise.resolve();
}
Expand All @@ -163,10 +171,6 @@ export abstract class CMakeDriver implements vscode.Disposable {
*/
protected abstract get isCacheConfigSupported(): boolean;

/**
* Check if we need to reconfigure, such as if an important file has changed
*/
abstract checkNeedsReconfigure(): Promise<boolean>;
/**
* Event registration for code model updates
*
Expand Down Expand Up @@ -2031,6 +2035,7 @@ export abstract class CMakeDriver implements vscode.Disposable {
if (this.configureProcess && this.configureProcess.child) {
await util.termProc(this.configureProcess.child);
this.configureProcess = null;
this._needsReconfigure = true;
}
if (this.cmakeBuildRunner) {
await this.cmakeBuildRunner.stop();
Expand All @@ -2057,6 +2062,7 @@ export abstract class CMakeDriver implements vscode.Disposable {
const initBaseDriverWithPresetLoc = localize("init.driver.using.preset", "Initializing base driver using preset");
const initBaseDriverWithKitLoc = localize("init.driver.using.kit", "Initializing base driver using kit");
log.debug(`${useCMakePresets ? initBaseDriverWithPresetLoc : initBaseDriverWithKitLoc}`);

// Load up kit or presets before starting any drivers.
if (useCMakePresets) {
if (configurePreset) {
Expand Down
6 changes: 0 additions & 6 deletions src/drivers/cmakeFileApiDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ export class CMakeFileApiDriver extends CMakeDriver {
preferredGenerators);
}

private _needsReconfigure = true;

/**
* Watcher for the CMake cache file on disk.
*/
Expand Down Expand Up @@ -162,9 +160,6 @@ export class CMakeFileApiDriver extends CMakeDriver {
this._needsReconfigure = true;
await onConfigureSettingsChange();
}
async checkNeedsReconfigure(): Promise<boolean> {
return this._needsReconfigure;
}

async doSetKit(cb: () => Promise<void>): Promise<void> {
this._needsReconfigure = true;
Expand Down Expand Up @@ -208,7 +203,6 @@ export class CMakeFileApiDriver extends CMakeDriver {
}

async doCacheConfigure(): Promise<number> {
this._needsReconfigure = true;
await this.updateCodeModel();
return 0;
}
Expand Down
4 changes: 0 additions & 4 deletions src/drivers/cmakeLegacyDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@ export class CMakeLegacyDriver extends CMakeDriver {
super(cmake, config, sourceDir, isMultiProject, workspaceFolder, preconditionHandler);
}

private _needsReconfigure = true;
async doConfigureSettingsChange(): Promise<void> {
this._needsReconfigure = true;
await onConfigureSettingsChange();
}
async checkNeedsReconfigure(): Promise<boolean> {
return this._needsReconfigure;
}

async doSetKit(cb: () => Promise<void>): Promise<void> {
this._needsReconfigure = true;
Expand Down

0 comments on commit 266060f

Please sign in to comment.