do not use ProgramCommandLine
authorEugene.Petrenko <eugene.petrenko@gmail.com>
Thu, 7 Jul 2011 13:55:33 +0000 (17:55 +0400)
committerEugene.Petrenko <eugene.petrenko@gmail.com>
Thu, 7 Jul 2011 13:55:33 +0000 (17:55 +0400)
nuget-agent/src/jetbrains/buildServer/nuget/agent/util/CommandlineBuildProcessFactory.java
nuget-agent/src/jetbrains/buildServer/nuget/agent/util/impl/CommandlineBuildProcessFactoryImpl.java

index ba6db1dcd1996df245e29a83726b5ee1558cb362..2379888f322b15866bfe5358d18316239b527e01 100644 (file)
@@ -1,16 +1,36 @@
+/*\r
+ * Copyright 2000-2011 JetBrains s.r.o.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
 package jetbrains.buildServer.nuget.agent.util;\r
 \r
 import jetbrains.buildServer.RunBuildException;\r
 import jetbrains.buildServer.agent.BuildProcess;\r
 import jetbrains.buildServer.agent.BuildRunnerContext;\r
-import jetbrains.buildServer.agent.runner.ProgramCommandLine;\r
 import org.jetbrains.annotations.NotNull;\r
 \r
+import java.io.File;\r
+import java.util.Collection;\r
+\r
 /**\r
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
  * Date: 07.07.11 15:36\r
  */\r
 public interface CommandlineBuildProcessFactory {\r
   BuildProcess executeCommandLine(@NotNull BuildRunnerContext hostContext,\r
-                                  @NotNull ProgramCommandLine cmd) throws RunBuildException;\r
+                                  @NotNull File program,\r
+                                  @NotNull Collection<String> argz,\r
+                                  @NotNull File workingDir) throws RunBuildException;\r
 }\r
index deeb1ad3b8be05f69a59381d6be8c395e63ebf05..18fcd0c393ac0fb82847809738e90e3645c05051 100644 (file)
@@ -20,13 +20,12 @@ 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
 /**\r
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
@@ -39,21 +38,19 @@ 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
+  public BuildProcess executeCommandLine(@NotNull BuildRunnerContext hostContext,\r
+                                         @NotNull File program,\r
+                                         @NotNull Collection<String> argz,\r
+                                         @NotNull File workingDir) 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
-    }\r
+    context.addRunnerParameter(SimpleRunnerConstants.COMMAND_EXECUTABLE, program.getPath());\r
+    context.addRunnerParameter(SimpleRunnerConstants.COMMAND_PARAMETERS, joinCommandLineArguments(argz));\r
 \r
     return myFacade.createExecutable(hostContext.getBuild(), context);\r
   }\r