@@ -11,11 +11,9 @@ import { addCoverageData, GnatcovFileCoverage } from './gnatcov';
11
11
import { getScenarioArgs } from './gnatTaskProvider' ;
12
12
import { escapeRegExp , exe , setTerminalEnvironment , slugify } from './helpers' ;
13
13
import {
14
- DEFAULT_PROBLEM_MATCHERS ,
15
14
findTaskByName ,
16
15
getOrCreateTask ,
17
16
runTaskSequence ,
18
- SimpleTaskDef ,
19
17
TASK_BUILD_TEST_DRIVER ,
20
18
TASK_GNATCOV_SETUP ,
21
19
TASK_TYPE_ADA ,
@@ -732,29 +730,38 @@ async function handleRunRequestedTests(
732
730
* Produce a GNATcov XML report
733
731
*/
734
732
const outputDir = await getGnatCovXMLReportDir ( ) ;
735
- const adaTP = adaExtState . getAdaTaskProvider ( ) ! ;
736
- const gnatcovReportTask = ( await adaTP . resolveTask (
737
- new vscode . Task (
738
- {
739
- type : TASK_TYPE_ADA ,
740
- command : 'gnatcov' ,
741
- args : [
742
- 'coverage' ,
743
- '-P' ,
744
- await getGnatTestDriverProjectPath ( ) ,
745
- '--level=stmt' ,
746
- '--annotate=xml' ,
747
- `--output-dir=${ outputDir } ` ,
748
- ] . concat ( testsToRun . map ( getTracePath ) ) ,
749
- } ,
750
- vscode . TaskScope . Workspace ,
751
- `Create GNATcoverage XML report` ,
752
- TASK_TYPE_ADA ,
753
- undefined ,
754
- DEFAULT_PROBLEM_MATCHERS ,
755
- ) ,
756
- ) ) ! ;
757
- gnatcovReportTask . presentationOptions . reveal = vscode . TaskRevealKind . Never ;
733
+ /**
734
+ * Use a trace list file with gnatcov for 2 reasons:
735
+ *
736
+ * 1. Avoid any potential limitation on the number of process
737
+ * arguments in case we are dealing with a large number of traces.
738
+ *
739
+ * 2. Keep a constant command line instead of having a different
740
+ * command line for every run. Different command lines would create
741
+ * multiple copies of the task with the same name in the VS Code
742
+ * UI.
743
+ */
744
+ const traceListFile = path . join (
745
+ await adaExtState . getVSCodeObjectSubdir ( ) ,
746
+ 'traces.list' ,
747
+ ) ;
748
+ fs . writeFileSync ( traceListFile , testsToRun . map ( getTracePath ) . join ( '\n' ) ) ;
749
+ const gnatcovReportTask = await getOrCreateTask (
750
+ `Create GNATcoverage XML report` ,
751
+ async ( ) => ( {
752
+ type : TASK_TYPE_ADA ,
753
+ command : 'gnatcov' ,
754
+ args : [
755
+ 'coverage' ,
756
+ '-P' ,
757
+ await getGnatTestDriverProjectPath ( ) ,
758
+ '--level=stmt' ,
759
+ '--annotate=xml' ,
760
+ `--output-dir=${ outputDir } ` ,
761
+ `--trace=@${ traceListFile } ` ,
762
+ ] ,
763
+ } ) ,
764
+ ) ;
758
765
const result = await runTaskSequence ( [ gnatcovReportTask ] , new WriteEmitter ( run ) ) ;
759
766
if ( result != 0 ) {
760
767
const msg =
0 commit comments