Skip to content
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

Add setting for deleting whole build dir when clean configuring #3783

Merged
merged 6 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2577,6 +2577,12 @@
"description": "%cmake-tools.configuration.cmake.configureOnEdit.description%",
"scope": "resource"
},
"cmake.deleteBuildDirOnCleanConfigure": {
"type": "boolean",
"default": false,
"description": "%cmake-tools.configuration.cmake.deleteBuildDirOnCleanCconfigure.description%",
"scope": "resource"
},
"cmake.setBuildTypeOnMultiConfig": {
"type": "boolean",
"default": false,
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
"cmake-tools.configuration.cmake.copyCompileCommands.description": "Copy compile_commands.json to this location after a successful configure.",
"cmake-tools.configuration.cmake.configureOnOpen.description": "Automatically configure CMake project directories when they are opened.",
"cmake-tools.configuration.cmake.configureOnEdit.description": "Automatically configure CMake project directories when cmake.sourceDirectory or CMakeLists.txt content are saved.",
"cmake-tools.configuration.cmake.deleteBuildDirOnCleanConfigure.description": "Delete the whole build directory when a clean configure is invoked.",
gcampbell-msft marked this conversation as resolved.
Show resolved Hide resolved
"cmake-tools.configuration.cmake.setBuildTypeOnMultiConfig.description": "Set CMAKE_BUILD_TYPE also on multi config generators.",
"cmake-tools.configuration.cmake.skipConfigureIfCachePresent.description": "Skip over the configure process if cache is present.",
"cmake-tools.configuration.cmake.cmakeCommunicationMode": "The protocol used to communicate between the extension and CMake.",
Expand Down
5 changes: 5 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export interface ExtensionConfigurationSettings {
loadCompileCommands: boolean;
configureOnOpen: boolean | null;
configureOnEdit: boolean;
deleteBuildDirOnCleanConfigure: boolean | null;
gcampbell-msft marked this conversation as resolved.
Show resolved Hide resolved
skipConfigureIfCachePresent: boolean | null;
useCMakeServer: boolean;
cmakeCommunicationMode: CMakeCommunicationMode;
Expand Down Expand Up @@ -432,6 +433,9 @@ export class ConfigurationReader implements vscode.Disposable {
get configureOnEdit() {
return this.configData.configureOnEdit;
}
get deleteBuildDirOnCleanConfigure() {
return this.configData.deleteBuildDirOnCleanConfigure;
}
get skipConfigureIfCachePresent() {
return this.configData.skipConfigureIfCachePresent;
}
Expand Down Expand Up @@ -592,6 +596,7 @@ export class ConfigurationReader implements vscode.Disposable {
loadCompileCommands: new vscode.EventEmitter<boolean>(),
configureOnOpen: new vscode.EventEmitter<boolean | null>(),
configureOnEdit: new vscode.EventEmitter<boolean>(),
deleteBuildDirOnCleanConfigure: new vscode.EventEmitter<boolean | null>(),
gcampbell-msft marked this conversation as resolved.
Show resolved Hide resolved
skipConfigureIfCachePresent: new vscode.EventEmitter<boolean | null>(),
useCMakeServer: new vscode.EventEmitter<boolean>(),
cmakeCommunicationMode: new vscode.EventEmitter<CMakeCommunicationMode>(),
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/cmakeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export abstract class CMakeDriver implements vscode.Disposable {
protected async _cleanPriorConfiguration() {
const build_dir = this.binaryDir;
const cache = this.cachePath;
const cmake_files = path.join(build_dir, 'CMakeFiles');
const cmake_files = this.config.deleteBuildDirOnCleanConfigure ? build_dir : path.join(build_dir, 'CMakeFiles');
if (await fs.exists(cache)) {
log.info(localize('removing', 'Removing {0}', cache));
try {
Expand Down
1 change: 1 addition & 0 deletions test/unit-tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function createConfig(conf: Partial<ExtensionConfigurationSettings>): Configurat
loadCompileCommands: true,
configureOnOpen: null,
configureOnEdit: true,
deleteBuildDirOnCleanConfigure: false,
skipConfigureIfCachePresent: null,
useCMakeServer: true,
cmakeCommunicationMode: 'automatic',
Expand Down
Loading