From 7286fc0951dca958c80853bd02a0ed0edaf79c5a Mon Sep 17 00:00:00 2001 From: Andreas Franek Date: Thu, 16 May 2019 13:13:32 +0200 Subject: [PATCH 1/2] conditionally add install targetcmake-server does not give an install target in project targets.Hence, we add one if there is a project with an install rule.closes #504 --- src/cms-client.ts | 1 + src/cms-driver.ts | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/cms-client.ts b/src/cms-client.ts index e0e66b642..6c7d30041 100644 --- a/src/cms-client.ts +++ b/src/cms-client.ts @@ -248,6 +248,7 @@ export interface CodeModelProject { sourceDirectory: string; buildDirectory: string; targets: CodeModelTarget[]; + hasInstallRule: boolean; } export interface CodeModelConfiguration { diff --git a/src/cms-driver.ts b/src/cms-driver.ts index 3a38457b6..e8492f11d 100644 --- a/src/cms-driver.ts +++ b/src/cms-driver.ts @@ -159,6 +159,21 @@ export class CMakeServerClientDriver extends CMakeDriver { log.error('Found no matching code model for the current build type. This shouldn\'t be possible'); return []; } + const metaTargets = [{ + type: 'rich' as 'rich', + name: this.allTargetName, + filepath: 'A special target to build all available targets', + targetType: 'META', + }]; + if(build_config.projects.some(project => project.hasInstallRule)) + { + metaTargets.push({ + type: 'rich' as 'rich', + name: 'install', + filepath: 'A special target to install all available targets', + targetType: 'META', + }); + } return build_config.projects.reduce((acc, project) => acc.concat(project.targets.map( t => ({ type: 'rich' as 'rich', @@ -168,12 +183,7 @@ export class CMakeServerClientDriver extends CMakeDriver { : 'Utility target', targetType: t.type, }))), - [{ - type: 'rich' as 'rich', - name: this.allTargetName, - filepath: 'A special target to build all available targets', - targetType: 'META', - }]); + metaTargets); } get executableTargets(): ExecutableTarget[] { From e7a132109bd3548c3a82147c2ea106a6d3d5dfb9 Mon Sep 17 00:00:00 2001 From: Andreas Franek Date: Thu, 23 May 2019 15:41:07 +0200 Subject: [PATCH 2/2] fixup: make CodeModelProject.hasInstallRule optional --- src/cms-client.ts | 2 +- src/cms-driver.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cms-client.ts b/src/cms-client.ts index 6c7d30041..e159d5e69 100644 --- a/src/cms-client.ts +++ b/src/cms-client.ts @@ -248,7 +248,7 @@ export interface CodeModelProject { sourceDirectory: string; buildDirectory: string; targets: CodeModelTarget[]; - hasInstallRule: boolean; + hasInstallRule?: boolean; } export interface CodeModelConfiguration { diff --git a/src/cms-driver.ts b/src/cms-driver.ts index e8492f11d..4c183e656 100644 --- a/src/cms-driver.ts +++ b/src/cms-driver.ts @@ -165,7 +165,7 @@ export class CMakeServerClientDriver extends CMakeDriver { filepath: 'A special target to build all available targets', targetType: 'META', }]; - if(build_config.projects.some(project => project.hasInstallRule)) + if(build_config.projects.some(project => (project.hasInstallRule)? project.hasInstallRule: false)) { metaTargets.push({ type: 'rich' as 'rich',