@@ -477,15 +477,6 @@ public bool ReportIVTs
477477
478478 #endregion
479479
480- // ToolExe delegates back to ToolName if the override is not
481- // set. So, if ToolExe == ToolName, we know ToolExe is not
482- // explicitly overridden. So, if both ToolPath is unset and
483- // ToolExe == ToolName, we know nothing is overridden, and
484- // we can use our own csc.
485- private bool HasToolBeenOverridden => ! ( string . IsNullOrEmpty ( ToolPath ) && ToolExe == ToolName ) ;
486-
487- protected sealed override bool IsManagedTool => ! HasToolBeenOverridden ;
488-
489480 /// <summary>
490481 /// Method for testing only
491482 /// </summary>
@@ -494,10 +485,6 @@ public string GeneratePathToTool()
494485 return GenerateFullPathToTool ( ) ;
495486 }
496487
497- protected sealed override string PathToManagedTool => Utilities . GenerateFullPathToTool ( ToolName ) ;
498-
499- protected sealed override string PathToNativeTool => Path . Combine ( ToolPath ?? "" , ToolExe ) ;
500-
501488 protected override int ExecuteTool ( string pathToTool , string responseFileCommands , string commandLineCommands )
502489 {
503490 using var logger = new CompilerServerLogger ( $ "MSBuild { Process . GetCurrentProcess ( ) . Id } ") ;
@@ -508,8 +495,7 @@ internal int ExecuteTool(string pathToTool, string responseFileCommands, string
508495 {
509496 if ( ProvideCommandLineArgs )
510497 {
511- CommandLineArgs = GetArguments ( commandLineCommands , responseFileCommands )
512- . Select ( arg => new TaskItem ( arg ) ) . ToArray ( ) ;
498+ CommandLineArgs = GenerateCommandLineArgsTaskItems ( responseFileCommands ) ;
513499 }
514500
515501 if ( SkipCompilerExecution )
@@ -526,7 +512,7 @@ internal int ExecuteTool(string pathToTool, string responseFileCommands, string
526512 string ? tempDirectory = BuildServerConnection . GetTempPath ( workingDirectory ) ;
527513
528514 if ( ! UseSharedCompilation ||
529- HasToolBeenOverridden ||
515+ ! IsManagedTool ||
530516 ! BuildServerConnection . IsCompilerServerSupported )
531517 {
532518 LogCompilationMessage ( logger , requestId , CompilationKind . Tool , $ "using command line tool by design '{ pathToTool } '") ;
@@ -550,7 +536,7 @@ internal int ExecuteTool(string pathToTool, string responseFileCommands, string
550536 var buildRequest = BuildServerConnection . CreateBuildRequest (
551537 requestId ,
552538 Language ,
553- GetArguments ( ToolArguments , responseFileCommands ) . ToList ( ) ,
539+ GenerateCommandLineArgsList ( responseFileCommands ) ,
554540 workingDirectory : workingDirectory ,
555541 tempDirectory : tempDirectory ,
556542 keepAlive : null ,
@@ -804,66 +790,19 @@ private void LogCompilationMessage(ICompilerServerLogger logger, Guid requestId,
804790 }
805791 }
806792
807- public string GenerateResponseFileContents ( )
808- {
809- return GenerateResponseFileCommands ( ) ;
810- }
811-
812- /// <summary>
813- /// Get the command line arguments to pass to the compiler.
814- /// </summary>
815- private string [ ] GetArguments ( string commandLineCommands , string responseFileCommands )
816- {
817- var commandLineArguments =
818- CommandLineUtilities . SplitCommandLineIntoArguments ( commandLineCommands , removeHashComments : true ) ;
819- var responseFileArguments =
820- CommandLineUtilities . SplitCommandLineIntoArguments ( responseFileCommands , removeHashComments : true ) ;
821- return commandLineArguments . Concat ( responseFileArguments ) . ToArray ( ) ;
822- }
823-
824- /// <summary>
825- /// Returns the command line switch used by the tool executable to specify the response file
826- /// Will only be called if the task returned a non empty string from GetResponseFileCommands
827- /// Called after ValidateParameters, SkipTaskExecution and GetResponseFileCommands
828- /// </summary>
829- protected override string GenerateResponseFileCommands ( )
830- {
831- CommandLineBuilderExtension commandLineBuilder = new CommandLineBuilderExtension ( ) ;
832- AddResponseFileCommands ( commandLineBuilder ) ;
833- return commandLineBuilder . ToString ( ) ;
834- }
835-
836- /// <summary>
837- /// Method for testing only
838- /// </summary>
839- public string GenerateCommandLine ( )
840- {
841- return GenerateCommandLineCommands ( ) ;
842- }
843-
844- protected sealed override string ToolArguments
845- {
846- get
847- {
848- var builder = new CommandLineBuilderExtension ( ) ;
849- AddCommandLineCommands ( builder ) ;
850- return builder . ToString ( ) ;
851- }
852- }
853-
854793 /// <summary>
855794 /// Fills the provided CommandLineBuilderExtension with those switches and other information that can't go into a response file and
856795 /// must go directly onto the command line.
857796 /// </summary>
858- protected internal virtual void AddCommandLineCommands ( CommandLineBuilderExtension commandLine )
797+ protected override void AddCommandLineCommands ( CommandLineBuilderExtension commandLine )
859798 {
860799 commandLine . AppendWhenTrue ( "/noconfig" , _store , nameof ( NoConfig ) ) ;
861800 }
862801
863802 /// <summary>
864803 /// Fills the provided CommandLineBuilderExtension with those switches and other information that can go into a response file.
865804 /// </summary>
866- protected internal virtual void AddResponseFileCommands ( CommandLineBuilderExtension commandLine )
805+ protected override void AddResponseFileCommands ( CommandLineBuilderExtension commandLine )
867806 {
868807 // If outputAssembly is not specified, then an "/out: <name>" option won't be added to
869808 // overwrite the one resulting from the OutputAssembly member of the CompilerParameters class.
0 commit comments