implement view pack parameters,
authorEugene.Petrenko <eugene.petrenko@gmail.com>
Tue, 23 Aug 2011 09:16:48 +0000 (11:16 +0200)
committerEugene.Petrenko <eugene.petrenko@gmail.com>
Tue, 23 Aug 2011 09:16:48 +0000 (11:16 +0200)
nuget-server/resources/pack/viewPack.jsp
nuget-server/src/jetbrains/buildServer/nuget/server/pack/PackRunType.java

index f536bae3a62b0508e08588114c51c03c1517cc77..e6e62c68c7bc1d03c551e39d8424f5508bc1953d 100644 (file)
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>\r
 <jsp:useBean id="ib" class="jetbrains.buildServer.nuget.server.pack.PackBean" scope="request"/>\r
 \r
-TBD
\ No newline at end of file
+\r
+<div class="parameter">\r
+  Path to NuGet.exe: <strong><props:displayValue name="${ib.nuGetPathKey}"/></strong>\r
+</div>\r
+\r
+\r
+<div class="parameter">\r
+  Specification file: <strong><props:displayValue name="${ib.packSpecFile}"/></strong>\r
+</div>\r
+\r
+<div class="parameter">\r
+  Version: <strong><props:displayValue name="${ib.packVersion}"/></strong>\r
+</div>\r
+\r
+<div class="parameter">\r
+  Base Directory: <strong><props:displayValue name="${ib.packBaseDirectory}"/></strong>\r
+</div>\r
+\r
+<div class="parameter">\r
+  Output Directory: <strong><props:displayValue name="${ib.packOutputDirectory}"/></strong>\r
+</div>\r
+\r
+<div class="parameter">\r
+  Exclude files: <props:displayValue name="${ib.packExcludePatterns}" showInPopup="${true}"/>\r
+</div>\r
+\r
+<div class="parameter">\r
+  Properties: <props:displayValue name="${ib.packProperties}" showInPopup="${true}"/>\r
+</div>\r
+\r
+<div class="parameter">\r
+  Create tool package: <strong><props:displayCheckboxValue name="${ib.packAsTool}"/></strong>\r
+</div>\r
+\r
+<div class="parameter">\r
+  Include symbols and sources: <strong><props:displayCheckboxValue name="${ib.packSources}"/></strong>\r
+</div>\r
+\r
+<div class="parameter">\r
+  Custom commandline: <strong><props:displayValue name="${ib.packCustomCommandline}" showInPopup="${true}"/></strong>\r
+</div>\r
+\r
+\r
index 425ba6bb2f7c66ad6d5b69248845ff32ff52792b..bf484e1b9795d9263ad2ec26213f9466e186203e 100644 (file)
 package jetbrains.buildServer.nuget.server.pack;\r
 \r
 import jetbrains.buildServer.agent.ServerProvidedProperties;\r
+import jetbrains.buildServer.nuget.common.DotNetConstants;\r
 import jetbrains.buildServer.nuget.common.PackagesConstants;\r
+import jetbrains.buildServer.nuget.server.util.BasePropertiesProcessor;\r
+import jetbrains.buildServer.parameters.ReferencesResolverUtil;\r
+import jetbrains.buildServer.requirements.Requirement;\r
+import jetbrains.buildServer.requirements.RequirementType;\r
 import jetbrains.buildServer.serverSide.InvalidProperty;\r
 import jetbrains.buildServer.serverSide.PropertiesProcessor;\r
 import jetbrains.buildServer.serverSide.RunType;\r
 import jetbrains.buildServer.web.openapi.PluginDescriptor;\r
 import org.jetbrains.annotations.NotNull;\r
 \r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
+import java.util.*;\r
+\r
+import static jetbrains.buildServer.nuget.common.PackagesConstants.*;\r
 \r
 /**\r
  * @author Eugene Petrenko (eugene.petrenko@gmail.com)\r
@@ -56,12 +60,30 @@ public class PackRunType extends RunType {
     return "Creates NuGet package from a given spec file";\r
   }\r
 \r
+  @NotNull\r
+  @Override\r
+  public String describeParameters(@NotNull Map<String, String> parameters) {\r
+    StringBuilder sb = new StringBuilder();\r
+\r
+    sb.append("Pack: ").append(parameters.get(PackagesConstants.NUGET_PACK_SPEC_FILE)).append("\n");\r
+    sb.append("Version: ").append(parameters.get(PackagesConstants.NUGET_PACK_VERSION)).append("\n");\r
+    return sb.toString();\r
+  }\r
+\r
   @Override\r
   public PropertiesProcessor getRunnerPropertiesProcessor() {\r
-    return new PropertiesProcessor() {\r
-      public Collection<InvalidProperty> process(Map<String, String> properties) {\r
-        final ArrayList<InvalidProperty> result = new ArrayList<InvalidProperty>();\r
-        return result;\r
+    return new BasePropertiesProcessor() {\r
+      @Override\r
+      protected void checkProperties(@NotNull Map<String, String> map, @NotNull Collection<InvalidProperty> result) {\r
+        notEmpty(NUGET_PATH, "Path to nuget.exe must be specified", map, result);\r
+        notEmpty(NUGET_PACK_SPEC_FILE, "Package definition file must be specified", map, result);\r
+        notEmpty(NUGET_PACK_OUTPUT_DIR, "Package creation output directory must be specified", map, result);\r
+        final String version = notEmpty(NUGET_PACK_VERSION, "Version must be specified", map, result);\r
+        if (version != null && !ReferencesResolverUtil.containsReference(version) && !version.matches("\\d+(\\.\\d+){0,3}")) {\r
+          result.add(new InvalidProperty(NUGET_PACK_VERSION, "Version must be in assmebly version format: D[.D[.D[.D]]], i.e. 1.2.3 or 5.4.3.2"));\r
+        }\r
+\r
+        //TODO: check properties are well-formed\r
       }\r
     };\r
   }\r
@@ -82,4 +104,11 @@ public class PackRunType extends RunType {
       put(PackagesConstants.NUGET_PACK_VERSION, "%" + ServerProvidedProperties.BUILD_NUMBER_PROP + "%");\r
     }};\r
   }\r
+\r
+  @Override\r
+  public List<Requirement> getRunnerSpecificRequirements(@NotNull Map<String, String> runParameters) {\r
+    List<Requirement> list = new ArrayList<Requirement>(super.getRunnerSpecificRequirements(runParameters));\r
+    list.add(new Requirement(DotNetConstants.DOT_NET_FRAMEWORK_4_x86, null, RequirementType.EXISTS));\r
+    return list;\r
+  }\r
 }\r