Skip to content

Commit

Permalink
Merge pull request #1554 from microsoft/dev/andris/cmake_tools/1.5.3
Browse files Browse the repository at this point in the history
1.5.3 bug fixes
  • Loading branch information
andreeis authored Nov 17, 2020
2 parents d03e914 + ce727a3 commit 92f045f
Show file tree
Hide file tree
Showing 19 changed files with 37 additions and 35 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# What's New?

## 1.5.3
Bug Fixes:
- "Clean all projects" broken since 1.5.0. [#1542](https://github.com/microsoft/vscode-cmake-tools/issues/1542)
- CMake task provider should not attempt to register until the CMake driver is available. [#1549](https://github.com/microsoft/vscode-cmake-tools/issues/1549)

## 1.5.2
Bug Fixes:
- Fix deadlock caused by commands invoked in string expansion during activation. [PR #1532](https://github.com/microsoft/vscode-cmake-tools/issues/1532)
- Fix deadlock caused by commands invoked in string expansion during activation. [PR #1532](https://github.com/microsoft/vscode-cmake-tools/pull/1532)

## 1.5.1
Bug Fixes:
Expand Down
1 change: 0 additions & 1 deletion i18n/chs/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "已检测到适用于版本的 VsKit",
"generator.present": "存在生成器: {0}",
"selected.preferred.generator.name": "已选择首选生成器名称: {0} {1}",
"clang.for.msvc": "带有 {2} ({3})的 Clang {0} {1}",
"scanning.for.kits.on.system": "正在系统上扫描工具包",
"scanning.for.kits": "正在扫描工具包",
"scanning.for.cmake.kits": "正在扫描 CMake 工具包...",
Expand Down
1 change: 0 additions & 1 deletion i18n/cht/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "已偵測到 VsKit 的版本",
"generator.present": "產生器已存在: {0}",
"selected.preferred.generator.name": "已選取慣用產生器名稱: {0} {1}",
"clang.for.msvc": "具有 {2} ({3}) 的 Clang {0} {1}",
"scanning.for.kits.on.system": "正在掃描系統上的套件",
"scanning.for.kits": "正在掃描套件",
"scanning.for.cmake.kits": "正在掃描 CMake 套件...",
Expand Down
1 change: 0 additions & 1 deletion i18n/csy/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "Zjištěna sada VsKit pro verzi",
"generator.present": "Generátor je přítomen: {0}",
"selected.preferred.generator.name": "Název vybraného upřednostňovaného generátoru: {0} {1}",
"clang.for.msvc": "Clang {0} {1} s {2} ({3})",
"scanning.for.kits.on.system": "Hledají se sady v systému.",
"scanning.for.kits": "Hledají se sady.",
"scanning.for.cmake.kits": "Hledají se sady CMake...",
Expand Down
1 change: 0 additions & 1 deletion i18n/deu/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "Erkanntes VsKit für Version",
"generator.present": "Generator vorhanden: {0}",
"selected.preferred.generator.name": "Ausgewählter bevorzugter Generatorname: {0} {1}",
"clang.for.msvc": "Clang {0} {1} mit {2} ({3})",
"scanning.for.kits.on.system": "Es wird nach Kits auf dem System gesucht.",
"scanning.for.kits": "Es wird nach Kits gesucht.",
"scanning.for.cmake.kits": "Es wird nach CMake-Kits gesucht...",
Expand Down
1 change: 0 additions & 1 deletion i18n/esn/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "VsKit detectado para la versión",
"generator.present": "Generador presente: {0}",
"selected.preferred.generator.name": "Nombre de generador preferido seleccionado: {0} {1}",
"clang.for.msvc": "Clang {0} {1} con {2} ({3})",
"scanning.for.kits.on.system": "Buscando kits en el sistema",
"scanning.for.kits": "Buscando kits",
"scanning.for.cmake.kits": "Examinando los kits de CMake...",
Expand Down
1 change: 0 additions & 1 deletion i18n/fra/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "VsKit détecté pour la version",
"generator.present": "Générateur présent : {0}",
"selected.preferred.generator.name": "Nom du générateur par défaut sélectionné : {0} {1}",
"clang.for.msvc": "Clang {0} {1} avec {2} ({3})",
"scanning.for.kits.on.system": "Recherche de kits sur le système",
"scanning.for.kits": "Recherche de kits",
"scanning.for.cmake.kits": "Recherche de kits CMake...",
Expand Down
1 change: 0 additions & 1 deletion i18n/ita/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "Rilevato kit di Visual Studio per la versione",
"generator.present": "Generatore presente: {0}",
"selected.preferred.generator.name": "Nome del generatore preferito selezionato: {0} {1}",
"clang.for.msvc": "Clang {0} {1} con {2} ({3})",
"scanning.for.kits.on.system": "Ricerca dei kit nel sistema",
"scanning.for.kits": "Ricerca dei kit",
"scanning.for.cmake.kits": "Ricerca dei kit CMake...",
Expand Down
1 change: 0 additions & 1 deletion i18n/jpn/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "バージョンの VsKit が検出されました",
"generator.present": "ジェネレーターが存在します: {0}",
"selected.preferred.generator.name": "選択された優先ジェネレーター名: {0} {1}",
"clang.for.msvc": "Clang {0} {1} および {2} ({3})",
"scanning.for.kits.on.system": "システムでキットをスキャンしています",
"scanning.for.kits": "キットをスキャンしています",
"scanning.for.cmake.kits": "CMake キットをスキャンしています...",
Expand Down
1 change: 0 additions & 1 deletion i18n/kor/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "버전에 대한 검색된 VsKit",
"generator.present": "생성기가 있음: {0}",
"selected.preferred.generator.name": "선택된 기본 설정 생성기 이름: {0} {1}",
"clang.for.msvc": "{2}을(를) 사용하는 Clang {0} {1}({3})",
"scanning.for.kits.on.system": "시스템에서 키트를 검색하는 중",
"scanning.for.kits": "키트를 검색하는 중",
"scanning.for.cmake.kits": "CMake 키트를 검색하는 중...",
Expand Down
1 change: 0 additions & 1 deletion i18n/plk/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "Wykryto zestaw VsKit dla wersji",
"generator.present": "Generator jest dostępny: {0}",
"selected.preferred.generator.name": "Nazwa wybranego preferowanego generatora: {0} {1}",
"clang.for.msvc": "Clang {0}, {1} dla architektury {2} ({3})",
"scanning.for.kits.on.system": "Trwa skanowanie w poszukiwaniu zestawów w systemie",
"scanning.for.kits": "Skanowanie w poszukiwaniu zestawów",
"scanning.for.cmake.kits": "Trwa skanowanie w poszukiwaniu zestawów narzędzia CMake...",
Expand Down
1 change: 0 additions & 1 deletion i18n/ptb/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "Detectado VsKit para a versão",
"generator.present": "Gerador Presente: {0}",
"selected.preferred.generator.name": "Nome do Gerador Preferencial Selecionado: {0} {1}",
"clang.for.msvc": "Clang {0} {1} com {2} ({3})",
"scanning.for.kits.on.system": "Examinando o sistema em busca de Kits",
"scanning.for.kits": "Examinando em busca de kits",
"scanning.for.cmake.kits": "Examinando em busca de kits do CMake...",
Expand Down
1 change: 0 additions & 1 deletion i18n/rus/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "Обнаружен VsKit для версии.",
"generator.present": "Генератор существует: {0}",
"selected.preferred.generator.name": "Выбранное предпочтительное имя генератора: {0} {1}",
"clang.for.msvc": "Clang {0} для {1} {2} ({3})",
"scanning.for.kits.on.system": "Поиск наборов в системе.",
"scanning.for.kits": "Поиск наборов.",
"scanning.for.cmake.kits": "Поиск наборов CMake…",
Expand Down
1 change: 0 additions & 1 deletion i18n/trk/src/kit.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"detected.kit.for.version": "Sürüm için VsKit algılandı",
"generator.present": "Mevcut Oluşturucu: {0}",
"selected.preferred.generator.name": "Seçili Tercih Edilen Oluşturucu Adı: {0} {1}",
"clang.for.msvc": "{2} ({3}) ile Clang {0} {1}",
"scanning.for.kits.on.system": "Sistemdeki Setler için taranıyor",
"scanning.for.kits": "Setler için taranıyor",
"scanning.for.cmake.kits": "CMake setleri için taranıyor...",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cmake-tools",
"displayName": "CMake Tools",
"description": "Extended CMake support in Visual Studio Code",
"version": "1.5.2",
"version": "1.5.3",
"publisher": "ms-vscode",
"repository": {
"type": "git",
Expand Down
20 changes: 12 additions & 8 deletions src/cmake-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {CMakeFileApiDriver} from '@cmt/drivers/cmfileapi-driver';
import * as nls from 'vscode-nls';
import {CMakeToolsFolder} from './folders';
import {ConfigurationWebview} from './cache-view';
import {enableFullFeatureSet} from './extension';
import {enableFullFeatureSet, registerTaskProvider} from './extension';

nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
Expand Down Expand Up @@ -428,6 +428,9 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
this._targetName.set(this.defaultBuildTarget || drv.allTargetName);
await this._ctestController.reloadTests(drv);

// Make sure to re-register the task provider when a new driver is created
await registerTaskProvider(await this.tasksBuildCommandDrv(drv));

// All set up. Fulfill the driver promise.
return drv;
}
Expand Down Expand Up @@ -655,6 +658,7 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
this._codeModelDriverSub = drv.onCodeModelChanged(cm => { this._codeModel.set(cm); });
}
}

return this._cmakeDriver;
});
}
Expand Down Expand Up @@ -925,18 +929,18 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
}
}

async tasksBuildCommandDrv(drv: CMakeDriver): Promise<string | null> {
const target = this.workspaceContext.state.defaultBuildTarget || drv.allTargetName;
const buildargs = await drv.getCMakeBuildCommand(target);
return (buildargs) ? buildCmdStr(buildargs.command, buildargs.args) : null;
}

/**
* Implementation of `cmake.tasksBuildCommand`
*/
async tasksBuildCommand(): Promise<string|null> {
const drv = await this.getCMakeDriverInstance();
if (!drv) {
throw new Error(localize('cmake.drive.died.during.tasksbuildcommend', 'CMake driver died during tasksBuildCommand'));
}

const target = this.workspaceContext.state.defaultBuildTarget || await this.allTargetName;
const buildargs = await drv.getCMakeBuildCommand(target);
return (buildargs) ? buildCmdStr(buildargs.command, buildargs.args) : null;
return drv ? this.tasksBuildCommandDrv(drv) : null;
}

private m_promise_build: Promise<number> = Promise.resolve(0);
Expand Down
24 changes: 14 additions & 10 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ class ExtensionManager implements vscode.Disposable {

build(folder?: vscode.WorkspaceFolder, name?: string) { return this.mapCMakeToolsFolder(cmt => cmt.build(name), folder, true); }

buildAll(name: string[]) { return this.mapCMakeToolsAll(cmt => cmt.build(util.isArrayOfString(name) ? name[-1] : name), true); }
buildAll(name: string[]) { return this.mapCMakeToolsAll(cmt => cmt.build(util.isArrayOfString(name) ? name[name.length - 1] : name), true); }

setDefaultTarget(folder?: vscode.WorkspaceFolder, name?: string) { return this.mapCMakeToolsFolder(cmt => cmt.setDefaultTarget(name), folder); }

Expand Down Expand Up @@ -1009,7 +1009,7 @@ class ExtensionManager implements vscode.Disposable {
return this.mapQueryCMakeTools(async cmt => (await cmt.executableTargets).map(target => target.name), folder);
}

tasksBuildCommand(folder?: vscode.WorkspaceFolder | string) {
async tasksBuildCommand(folder?: vscode.WorkspaceFolder | string) {
telemetry.logEvent("substitution", {command: "tasksBuildCommand"});
return this.mapQueryCMakeTools(cmt => cmt.tasksBuildCommand(), folder);
}
Expand Down Expand Up @@ -1083,6 +1083,18 @@ class ExtensionManager implements vscode.Disposable {
let _EXT_MANAGER: ExtensionManager|null = null;
let cmakeTaskProvider: vscode.Disposable | undefined;

export async function registerTaskProvider(command: string | null) {
if (command) {
rollbar.invokeAsync(localize('registerTaskProvider', 'Register the task provider.'), async () => {
if (cmakeTaskProvider) {
cmakeTaskProvider.dispose();
}

cmakeTaskProvider = vscode.tasks.registerTaskProvider(CMakeTaskProvider.CMakeType, new CMakeTaskProvider({ build: command }));
});
}
}

async function setup(context: vscode.ExtensionContext, progress: ProgressHandle) {
reportProgress(progress, localize('initial.setup', 'Initial setup'));

Expand Down Expand Up @@ -1222,14 +1234,6 @@ async function setup(context: vscode.ExtensionContext, progress: ProgressHandle)
vscode.commands.registerCommand('cmake.outline.selectWorkspace',
(what: WorkspaceFolderNode) => runCommand('selectWorkspace', what.wsFolder)),
]);

// Register a task provider to resolve tasks
// TODO: extend
rollbar.invokeAsync(localize('registerTaskProvider', 'Register the task provider.'), async () => {
cmakeTaskProvider = vscode.tasks.registerTaskProvider(CMakeTaskProvider.CMakeType, new CMakeTaskProvider({
build: await ext.tasksBuildCommand()
}));
});
}

class SchemaProvider implements vscode.TextDocumentContentProvider {
Expand Down
2 changes: 1 addition & 1 deletion src/folders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class CMakeToolsFolderController implements vscode.Disposable {
get(ws: vscode.WorkspaceFolder | Array<string> | undefined): CMakeToolsFolder | undefined {
if (ws) {
if (util.isArrayOfString(ws)) {
return this._instances.get(ws[-1]);
return this._instances.get(ws[ws.length - 1]);
} else if (util.isWorkspaceFolder(ws)) {
const folder = ws as vscode.WorkspaceFolder;
return this._instances.get(folder.uri.fsPath);
Expand Down
4 changes: 3 additions & 1 deletion src/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,9 @@ async function scanDirForClangForMSVCKits(dir: string, vsInstalls: VSInstallatio
if (binPath.startsWith(`${vs.installationPath}\\VC\\Tools\\Llvm\\${clangArch}bin`) &&
util.checkFileExists(util.lightNormalizePath(binPath))) {
clangKits.push({
name: localize('clang.for.msvc', 'Clang {0} {1} with {2} ({3})', version.version, clang_cli, install_name, vs_arch),
name: localize({key: 'clang.for.vsmsvc',
comment: ["Clang should stay at the beginning of the string as it is used in UI sorting"]},
'Clang {0} {1} with {2} ({3})', version.version, clang_cli, install_name, vs_arch),
visualStudio: kitVSName(vs),
visualStudioArchitecture: vs_arch,
compilers: {
Expand Down

0 comments on commit 92f045f

Please sign in to comment.