implement basic runner
authorEugene.Petrenko <eugene.petrenko@gmail.com>
Tue, 23 Aug 2011 10:36:35 +0000 (12:36 +0200)
committerEugene.Petrenko <eugene.petrenko@gmail.com>
Tue, 23 Aug 2011 10:36:35 +0000 (12:36 +0200)
12 files changed:
nuget-agent/nuget-agent.iml
nuget-agent/src/META-INF/build-agent-plugin-nuget-pack.xml [new file with mode: 0644]
nuget-agent/src/jetbrains/buildServer/nuget/agent/commands/CommandFactory.java
nuget-agent/src/jetbrains/buildServer/nuget/agent/commands/NuGetActionFactory.java
nuget-agent/src/jetbrains/buildServer/nuget/agent/commands/impl/CommandFactoryImpl.java
nuget-agent/src/jetbrains/buildServer/nuget/agent/commands/impl/LoggingNuGetActionFactoryImpl.java
nuget-agent/src/jetbrains/buildServer/nuget/agent/commands/impl/NuGetActionFactoryImpl.java
nuget-agent/src/jetbrains/buildServer/nuget/agent/pack/PackRunner.java [new file with mode: 0644]
nuget-agent/src/jetbrains/buildServer/nuget/agent/pack/PackRunnerRegistrar.java [new file with mode: 0644]
nuget-agent/src/jetbrains/buildServer/nuget/agent/parameters/NuGetPackParameters.java [new file with mode: 0644]
nuget-agent/src/jetbrains/buildServer/nuget/agent/parameters/PackagesParametersFactory.java
nuget-agent/src/jetbrains/buildServer/nuget/agent/parameters/impl/PackagesParametersFactoryImpl.java

index 6ec8153d0949adc5f9e0c05fc78ed7103d1bafe9..c6882b7205ebc376ceb532e70d8339acfaec98a4 100644 (file)
@@ -7,6 +7,7 @@
           <file>file://$MODULE_DIR$/src/META-INF/build-agent-plugin-nuget.xml</file>\r
           <file>jar://$TeamCityDistribution$/buildAgent/lib/agent.jar!/META-INF/buildAgentSpring.xml</file>\r
           <file>jar://$TeamCityDistribution$/buildAgent/lib/agent.jar!/META-INF/buildAgentPlugins.xml</file>\r
+          <file>file://$MODULE_DIR$/src/META-INF/build-agent-plugin-nuget-pack.xml</file>\r
         </fileset>\r
       </configuration>\r
     </facet>\r
diff --git a/nuget-agent/src/META-INF/build-agent-plugin-nuget-pack.xml b/nuget-agent/src/META-INF/build-agent-plugin-nuget-pack.xml
new file mode 100644 (file)
index 0000000..06f18b8
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+       xsi:schemaLocation="http://www.springframework.org/schema/beans\r
+                           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"\r
+       default-autowire="constructor">\r
+\r
+  <bean class="jetbrains.buildServer.nuget.agent.pack.PackRunner"/>\r
+  <bean class="jetbrains.buildServer.nuget.agent.pack.PackRunnerRegistrar"/>\r
+\r
+</beans>
\ No newline at end of file
index 627167a10aa7eeda9ab1718dcff32a345cb0a021..dc2649a629bebc67970401920ab6f221a4fb17bb 100644 (file)
@@ -17,6 +17,7 @@
 package jetbrains.buildServer.nuget.agent.commands;\r
 \r
 import jetbrains.buildServer.RunBuildException;\r
+import jetbrains.buildServer.nuget.agent.parameters.NuGetPackParameters;\r
 import jetbrains.buildServer.nuget.agent.parameters.NuGetPublishParameters;\r
 import jetbrains.buildServer.nuget.agent.parameters.PackagesInstallParameters;\r
 import jetbrains.buildServer.nuget.agent.parameters.PackagesUpdateParameters;\r
@@ -48,6 +49,10 @@ public interface CommandFactory {
                    @NotNull File packagePath,\r
                    @NotNull Callback<T> factory) throws RunBuildException;\r
 \r
+  <T> T createPack(@NotNull NuGetPackParameters params,\r
+                   @NotNull File workdir,\r
+                   @NotNull Callback<T> factory) throws RunBuildException;\r
+\r
   public interface Callback<T> {\r
     /**\r
      * Called with generated arguments to crate execurable instance or run command\r
index d9087a0a1100118a73b394b8675a7801ee98f308..396873ba2011f07876c046c2c1d52778e77d3d0a 100644 (file)
@@ -19,10 +19,7 @@ package jetbrains.buildServer.nuget.agent.commands;
 import jetbrains.buildServer.RunBuildException;\r
 import jetbrains.buildServer.agent.BuildProcess;\r
 import jetbrains.buildServer.agent.BuildRunnerContext;\r
-import jetbrains.buildServer.nuget.agent.parameters.NuGetFetchParameters;\r
-import jetbrains.buildServer.nuget.agent.parameters.NuGetPublishParameters;\r
-import jetbrains.buildServer.nuget.agent.parameters.PackagesInstallParameters;\r
-import jetbrains.buildServer.nuget.agent.parameters.PackagesUpdateParameters;\r
+import jetbrains.buildServer.nuget.agent.parameters.*;\r
 import org.jetbrains.annotations.NotNull;\r
 \r
 import java.io.File;\r
@@ -56,4 +53,7 @@ public interface NuGetActionFactory {
                           @NotNull NuGetPublishParameters params,\r
                           @NotNull File packagePath) throws RunBuildException;\r
 \r
+  @NotNull\r
+  BuildProcess createPack(@NotNull BuildRunnerContext context,\r
+                          @NotNull NuGetPackParameters params) throws RunBuildException;\r
 }\r
index c2e537b62a3bd8ccc9d335d173f7fbe2a1a50643..47dc04ed9a746cde670f712740b5934503f31de6 100644 (file)
@@ -66,6 +66,50 @@ public class CommandFactoryImpl implements CommandFactory {
     return executeNuGet(params.getNuGetParameters(), argz, packagesConfig.getParentFile(), factory);\r
   }\r
 \r
+  public <T> T createPack(@NotNull final NuGetPackParameters params,\r
+                          @NotNull final File workdir,\r
+                          @NotNull final Callback<T> factory) throws RunBuildException {\r
+    final List<String> arguments = new ArrayList<String>();\r
+    arguments.add("pack");\r
+    arguments.add(params.getSpecFile().getPath());\r
+\r
+    arguments.add("-OutputDirectory");\r
+    arguments.add(params.getOutputDirectory().getPath());\r
+\r
+    arguments.add("-BasePath");\r
+    arguments.add(params.getBaseDirectory().getPath());\r
+\r
+    arguments.add("-Verbose");\r
+\r
+    arguments.add("-Version");\r
+    arguments.add(params.getVersion());\r
+\r
+    for (String exclude : params.getExclude()) {\r
+      arguments.add("-Exclude");\r
+      arguments.add(exclude);\r
+    }\r
+\r
+    if (params.packSymbols()) {\r
+      arguments.add("-Symbols");\r
+    }\r
+\r
+    if (params.packTool()) {\r
+      arguments.add("-Tool");\r
+    }\r
+\r
+    for (String prop : params.getProperties()) {\r
+      arguments.add("-Properties");\r
+      arguments.add(prop);\r
+    }\r
+\r
+    for (String cmd : params.getCustomCommandline()) {\r
+      //TODO: check if -Build was added\r
+      arguments.add(cmd);\r
+    }\r
+\r
+    return executeNuGet(params, Collections.<String>emptyList(), arguments, workdir, factory);\r
+  }\r
+\r
   @NotNull\r
   public <T> T createPush(@NotNull final NuGetPublishParameters params,\r
                           @NotNull final File packagePath,\r
index d470ed128c0229564a2576d747ad6c1874965bcc..5d8a4bea4c0521f230487aea8320dedd52ce652e 100644 (file)
@@ -21,10 +21,7 @@ import jetbrains.buildServer.agent.BuildProcess;
 import jetbrains.buildServer.agent.BuildProgressLogger;\r
 import jetbrains.buildServer.agent.BuildRunnerContext;\r
 import jetbrains.buildServer.nuget.agent.commands.NuGetActionFactory;\r
-import jetbrains.buildServer.nuget.agent.parameters.NuGetFetchParameters;\r
-import jetbrains.buildServer.nuget.agent.parameters.NuGetPublishParameters;\r
-import jetbrains.buildServer.nuget.agent.parameters.PackagesInstallParameters;\r
-import jetbrains.buildServer.nuget.agent.parameters.PackagesUpdateParameters;\r
+import jetbrains.buildServer.nuget.agent.parameters.*;\r
 import jetbrains.buildServer.nuget.agent.util.DelegatingBuildProcess;\r
 import jetbrains.buildServer.util.FileUtil;\r
 import org.jetbrains.annotations.NotNull;\r
@@ -64,6 +61,7 @@ public class LoggingNuGetActionFactoryImpl implements NuGetActionFactory {
                         targetFolder);\r
               }\r
 \r
+              @NotNull\r
               @Override\r
               protected String getBlockDescription(@NotNull String pathToLog) {\r
                 return "Installing NuGet packages for " + pathToLog;\r
@@ -89,6 +87,7 @@ public class LoggingNuGetActionFactoryImpl implements NuGetActionFactory {
                         targetFolder);\r
               }\r
 \r
+              @NotNull\r
               @Override\r
               protected String getBlockDescription(@NotNull String pathToLog) {\r
                 return "Updating NuGet packages for " + pathToLog;\r
@@ -98,24 +97,44 @@ public class LoggingNuGetActionFactoryImpl implements NuGetActionFactory {
   }\r
 \r
   @NotNull\r
-  public BuildProcess createPush(@NotNull BuildRunnerContext context,\r
-                                 @NotNull NuGetPublishParameters params,\r
-                                 @NotNull File packagePath) throws RunBuildException {\r
+  public BuildProcess createPush(@NotNull final BuildRunnerContext context,\r
+                                 @NotNull final NuGetPublishParameters params,\r
+                                 @NotNull final File packagePath) throws RunBuildException {\r
     return new DelegatingBuildProcess(\r
             new LoggingAction(context, packagePath, "push") {\r
       @NotNull\r
       @Override\r
       protected BuildProcess delegateToActualAction() throws RunBuildException {\r
-        return null;\r
+        return myActionFactory.createPush(context, params, packagePath);\r
       }\r
 \r
+      @NotNull\r
       @Override\r
       protected String getBlockDescription(@NotNull String pathToLog) {\r
-        return null;\r
+        return "Publish package " + pathToLog;\r
       }\r
     });\r
   }\r
 \r
+  @NotNull\r
+  public BuildProcess createPack(@NotNull final BuildRunnerContext context,\r
+                                 @NotNull final NuGetPackParameters params) throws RunBuildException {\r
+    return new DelegatingBuildProcess(\r
+            new LoggingAction(context, params.getSpecFile(), "pack") {\r
+              @NotNull\r
+              @Override\r
+              protected BuildProcess delegateToActualAction() throws RunBuildException {\r
+                return myActionFactory.createPack(context, params);\r
+              }\r
+\r
+              @NotNull\r
+              @Override\r
+              protected String getBlockDescription(@NotNull String pathToLog) {\r
+                return "Create NuGet package from " + pathToLog;\r
+              }\r
+            });\r
+  }\r
+\r
   private abstract class LoggingAction implements DelegatingBuildProcess.Action {\r
     private final BuildRunnerContext myContext;\r
     private final File myFileToLog;\r
@@ -131,7 +150,7 @@ public class LoggingNuGetActionFactoryImpl implements NuGetActionFactory {
 \r
     @NotNull\r
     protected abstract BuildProcess delegateToActualAction() throws RunBuildException;\r
-\r
+    @NotNull\r
     protected abstract String getBlockDescription(@NotNull String pathToLog);\r
 \r
 \r
index 0df610d6dd3ed32240083cea49565e1d2283d83e..a9e9b2c227a6f88c924a6ea551ecf48dc38d4d10 100644 (file)
@@ -23,10 +23,7 @@ import jetbrains.buildServer.agent.BuildRunnerContext;
 import jetbrains.buildServer.nuget.agent.commands.CommandFactory;\r
 import jetbrains.buildServer.nuget.agent.commands.NuGetActionFactory;\r
 import jetbrains.buildServer.nuget.agent.install.PackageUsages;\r
-import jetbrains.buildServer.nuget.agent.parameters.NuGetFetchParameters;\r
-import jetbrains.buildServer.nuget.agent.parameters.NuGetPublishParameters;\r
-import jetbrains.buildServer.nuget.agent.parameters.PackagesInstallParameters;\r
-import jetbrains.buildServer.nuget.agent.parameters.PackagesUpdateParameters;\r
+import jetbrains.buildServer.nuget.agent.parameters.*;\r
 import jetbrains.buildServer.nuget.agent.util.BuildProcessBase;\r
 import jetbrains.buildServer.nuget.agent.util.CommandlineBuildProcessFactory;\r
 import org.jetbrains.annotations.NotNull;\r
@@ -105,4 +102,9 @@ public class NuGetActionFactoryImpl implements NuGetActionFactory {
                                  @NotNull File packagePath) throws RunBuildException {\r
     return myCommandFactory.createPush(params, packagePath, getCallback(context));\r
   }\r
+\r
+  @NotNull\r
+  public BuildProcess createPack(@NotNull BuildRunnerContext context, @NotNull NuGetPackParameters params) throws RunBuildException {\r
+    return myCommandFactory.createPack(params, context.getBuild().getCheckoutDirectory(), getCallback(context));\r
+  }\r
 }\r
diff --git a/nuget-agent/src/jetbrains/buildServer/nuget/agent/pack/PackRunner.java b/nuget-agent/src/jetbrains/buildServer/nuget/agent/pack/PackRunner.java
new file mode 100644 (file)
index 0000000..78ee204
--- /dev/null
@@ -0,0 +1,81 @@
+/*\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.pack;\r
+\r
+import com.intellij.openapi.diagnostic.Logger;\r
+import jetbrains.buildServer.RunBuildException;\r
+import jetbrains.buildServer.agent.*;\r
+import jetbrains.buildServer.nuget.agent.commands.NuGetActionFactory;\r
+import jetbrains.buildServer.nuget.agent.parameters.NuGetPackParameters;\r
+import jetbrains.buildServer.nuget.agent.parameters.PackagesParametersFactory;\r
+import jetbrains.buildServer.nuget.agent.util.CompositeBuildProcess;\r
+import jetbrains.buildServer.nuget.agent.util.impl.CompositeBuildProcessImpl;\r
+import jetbrains.buildServer.nuget.common.DotNetConstants;\r
+import jetbrains.buildServer.nuget.common.PackagesConstants;\r
+import org.jetbrains.annotations.NotNull;\r
+\r
+/**\r
+ * @author Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ *         Date: 23.08.11 12:11\r
+ */\r
+public class PackRunner implements AgentBuildRunner, AgentBuildRunnerInfo {\r
+  private static final Logger LOG = Logger.getInstance(PackRunner.class.getName());\r
+\r
+  private final NuGetActionFactory myActionFactory;\r
+  private final PackagesParametersFactory myParametersFactory;\r
+\r
+  public PackRunner(@NotNull final NuGetActionFactory actionFactory,\r
+                    @NotNull final PackagesParametersFactory parametersFactory) {\r
+    myActionFactory = actionFactory;\r
+    myParametersFactory = parametersFactory;\r
+  }\r
+\r
+  @NotNull\r
+  public BuildProcess createBuildProcess(@NotNull final AgentRunningBuild runningBuild,\r
+                                         @NotNull final BuildRunnerContext context) throws RunBuildException {\r
+    final CompositeBuildProcess process = new CompositeBuildProcessImpl();\r
+    final NuGetPackParameters params = myParametersFactory.loadPackParameters(context);\r
+\r
+    process.pushBuildProcess(myActionFactory.createPack(context, params));\r
+    return process;\r
+  }\r
+\r
+  @NotNull\r
+  public AgentBuildRunnerInfo getRunnerInfo() {\r
+    return this;\r
+  }\r
+\r
+  @NotNull\r
+  public String getType() {\r
+    return PackagesConstants.PUBLISH_RUN_TYPE;\r
+  }\r
+\r
+  public boolean canRun(@NotNull BuildAgentConfiguration agentConfiguration) {\r
+    if (!agentConfiguration.getSystemInfo().isWindows()) {\r
+      LOG.warn("NuGet packages installer available only under windows");\r
+      return false;\r
+    }\r
+\r
+    if (!agentConfiguration.getConfigurationParameters().containsKey(DotNetConstants.DOT_NET_FRAMEWORK_4_x86)) {\r
+      LOG.warn("NuGet requires .NET Framework 4.0 x86 installed");\r
+      return false;\r
+    }\r
+\r
+    return true;\r
+  }\r
+\r
+}\r
diff --git a/nuget-agent/src/jetbrains/buildServer/nuget/agent/pack/PackRunnerRegistrar.java b/nuget-agent/src/jetbrains/buildServer/nuget/agent/pack/PackRunnerRegistrar.java
new file mode 100644 (file)
index 0000000..b98c7b5
--- /dev/null
@@ -0,0 +1,31 @@
+/*\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.pack;\r
+\r
+import jetbrains.buildServer.agent.impl.BuildRunnerRegistry;\r
+import org.jetbrains.annotations.NotNull;\r
+\r
+/**\r
+ * @author Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ *         Date: 23.08.11 12:13\r
+ */\r
+public class PackRunnerRegistrar {\r
+  public PackRunnerRegistrar(@NotNull final BuildRunnerRegistry reg,\r
+                             @NotNull final PackRunner runner) {\r
+    reg.registerRunner(runner);\r
+  }\r
+}\r
diff --git a/nuget-agent/src/jetbrains/buildServer/nuget/agent/parameters/NuGetPackParameters.java b/nuget-agent/src/jetbrains/buildServer/nuget/agent/parameters/NuGetPackParameters.java
new file mode 100644 (file)
index 0000000..df0321d
--- /dev/null
@@ -0,0 +1,54 @@
+/*\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.parameters;\r
+\r
+import jetbrains.buildServer.RunBuildException;\r
+import org.jetbrains.annotations.NotNull;\r
+\r
+import java.io.File;\r
+import java.util.Collection;\r
+\r
+/**\r
+ * @author Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ *         Date: 23.08.11 11:17\r
+ */\r
+public interface NuGetPackParameters extends NuGetParameters {\r
+\r
+  @NotNull\r
+  File getSpecFile() throws RunBuildException;\r
+\r
+  @NotNull\r
+  Collection<String> getExclude();\r
+\r
+  @NotNull\r
+  Collection<String> getProperties();\r
+\r
+  @NotNull\r
+  Collection<String> getCustomCommandline();\r
+\r
+  @NotNull\r
+  File getOutputDirectory() throws RunBuildException;\r
+\r
+  @NotNull\r
+  File getBaseDirectory() throws RunBuildException;\r
+\r
+  @NotNull\r
+  String getVersion();\r
+\r
+  boolean packSymbols();\r
+  boolean packTool();\r
+}\r
index 4a044edfcd0f829ea3208b58f765c413e0197c22..8ad424c8b2a5b666fd45c81da4529c615664c591 100644 (file)
@@ -47,4 +47,7 @@ public interface PackagesParametersFactory {
 \r
   @NotNull\r
   NuGetPublishParameters loadPublishParameters(@NotNull final BuildRunnerContext context) throws RunBuildException;\r
+\r
+  @NotNull\r
+  NuGetPackParameters loadPackParameters(@NotNull final BuildRunnerContext context) throws RunBuildException;\r
 }\r
index 074936891849c2b4e254b3927257b11ce5251c7b..8e82ce07b17ac229bc0072ac0be826eef4721cd2 100644 (file)
@@ -90,23 +90,47 @@ public class PackagesParametersFactoryImpl implements PackagesParametersFactory
   }\r
 \r
   @NotNull\r
+  private File getDirectory(@NotNull final BuildRunnerContext context,\r
+                            @NotNull final String runnerParameter,\r
+                            @NotNull final String errorMessage) throws RunBuildException {\r
+    final File file = resolveParameterPath(context, runnerParameter);\r
+    if (!file.isDirectory()) {\r
+      //noinspection ResultOfMethodCallIgnored\r
+      file.mkdirs();\r
+    }\r
+\r
+    if (!file.isDirectory()) {\r
+      throw new RunBuildException("Failed to find or create " + errorMessage + " at " + file);\r
+    }\r
+\r
+    return file;\r
+  }\r
+\r
+  @NotNull\r
   private File getFile(@NotNull final BuildRunnerContext context,\r
                        @NotNull final String runnerParameter,\r
-                       @NotNull final String fileName) throws RunBuildException {\r
-    String path = getParameter(context, runnerParameter);\r
-    if (StringUtil.isEmptyOrSpaces(path))\r
-      throw new RunBuildException("Runner parameter '" + runnerParameter + "' was not found");\r
-\r
-    File file = FileUtil.resolvePath(context.getBuild().getCheckoutDirectory(), path);\r
+                       @NotNull final String errorMessage) throws RunBuildException {\r
+    final File file = resolveParameterPath(context, runnerParameter);\r
     if (!file.exists()) {\r
-      throw new RunBuildException("Failed to find " + fileName + " at " + file);\r
+      throw new RunBuildException("Failed to find " + errorMessage + " at " + file);\r
     }\r
 \r
     return file;\r
   }\r
 \r
+  private File resolveParameterPath(@NotNull final BuildRunnerContext context,\r
+                                    @NotNull final String runnerParameter) throws RunBuildException {\r
+    String path = getParameter(context, runnerParameter);\r
+    if (StringUtil.isEmptyOrSpaces(path))\r
+      throw new RunBuildException("Runner parameter '" + runnerParameter + "' was not found");\r
+\r
+    return FileUtil.resolvePath(context.getBuild().getCheckoutDirectory(), path);\r
+  }\r
 \r
-  private Collection<String> getMultilineParameter(BuildRunnerContext context, String nugetSources) {\r
+\r
+  @NotNull\r
+  private Collection<String> getMultilineParameter(@NotNull final BuildRunnerContext context,\r
+                                                   @NotNull final String nugetSources) {\r
     String sources = getParameter(context, nugetSources);\r
     if (sources == null) return Collections.emptyList();\r
 \r
@@ -198,4 +222,72 @@ public class PackagesParametersFactoryImpl implements PackagesParametersFactory
       }\r
     };\r
   }\r
+\r
+  @NotNull\r
+  public NuGetPackParameters loadPackParameters(@NotNull final BuildRunnerContext context) throws RunBuildException {\r
+    return new NuGetPackParameters() {\r
+      @NotNull\r
+      public File getSpecFile() throws RunBuildException {\r
+        return getFile(context, NUGET_PACK_SPEC_FILE, "NuGet .nuspec of project file");\r
+      }\r
+\r
+      @NotNull\r
+      public Collection<String> getExclude() {\r
+        return getMultilineParameter(context, NUGET_PACK_EXCLUDE_FILES);\r
+      }\r
+\r
+      @NotNull\r
+      public Collection<String> getProperties() {\r
+        return getMultilineParameter(context, NUGET_PACK_PROPERTIES);\r
+      }\r
+\r
+      @NotNull\r
+      public Collection<String> getCustomCommandline() {\r
+        return getMultilineParameter(context, NUGET_PACK_CUSOM_COMMANDLINE);\r
+      }\r
+\r
+      @NotNull\r
+      public File getOutputDirectory() throws RunBuildException {\r
+        return getDirectory(context, NUGET_PACK_OUTPUT_DIR, "output directory");\r
+      }\r
+\r
+      @NotNull\r
+      public File getBaseDirectory() throws RunBuildException {\r
+        String path = getParameter(context, NUGET_PACK_BASE_DIR);\r
+        if (StringUtil.isEmptyOrSpaces(path)) {\r
+          return context.getBuild().getCheckoutDirectory();\r
+        }\r
+\r
+        final File file = FileUtil.resolvePath(context.getBuild().getCheckoutDirectory(), path);\r
+        if (!file.isDirectory()) {\r
+          //noinspection ResultOfMethodCallIgnored\r
+          file.mkdirs();\r
+        }\r
+\r
+        if (!file.isDirectory()) {\r
+          throw new RunBuildException("Failed to find or create base directory at " + file);\r
+        }\r
+\r
+        return file;\r
+      }\r
+\r
+      @NotNull\r
+      public String getVersion() {\r
+        return getParameter(context, NUGET_PACK_VERSION);\r
+      }\r
+\r
+      public boolean packSymbols() {\r
+        return getBoolean(context, NUGET_PACK_INCLUDE_SOURCES);\r
+      }\r
+\r
+      public boolean packTool() {\r
+        return getBoolean(context, NUGET_PACK_AS_TOOL);\r
+      }\r
+\r
+      @NotNull\r
+      public File getNuGetExeFile() throws RunBuildException {\r
+        return getPathToNuGet(context);\r
+      }\r
+    };\r
+  }\r
 }\r