8000 Run clean-configure when workflow has different configure preset than project by andreeis · Pull Request #3768 · microsoft/vscode-cmake-tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Run clean-configure when workflow has different configure preset than project #3768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DirectoryContext } from '@cmt/workspace';
import * as vscode from 'vscode';
import { CMakeDriver } from '@cmt/drivers/drivers';
import * as nls from 'vscode-nls';
import { ConfigureType } from './cmakeProject';
import { WorkflowPreset, ConfigurePreset, BuildPreset, TestPreset, PackagePreset, getPresetByName, allConfigurePresets, allBuildPresets, allTestPresets, allPackagePresets } from './preset';
import * as proc from '@cmt/proc';
import { ProjectController } from './projectController';
Expand Down Expand Up @@ -51,16 +52,25 @@ export class WorkflowDriver implements vscode.Disposable {
let newTestPreset: TestPreset | null = null ;
let newPackagePreset: PackagePreset | null = null;
const workflowSteps = workflowPreset?.steps || [];
let cleanWorkflowConfigure: boolean = false;
for (const step of workflowSteps) {
switch (step.type) {
case "configure":
newConfigurePreset = getPresetByName(allConfigurePresets(driver.workspaceFolder), step.name);
if (newConfigurePreset?.name !== oldConfigurePreset?.name) {
await prj.setConfigurePreset(newConfigurePreset?.name || null);
// If the workflow configure preset is different than the current project configure preset
// it is better to re-configure clean.
cleanWorkflowConfigure = true;
}

log.info(localize('workflow.configuring', 'Configuring project with the {0} configure preset of the workflow.', newConfigurePreset?.name));
await prj.configureInternal(ConfigureTrigger.workflow);
if (cleanWorkflowConfigure) {
log.info(localize('workflow.configuring.clean', 'Configuring clean project with the {0} configure preset of the workflow.', newConfigurePreset?.name));
await prj.configureInternal(ConfigureTrigger.workflow, [], ConfigureType.Clean);
} else {
log.info(localize('workflow.configuring', 'Configuring project with the {0} configure preset of the workflow.', newConfigurePreset?.name));
await prj.configureInternal(ConfigureTrigger.workflow);
}

break;

Expand Down Expand Up @@ -102,7 +112,11 @@ export class WorkflowDriver implements vscode.Disposable {
if (newConfigurePreset?.name !== oldConfigurePreset?.name && oldConfigurePreset) {
await prj.setConfigurePreset(oldConfigurePreset?.name);
log.info(localize('workflow.restore.configuring', 'Workflow finished. Restore the original {0} configure preset and reconfigure.', oldConfigurePreset?.name ?? ""));
await prj.configureInternal(ConfigureTrigger.workflow);
if (cleanWorkflowConfigure) {
await prj.configureInternal(ConfigureTrigger.workflow, [], ConfigureType.Clean);
} else {
await prj.configureInternal(ConfigureTrigger.workflow);
}
}

if (newBuildPreset?.name !== oldBuildPreset?.name && oldBuildPreset) {
Expand Down
Loading
0