@@ -11,11 +11,9 @@ import { addCoverageData, GnatcovFileCoverage } from './gnatcov';
1111import { getScenarioArgs } from './gnatTaskProvider' ;
1212import { escapeRegExp , exe , setTerminalEnvironment , slugify } from './helpers' ;
1313import {
14- DEFAULT_PROBLEM_MATCHERS ,
1514 findTaskByName ,
1615 getOrCreateTask ,
1716 runTaskSequence ,
18- SimpleTaskDef ,
1917 TASK_BUILD_TEST_DRIVER ,
2018 TASK_GNATCOV_SETUP ,
2119 TASK_TYPE_ADA ,
@@ -732,29 +730,38 @@ async function handleRunRequestedTests(
732730 * Produce a GNATcov XML report
733731 */
734732 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+ ) ;
758765 const result = await runTaskSequence ( [ gnatcovReportTask ] , new WriteEmitter ( run ) ) ;
759766 if ( result != 0 ) {
760767 const msg =
0 commit comments