Add option to clean output before running configure/build (Enhancement #6)

This commit is contained in:
vector-of-bool 2016-05-05 23:26:01 -06:00
Родитель 78044a4aa8
Коммит c50da5961a
2 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -96,6 +96,11 @@
"default": "${workspaceRoot}/build", "default": "${workspaceRoot}/build",
"description": "The directory where CMake build files will go" "description": "The directory where CMake build files will go"
}, },
"cmake.clearOutputBeforeBuild": {
"type": "boolean",
"default": true,
"description": "Clear build output before each build"
},
"cmake.configureSettings": { "cmake.configureSettings": {
"type": "object", "type": "object",
"default": { "default": {

Просмотреть файл

@ -487,7 +487,15 @@ export class CMakeTools {
return null; return null;
} }
public configure = async function (extra_args: string[] = []): Promise<Number> { private _prebuild = async function () {
const self: CMakeTools = this;
if (self.config<boolean>("clearOutputBeforeBuild")) {
self._channel.clear();
}
}
public configure = async function (extra_args: string[] = [], run_prebuild = true): Promise<Number> {
const self: CMakeTools = this; const self: CMakeTools = this;
if (self.isBusy) { if (self.isBusy) {
@ -513,6 +521,9 @@ export class CMakeTools {
return; return;
} }
if (run_prebuild)
await self._prebuild();
const binary_dir = self.binaryDir; const binary_dir = self.binaryDir;
const cmake_cache = self.cachePath; const cmake_cache = self.cachePath;
self._channel.show(); self._channel.show();
@ -575,8 +586,9 @@ export class CMakeTools {
if (!do_configure || await self.configure() !== 0) if (!do_configure || await self.configure() !== 0)
return -1; return -1;
} }
await self._prebuild();
if (self._needsReconfigure) { if (self._needsReconfigure) {
const retc = await self.configure(); const retc = await self.configure([], false);
if (!!retc) if (!!retc)
return retc; return retc;
} }