re-implement hide of nuget api key in build logs, add more tests for it
[teamcity/dotNetPackagesSupport.git] / nuget-agent / src / jetbrains / buildServer / nuget / agent / util / impl / CommandlineBuildProcessFactoryImpl.java
index deeb1ad3b8be05f69a59381d6be8c395e63ebf05..ab47ec445d8fa395fe225b698bb39fb724f8366d 100644 (file)
@@ -20,11 +20,11 @@ import jetbrains.buildServer.RunBuildException;
 import jetbrains.buildServer.agent.BuildProcess;\r
 import jetbrains.buildServer.agent.BuildProcessFacade;\r
 import jetbrains.buildServer.agent.BuildRunnerContext;\r
-import jetbrains.buildServer.agent.runner.ProgramCommandLine;\r
 import jetbrains.buildServer.nuget.agent.util.CommandlineBuildProcessFactory;\r
 import jetbrains.buildServer.runner.SimpleRunnerConstants;\r
 import org.jetbrains.annotations.NotNull;\r
 \r
+import java.io.File;\r
 import java.util.Collection;\r
 import java.util.Map;\r
 \r
@@ -39,22 +39,26 @@ public class CommandlineBuildProcessFactoryImpl implements CommandlineBuildProce
     myFacade = facade;\r
   }\r
 \r
-  public BuildProcess executeCommandLine(@NotNull final BuildRunnerContext hostContext,\r
-                                         @NotNull final ProgramCommandLine cmd) throws RunBuildException {\r
+  @NotNull\r
+  public BuildProcess executeCommandLine(@NotNull BuildRunnerContext hostContext,\r
+                                         @NotNull String program,\r
+                                         @NotNull Collection<String> argz,\r
+                                         @NotNull File workingDir,\r
+                                         @NotNull final Map<String, String> additionalEnvironment) throws RunBuildException {\r
     BuildRunnerContext context = myFacade.createBuildRunnerContext(\r
             hostContext.getBuild(),\r
             SimpleRunnerConstants.TYPE,\r
-            cmd.getWorkingDirectory(),\r
+            workingDir.getPath(),\r
             hostContext\r
     );\r
 \r
-    context.addRunnerParameter(SimpleRunnerConstants.COMMAND_EXECUTABLE, cmd.getExecutablePath());\r
-    context.addRunnerParameter(SimpleRunnerConstants.COMMAND_PARAMETERS, joinCommandLineArguments(cmd.getArguments()));\r
-\r
-    for (Map.Entry<String, String> e : cmd.getEnvironment().entrySet()) {\r
-      context.addEnvironmentVariable(e.getKey(), e.getValue());\r
+    for (Map.Entry<String, String> entry : additionalEnvironment.entrySet()) {\r
+      context.addEnvironmentVariable(entry.getKey(), entry.getValue());\r
     }\r
 \r
+    context.addRunnerParameter(SimpleRunnerConstants.COMMAND_EXECUTABLE, program);\r
+    context.addRunnerParameter(SimpleRunnerConstants.COMMAND_PARAMETERS, joinCommandLineArguments(argz));\r
+\r
     return myFacade.createExecutable(hostContext.getBuild(), context);\r
   }\r
 \r