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 18fcd0c393ac0fb82847809738e90e3645c05051..ab47ec445d8fa395fe225b698bb39fb724f8366d 100644 (file)
@@ -26,6 +26,7 @@ import org.jetbrains.annotations.NotNull;
 \r
 import java.io.File;\r
 import java.util.Collection;\r
+import java.util.Map;\r
 \r
 /**\r
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
@@ -38,10 +39,12 @@ public class CommandlineBuildProcessFactoryImpl implements CommandlineBuildProce
     myFacade = facade;\r
   }\r
 \r
+  @NotNull\r
   public BuildProcess executeCommandLine(@NotNull BuildRunnerContext hostContext,\r
-                                         @NotNull File program,\r
+                                         @NotNull String program,\r
                                          @NotNull Collection<String> argz,\r
-                                         @NotNull File workingDir) throws RunBuildException {\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
@@ -49,7 +52,11 @@ public class CommandlineBuildProcessFactoryImpl implements CommandlineBuildProce
             hostContext\r
     );\r
 \r
-    context.addRunnerParameter(SimpleRunnerConstants.COMMAND_EXECUTABLE, program.getPath());\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