16
16
----------------------------------------------------------------------------*/
17
17
18
18
import assert from 'assert' ;
19
+ import { basename } from 'path' ;
19
20
import * as vscode from 'vscode' ;
20
21
import { CMD_GPR_PROJECT_ARGS } from './commands' ;
21
22
import { adaExtState } from './extension' ;
@@ -120,6 +121,11 @@ const predefinedTasks: PredefinedTask[] = [
120
121
command : 'gnatsas' ,
121
122
args : [ 'analyze' , '${command:ada.gprProjectArgs}' ] ,
122
123
} ,
124
+ /**
125
+ * Analysis results are not printed on stdio so no need to parse them
126
+ * with a problem matcher. Results should be viewed with the
127
+ * `gnatsas report` task below
128
+ */
123
129
problemMatchers : '' ,
124
130
} ,
125
131
{
@@ -129,15 +135,24 @@ const predefinedTasks: PredefinedTask[] = [
129
135
command : 'gnatsas' ,
130
136
args : [ 'analyze' , '${command:ada.gprProjectArgs}' , '--file=${fileBasename}' ] ,
131
137
} ,
138
+ /**
139
+ * Analysis results are not printed on stdio so no need to parse them
140
+ * with a problem matcher. Results should be viewed with the
141
+ * `gnatsas report` task below
142
+ */
132
143
problemMatchers : '' ,
133
144
} ,
134
145
{
135
146
label : 'Create a report after a GNAT SAS analysis' ,
136
147
taskDef : {
137
148
type : TASK_TYPE_ADA ,
138
149
command : 'gnatsas' ,
139
- args : [ 'report' , 'sarif' , '${command:ada.gprProjectArgs}' ] ,
150
+ args : [ 'report' , 'sarif' , '${command:ada.gprProjectArgs}' , '-o' , 'report.sarif' ] ,
140
151
} ,
152
+ /**
153
+ * Analysis results are not printed on stdio so no need to parse them
154
+ * with a problem matcher.
155
+ */
141
156
problemMatchers : '' ,
142
157
} ,
143
158
{
@@ -149,6 +164,10 @@ const predefinedTasks: PredefinedTask[] = [
149
164
'Create a report after a GNAT SAS analysis' ,
150
165
] ,
151
166
} ,
167
+ /**
168
+ * Analysis results are not printed on stdio so no need to parse them
169
+ * with a problem matcher.
170
+ */
152
171
problemMatchers : '' ,
153
172
} ,
154
173
{
@@ -1011,7 +1030,7 @@ function updateToAlire(taskDef: SimpleTaskDef): SimpleTaskDef {
1011
1030
/**
1012
1031
* Only process shell command tasks, if they are not already using ALIRE
1013
1032
*/
1014
- if ( taskDef . command && taskDef . command != 'alr' && taskDef . command != 'alr.exe' ) {
1033
+ if ( taskDef . command && ! isAlire ( taskDef . command ) ) {
1015
1034
/**
1016
1035
* Create a copy of the task definition to modify its properties
1017
1036
*/
@@ -1020,7 +1039,8 @@ function updateToAlire(taskDef: SimpleTaskDef): SimpleTaskDef {
1020
1039
const args = taskDef . args ?. concat ( ) ?? [ ] ;
1021
1040
1022
1041
/**
1023
- * Change command to alire
1042
+ * Change command to alire. No need to use `alr.exe` on Windows, just
1043
+ * `alr` works.
1024
1044
*/
1025
1045
newTaskDef . command = 'alr' ;
1026
1046
@@ -1052,3 +1072,15 @@ function updateToAlire(taskDef: SimpleTaskDef): SimpleTaskDef {
1052
1072
1053
1073
return taskDef ;
1054
1074
}
1075
+
1076
+ /**
1077
+ *
1078
+ * @param command - a string or {@link vscode.ShellQuotedString} from a task definition
1079
+ * @returns true if the command points to ALIRE, i.e. if it's `alr` or `alr.exe`
1080
+ * or a path to those executables.
1081
+ */
1082
+ function isAlire ( command : string | vscode . ShellQuotedString ) : boolean {
1083
+ const value = typeof command == 'string' ? command : command . value ;
1084
+ const commandBasename = basename ( value ) ;
1085
+ return commandBasename . match ( / ^ a l r ( \. e x e ) ? $ / ) != null ;
1086
+ }
0 commit comments