Skip to content

Commit 545f416

Browse files
committed
Merge branch 'topic/vscode-tasks' into 'master'
Reorganize vscode tasks Closes #1179 See merge request eng/ide/ada_language_server!1405
2 parents c92073c + c129aaf commit 545f416

File tree

13 files changed

+1143
-400
lines changed

13 files changed

+1143
-400
lines changed

integration/vscode/ada/package.json

Lines changed: 146 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,142 @@
445445
}
446446
],
447447
"taskDefinitions": [
448+
{
449+
"type": "ada",
450+
"required": [
451+
"configuration"
452+
],
453+
"properties": {
454+
"configuration": {
455+
"type": "object",
456+
"required": [
457+
"kind",
458+
"projectFile"
459+
],
460+
"properties": {
461+
"kind": {
462+
"type": "string",
463+
"description": "Kind of Ada task",
464+
"enum": [
465+
"buildProject",
466+
"checkFile",
467+
"cleanProject",
468+
"buildMain",
469+
"buildAndRunMain"
470+
]
471+
},
472+
"projectFile": {
473+
"type": "string",
474+
"description": "Path to GPR project file",
475+
"default": "${config:ada.projectFile}"
476+
},
477+
"args": {
478+
"type": "array",
479+
"description": "Extra command line arguments"
480+
}
481+
},
482+
"oneOf": [
483+
{
484+
"$comment": "Each oneOf is evaluated regardless of the parent schema. That's why valid properties of the parent must be repeated here in order to be allowed.",
485+
"properties": {
486+
"kind": {
487+
"enum": [
488+
"buildProject",
489+
"checkFile",
490+
"cleanProject"
491+
]
492+
},
493+
"projectFile": true,
494+
"args": true
495+
},
496+
"additionalProperties": false
497+
},
498+
{
499+
"required": [
500+
"main"
501+
],
502+
"$comment": "Each oneOf is evaluated regardless of the parent schema. That's why valid properties of the parent must be repeated here in order to be allowed.",
503+
"properties": {
504+
"kind": {
505+
"enum": [
506+
"buildMain"
507+
]
508+
},
509+
"projectFile": true,
510+
"args": true,
511+
"main": {
512+
"type": "string",
513+
"description": "Path to main source file"
514+
}
515+
},
516+
"additionalProperties": false
517+
},
518+
{
519+
"required": [
520+
"main"
521+
],
522+
"$comment": "Each oneOf is evaluated regardless of the parent schema. That's why valid properties of the parent must be repeated here in order to be allowed.",
523+
"properties": {
524+
"kind": {
525+
"enum": [
526+
"buildAndRunMain"
527+
]
528+
},
529+
"projectFile": true,
530+
"args": true,
531+
"main": {
532+
"type": "string",
533+
"description": "Path to main source file"
534+
},
535+
"executable": {
536+
"type": "string",
537+
"description": "Path to main executable file (if it cannot be computed automatically)"
538+
}
539+
},
540+
"additionalProperties": false
541+
}
542+
]
543+
}
544+
}
545+
},
546+
{
547+
"type": "spark",
548+
"properties": {
549+
"configuration": {
550+
"type": "object",
551+
"required": [
552+
"kind",
553+
"projectFile"
554+
],
555+
"properties": {
556+
"kind": {
557+
"description": "Kind of SPARK task",
558+
"enum": [
559+
"cleanProjectForProof",
560+
"examineProject",
561+
"examineFile",
562+
"examineSubprogram",
563+
"proveProject",
564+
"proveFile",
565+
"proveSubprogram",
566+
"proveRegion",
567+
"proveLine"
568+
]
569+
},
570+
"projectFile": {
571+
"type": "string",
572+
"description": "Path to GPR project file",
573+
"default": "${config:ada.projectFile}"
574+
},
575+
"args": {
576+
"type": "array",
577+
"description": "Extra command line arguments"
578+
}
579+
},
580+
"additionalProperties": false
581+
}
582+
}
583+
},
448584
{
449585
"type": "gnat",
450586
"required": [
@@ -453,11 +589,13 @@
453589
"properties": {
454590
"taskKind": {
455591
"type": "string",
456-
"description": "Tool and action kind"
592+
"description": "Tool and action kind",
593+
"deprecationMessage": "The task type \"gnat\" is deprecated. Use task type \"ada\" or \"spark\" instead."
457594
},
458595
"args": {
459596
"type": "array",
460-
"description": "Extra command arguments"
597+
"description": "Extra command line arguments",
598+
"deprecationMessage": "The task type \"gnat\" is deprecated. Use task type \"ada\" or \"spark\" instead."
461599
}
462600
}
463601
},
@@ -469,15 +607,18 @@
469607
"properties": {
470608
"projectFile": {
471609
"type": "string",
472-
"description": "The project file"
610+
"description": "The project file",
611+
"deprecationMessage": "The task type \"gpr\" is deprecated. Use task type \"ada\" instead."
473612
},
474613
"main": {
475614
"type": "string",
476-
"description": "The main file targeted"
615+
"description": "The main file targeted",
616+
"deprecationMessage": "The task type \"gpr\" is deprecated. Use task type \"ada\" instead."
477617
},
478618
"executable": {
479619
"type": "string",
480-
"description": "The related executable"
620+
"description": "The related executable",
621+
"deprecationMessage": "The task type \"gpr\" is deprecated. Use task type \"ada\" instead."
481622
}
482623
}
483624
}

integration/vscode/ada/src/clients.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { mainLogChannel } from './extension';
1111
import GnatTaskProvider from './gnatTaskProvider';
1212
import GprTaskProvider from './gprTaskProvider';
1313
import { logErrorAndThrow } from './helpers';
14+
import { registerTaskProviders } from './taskProviders';
1415

1516
export class ContextClients {
1617
public readonly gprClient: LanguageClient;
@@ -57,7 +58,7 @@ export class ContextClients {
5758
GprTaskProvider.gprTaskType,
5859
new GprTaskProvider(this.adaClient)
5960
),
60-
];
61+
].concat(registerTaskProviders());
6162
};
6263

6364
public unregisterTaskProviders = (): void => {

integration/vscode/ada/src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { SymbolKind } from 'vscode';
33
import { ContextClients } from './clients';
44
import { getOrAskForProgram } from './debugConfigProvider';
55
import { mainLogChannel } from './extension';
6-
import { getEnclosingSymbol } from './gnatTaskProvider';
6+
import { getEnclosingSymbol } from './taskProviders';
77

88
export function registerCommands(context: vscode.ExtensionContext, clients: ContextClients) {
99
context.subscriptions.push(

integration/vscode/ada/src/debugConfigProvider.ts

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'assert';
22
import * as vscode from 'vscode';
33
import { contextClients } from './extension';
4-
import { getExecutables, getMains, getProjectFile } from './helpers';
4+
import { AdaMain, getAdaMains, getProjectFile } from './helpers';
55

66
/**
77
* Ada Configuration for a debug session
@@ -244,54 +244,6 @@ const setupCmd = [
244244
},
245245
];
246246

247-
/**
248-
* A class that represents an Ada main entry point. It encapsulate both the
249-
* source file path and the executable file path.
250-
*/
251-
class AdaMain {
252-
mainFullPath: string;
253-
execFullPath: string;
254-
constructor(mainFullPath: string, execFullPath: string) {
255-
this.mainFullPath = mainFullPath;
256-
this.execFullPath = execFullPath;
257-
}
258-
259-
/**
260-
* @returns path of the main source file relative to the workspace
261-
*/
262-
mainRelPath(): string {
263-
return vscode.workspace.asRelativePath(this.mainFullPath);
264-
}
265-
266-
/**
267-
* @returns path of the executable file relative to the workspace
268-
*/
269-
execRelPath(): string {
270-
return vscode.workspace.asRelativePath(this.execFullPath);
271-
}
272-
}
273-
274-
/**
275-
* @returns The list of Mains defined for the current project as an array of AdaMains.
276-
*/
277-
async function getAdaMains(): Promise<AdaMain[]> {
278-
const mains = await getMains(contextClients.adaClient);
279-
const execs = await getExecutables(contextClients.adaClient);
280-
assert(
281-
execs.length == mains.length,
282-
`The ALS returned mains.length = ${mains.length} and ` +
283-
`execs.length = ${execs.length}` +
284-
`when they should be equal`
285-
);
286-
287-
const result: AdaMain[] = [];
288-
for (let i = 0; i < mains.length; i++) {
289-
result.push(new AdaMain(mains[i], execs[i]));
290-
}
291-
292-
return result;
293-
}
294-
295247
type QuickPickAdaMain = {
296248
label: string;
297249
description: string;

0 commit comments

Comments
 (0)