@@ -97,23 +97,23 @@ public static String developmentScannerVersion() {
9797 return "99" ;
9898 }
9999
100- // ToDo: SCAN4NET-201: Remove Orchestrator
100+ // ToDo: SCAN4NET-201: Remove this, after SCAN4NET-320 or SCAN4NET199 will stop using it
101101 public static ScannerCommand newScannerBegin (Orchestrator orchestrator , String projectKey , Path projectDir , String token ) {
102102 // ToDo: Cleanup inconsistent "end" logic. For now, this defaults to "end" step and caller must override it
103103 return ScannerCommand .createBeginStep (ScannerClassifier .NET_FRAMEWORK , token , projectDir , projectKey );
104104 }
105105
106- // ToDo: SCAN4NET-201: Remove Orchestrator
106+ // ToDo: SCAN4NET-201: Remove this, after SCAN4NET-320 or SCAN4NET199 will stop using it
107107 public static ScannerCommand newScannerBegin (Orchestrator orchestrator , String projectKey , Path projectDir , String token , ScannerClassifier classifier ) {
108108 return ScannerCommand .createBeginStep (classifier , token , projectDir , projectKey );
109109 }
110110
111- // ToDo: SCAN4NET-201: Remove Orchestrator
111+ // ToDo: SCAN4NET-201: Remove this, after SCAN4NET-320 or SCAN4NET199 will stop using it
112112 public static ScannerCommand newScannerEnd (Orchestrator orchestrator , Path projectDir , String token ) {
113113 return ScannerCommand .createEndStep (ScannerClassifier .NET_FRAMEWORK , token , projectDir );
114114 }
115115
116- // ToDo: SCAN4NET-201: Remove Orchestrator
116+ // ToDo: SCAN4NET-201: Remove this, after SCAN4NET-320 or SCAN4NET199 will stop using it
117117 public static ScannerCommand newScannerEnd (Orchestrator orchestrator , Path projectDir , ScannerClassifier classifier , String token ) {
118118 return ScannerCommand .createEndStep (classifier , token , projectDir );
119119 }
@@ -165,14 +165,18 @@ public static void deleteVirtualDrive(String drive) {
165165 assertThat (cleanupStatus ).isZero ();
166166 }
167167
168- public static Path projectDir (Path temp , String projectName ) throws IOException {
169- File projectToCopy = Paths .get ("projects" ).resolve (projectName ).toFile ();
170- File destination = new File (temp .toFile (), projectName ).getCanonicalFile ();
171- FileUtils .deleteDirectory (destination );
172- Path newFolder = Files .createDirectories (destination .toPath ());
173- FileUtils .copyDirectory (projectToCopy , newFolder .toFile ());
174- Files .copy (Paths .get (".." , "NuGet.Config" ), newFolder .resolve ("NuGet.Config" ));
175- return newFolder ;
168+ public static Path projectDir (Path temp , String projectName ) {
169+ try {
170+ File projectToCopy = Paths .get ("projects" ).resolve (projectName ).toFile ();
171+ File destination = new File (temp .toFile (), projectName ).getCanonicalFile ();
172+ FileUtils .deleteDirectory (destination );
173+ Path newFolder = Files .createDirectories (destination .toPath ());
174+ FileUtils .copyDirectory (projectToCopy , newFolder .toFile ());
175+ Files .copy (Paths .get (".." , "NuGet.Config" ), newFolder .resolve ("NuGet.Config" ));
176+ return newFolder ;
177+ } catch (IOException ex ) {
178+ throw new RuntimeException (ex .getMessage (), ex );
179+ }
176180 }
177181
178182 public static void runMSBuildWithBuildWrapper (Orchestrator orch , Path projectDir , File buildWrapperPath , File outDir ,
@@ -193,20 +197,24 @@ public static void updateSetting(Orchestrator orchestrator, String projectKey, S
193197 newWsClient (orchestrator ).settings ().set (new SetRequest ().setComponent (projectKey ).setKey (propertyKey ).setValues (values ));
194198 }
195199
200+ // ToDo: SCAN4NET-10 will move/deprecate/remove this in favor of BuildCommand
196201 public static void runMSBuild (Orchestrator orch , Path projectDir , String ... arguments ) {
197202 runMSBuild (orch , projectDir , Collections .emptyList (), TIMEOUT_LIMIT , arguments );
198203 }
199204
200- public static void buildMSBuild (Orchestrator orchestrator , Path projectDir ) {
201- runMSBuild (orchestrator , projectDir , Collections .emptyList (), TIMEOUT_LIMIT , "/t:Restore,Rebuild" );
205+ // ToDo: SCAN4NET-10 will move/deprecate/remove this in favor of BuildCommand
206+ public static BuildResult buildMSBuild (Orchestrator orchestrator , Path projectDir ) {
207+ return runMSBuild (orchestrator , projectDir , Collections .emptyList (), TIMEOUT_LIMIT , "/t:Restore,Rebuild" );
202208 }
203209
210+ // ToDo: SCAN4NET-10 will move/deprecate/remove this in favor of BuildCommand
204211 public static BuildResult runMSBuild (Orchestrator orch , Path projectDir , List <EnvironmentVariable > environmentVariables , long timeoutLimit , String ... arguments ) {
205212 BuildResult r = runMSBuildQuietly (orch , projectDir , environmentVariables , timeoutLimit , arguments );
206213 assertThat (r .isSuccess ()).isTrue ();
207214 return r ;
208215 }
209216
217+ // ToDo: Move to AnalysisContext
210218 public static void runNuGet (Orchestrator orch , Path projectDir , Boolean useDefaultVSCodeMSBuild , String ... arguments ) {
211219 Path nugetPath = getNuGetPath (orch );
212220 var nugetRestore = Command .create (nugetPath .toString ())
@@ -221,10 +229,12 @@ public static void runNuGet(Orchestrator orch, Path projectDir, Boolean useDefau
221229 assertThat (r ).isZero ();
222230 }
223231
232+ // ToDo: SCAN4NET-10 will move/deprecate/remove this in favor of BuildCommand
224233 public static BuildResult runDotnetCommand (Path workingDir , String dotnetCommand , String ... arguments ) {
225234 return runDotnetCommand (workingDir , Collections .emptyList (), dotnetCommand , arguments );
226235 }
227236
237+ // ToDo: SCAN4NET-10 will move/deprecate/remove this in favor of BuildCommand
228238 public static BuildResult runDotnetCommand (Path workingDir , List <EnvironmentVariable > environmentVariables , String dotnetCommand , String ... arguments ) {
229239 var argumentList = new ArrayList <>(Arrays .asList (arguments ));
230240 argumentList .add (0 , dotnetCommand );
@@ -255,6 +265,7 @@ private static Path getNuGetPath(Orchestrator orch) {
255265 return nugetPath ;
256266 }
257267
268+ // ToDo: SCAN4NET-10 will move/deprecate/remove this in favor of BuildCommand
258269 private static BuildResult runMSBuildQuietly (Orchestrator orch , Path projectDir , List <EnvironmentVariable > environmentVariables , long timeoutLimit , String ... arguments ) {
259270 Path msBuildPath = getMsBuildPath (orch );
260271
@@ -316,6 +327,7 @@ public static void dumpProjectIssues(Orchestrator orchestrator, String projectKe
316327 }
317328 }
318329
330+ @ Deprecated // Use AnalysisContext instead
319331 public static BuildResult runAnalysis (Path projectDir , String projectKey , Boolean useNuGet ) {
320332 String token = TestUtils .getNewToken (ORCHESTRATOR );
321333 String folderName = projectDir .getFileName ().toString ();
@@ -327,15 +339,18 @@ public static BuildResult runAnalysis(Path projectDir, String projectKey, Boolea
327339 return TestUtils .executeEndStepAndDumpResults (ORCHESTRATOR , projectDir , projectKey , token );
328340 }
329341
342+ @ Deprecated // Use AnalysisContext instead
330343 public static BuildResult executeEndStepAndDumpResults (Orchestrator orchestrator , Path projectDir , String projectKey , String token ) {
331344 return executeEndStepAndDumpResults (orchestrator , projectDir , projectKey , token , ScannerClassifier .NET_FRAMEWORK , Collections .emptyList (), Collections .emptyList ());
332345 }
333346
347+ @ Deprecated // Use AnalysisContext instead
334348 public static BuildResult executeEndStepAndDumpResults (Orchestrator orchestrator , Path projectDir , String projectKey , String token ,
335349 List <EnvironmentVariable > environmentVariables ) {
336350 return executeEndStepAndDumpResults (orchestrator , projectDir , projectKey , token , ScannerClassifier .NET_FRAMEWORK , environmentVariables , Collections .emptyList ());
337351 }
338352
353+ @ Deprecated // Use AnalysisContext instead
339354 public static BuildResult executeEndStepAndDumpResults (
340355 Orchestrator orchestrator ,
341356 Path projectDir ,
@@ -346,6 +361,7 @@ public static BuildResult executeEndStepAndDumpResults(
346361 return executeEndStepAndDumpResults (orchestrator , projectDir , projectKey , token , ScannerClassifier .NET_FRAMEWORK , environmentVariables , additionalProperties );
347362 }
348363
364+ @ Deprecated // Use AnalysisContext instead
349365 public static BuildResult executeEndStepAndDumpResults (Orchestrator orchestrator ,
350366 Path projectDir ,
351367 String projectKey ,
@@ -408,6 +424,7 @@ public static String getNewToken(Orchestrator orchestrator) {
408424 return ServerTests .token ();
409425 }
410426
427+ // ToDo: Remove this in SCAN4NET-290
411428 public static boolean hasModules (Orchestrator orch ) {
412429 return !orch .getServer ().version ().isGreaterThanOrEquals (7 , 6 );
413430 }
@@ -468,6 +485,7 @@ private static List<String> extractCeTaskIds(BuildResult buildResult) {
468485 .collect (Collectors .toList ());
469486 }
470487
488+ // ToDo: SCAN4NET-10 will deprecate/remove this. By using AnalysisContext and its environment variable handling, this will not be needed anymore
471489 private static Command initCommandEnvironment (Command command , List <EnvironmentVariable > environmentVariables ) {
472490 var buildDirectory = environmentVariables .stream ().filter (x -> x .name () == AzureDevOps .AGENT_BUILDDIRECTORY ).findFirst ();
473491 if (buildDirectory .isPresent ()) {
0 commit comments