introduce pack runner initial UI
authorEugene.Petrenko <eugene.petrenko@gmail.com>
Mon, 22 Aug 2011 19:23:37 +0000 (21:23 +0200)
committerEugene.Petrenko <eugene.petrenko@gmail.com>
Mon, 22 Aug 2011 19:23:37 +0000 (21:23 +0200)
nuget-common/src/jetbrains/buildServer/nuget/common/PackagesConstants.java
nuget-server/nuget-server.iml
nuget-server/resources/pack/editPack.jsp [new file with mode: 0644]
nuget-server/resources/pack/viewPack.jsp [new file with mode: 0644]
nuget-server/src/META-INF/build-server-plugin-nuget-pack-runner.xml [new file with mode: 0644]
nuget-server/src/jetbrains/buildServer/nuget/server/pack/PackBean.java [new file with mode: 0644]
nuget-server/src/jetbrains/buildServer/nuget/server/pack/PackRunType.java [new file with mode: 0644]
nuget-server/src/jetbrains/buildServer/nuget/server/pack/PackRunTypeRegistrar.java [new file with mode: 0644]

index aff6818218fce65c2a2ecdf84e663b42211d0a1a..b10d7c80a89d4aeb9985214256baaddf9aea9b4b 100644 (file)
@@ -26,6 +26,7 @@ import jetbrains.buildServer.agent.Constants;
 public interface PackagesConstants {\r
   public static final String INSTALL_RUN_TYPE = "jb.nuget.installer"; //no more than 30 chars\r
   public static final String PUBLISH_RUN_TYPE = "jb.nuget.publish"; //run-type could never exceed 30 chars\r
+  public static final String PACK_RUN_TYPE = "jb.nuget.pack"; //run-type could never exceed 30 chars\r
 \r
   public static final String NUGET_PATH = "nuget.path";\r
   public static final String NUGET_SOURCES = "nuget.sources";\r
@@ -50,4 +51,15 @@ public interface PackagesConstants {
 \r
   public static final String NUGET_TOOL_NAME_PREFIX = "nuget-commnadline-";\r
   public static final String NUGET_TOOL_REL_PATH = "tools/NuGet.exe";\r
+\r
+\r
+  public static final String NUGET_PACK_OUTPUT_DIR = "nuget.pack.output.directory";\r
+  public static final String NUGET_PACK_BASE_DIR = "nuget.pack.base.directory";\r
+  public static final String NUGET_PACK_VERSION = "nuget.pack.version";\r
+  public static final String NUGET_PACK_SPEC_FILE = "nuget.pack.specFile";\r
+  public static final String NUGET_PACK_EXCLUDE_FILES = "nuget.pack.excludes";\r
+  public static final String NUGET_PACK_PROPERTIES = "nuget.pack.properties";\r
+  public static final String NUGET_PACK_CUSOM_COMMANDLINE= "nuget.pack.commandline";\r
+  public static final String NUGET_PACK_AS_TOOL= "nuget.pack.pack.mode.tool";\r
+  public static final String NUGET_PACK_INCLUDE_SOURCES = "nuget.pack.include.sources" ;\r
 }\r
index a62b8941b4965db291ebc1cdfc46d1d5e3c28009..02a0684c4c4e1c82c72ba5ff32255ecf0af3efe0 100644 (file)
@@ -13,6 +13,7 @@
           <file>file://$TeamCityDistribution$/webapps/ROOT/WEB-INF/buildServerConfigurator.xml</file>\r
           <file>file://$MODULE_DIR$/src/META-INF/build-server-plugin-nuget-tools.xml</file>\r
           <file>file://$MODULE_DIR$/src/META-INF/build-server-plugin-nuget-feed.xml</file>\r
+          <file>file://$MODULE_DIR$/src/META-INF/build-server-plugin-nuget-pack-runner.xml</file>\r
           <file>file://$TeamCityDistribution$/webapps/ROOT/WEB-INF/buildServerSpringStatistics.xml</file>\r
         </fileset>\r
       </configuration>\r
diff --git a/nuget-server/resources/pack/editPack.jsp b/nuget-server/resources/pack/editPack.jsp
new file mode 100644 (file)
index 0000000..9e46634
--- /dev/null
@@ -0,0 +1,117 @@
+<%--\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
+<%@ taglib prefix="forms" tagdir="/WEB-INF/tags/forms" %>\r
+<%@ taglib prefix="props" tagdir="/WEB-INF/tags/props" %>\r
+<%@ taglib prefix="l" tagdir="/WEB-INF/tags/layout" %>\r
+<%@ 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
+<l:settingsGroup title="NuGet settings">\r
+  <tr>\r
+    <th>NuGet.exe<l:star/></th>\r
+    <td>\r
+      <jsp:include page="../tool/runnerSettings.html?name=${ib.nuGetPathKey}&class=longField"/>\r
+    </td>\r
+  </tr>\r
+</l:settingsGroup>\r
+\r
+<l:settingsGroup title="Package parameters">\r
+  <tr>\r
+    <th><label for="${ib.packSpecFile}">Specification file</label><l:star/>:</th>\r
+    <td>\r
+      <props:textProperty name="${ib.packSpecFile}" className="longField"/>\r
+      <span class="smallNote">Specify path to project of .nuspec file</span>\r
+      <span id="error_${ib.packSpecFile}" class="error"></span>\r
+    </td>\r
+  </tr>\r
+\r
+  <tr>\r
+    <th><label for="${ib.packVersion}">Version</label><l:star/>:</th>\r
+    <td>\r
+      <props:textProperty name="${ib.packVersion}" className="longField"/>\r
+      <span class="smallNote">Specify version for package to create</span>\r
+      <span id="error_${ib.packVersion}" class="error"></span>\r
+    </td>\r
+  </tr>\r
+\r
+  <tr>\r
+    <th><label for="${ib.packBaseDirectory}">Base Directory</label>:</th>\r
+    <td>\r
+      <props:textProperty name="${ib.packBaseDirectory}" className="longField"/>\r
+      <span class="smallNote">Base directory for packing. Leave blank to use build checkout directory</span>\r
+      <span id="error_${ib.packBaseDirectory}" class="error"></span>\r
+    </td>\r
+  </tr>\r
+\r
+</l:settingsGroup>\r
+\r
+<l:settingsGroup title="Output">\r
+  <tr>\r
+    <th><label for="${ib.packOutputDirectory}">Output Directory</label><l:star/>:</th>\r
+    <td>\r
+      <props:textProperty name="${ib.packOutputDirectory}" className="longField"/>\r
+      <span class="smallNote">Specify path to put generated NuGet package</span>\r
+      <span id="error_${ib.packOutputDirectory}" class="error"></span>\r
+    </td>\r
+  </tr>\r
+\r
+</l:settingsGroup>\r
+\r
+<l:settingsGroup title="Additionals parameters">\r
+\r
+  <tr>\r
+    <th><label for="${ib.packExcludePatterns}">Exclude files: </label></th>\r
+    <td>\r
+      <props:multilineProperty name="${ib.packExcludePatterns}" linkTitle="Exclude files" cols="60" rows="5" />\r
+      <span class="smallNote">Exclude files when creating a package. Equavalent to NuGet.exe -Exclude argument</span>\r
+      <span id="error_${ib.packExcludePatterns}" class="error"></span>\r
+    </td>\r
+  </tr>\r
+\r
+  <tr>\r
+    <th><label for="${ib.packProperties}">Properties:</label></th>\r
+    <td>\r
+      <props:multilineProperty name="${ib.packProperties}" linkTitle="Properties" cols="60" rows="5" />\r
+      <span class="smallNote">Semicolon or new line separated list of properties of package creation.</span>\r
+      <span id="error_${ib.packProperties}" class="error"></span>\r
+    </td>\r
+  </tr>\r
+\r
+  <tr>\r
+    <th rowspan="2">Options:</th>\r
+    <td>\r
+      <props:checkboxProperty name="${ib.packAsTool}"/>\r
+      <label for="${ib.packAsTool}">Create <strong>tool</strong> package</label>\r
+    </td>\r
+  </tr>\r
+  <tr>\r
+    <td>\r
+      <props:checkboxProperty name="${ib.packSources}"/>\r
+      <label for="${ib.packSources}">Include sources and symbols</label>\r
+    </td>\r
+  </tr>\r
+\r
+  <tr>\r
+    <th><label for="${ib.packCustomCommandline}">Additional commandline arguments:</label></th>\r
+    <td>\r
+      <props:multilineProperty name="${ib.packCustomCommandline}" linkTitle="Commandline" cols="60" rows="5" />\r
+      <span class="smallNote">Additional commandline parameters to add to calling NuGet.exe</span>\r
+      <span id="error_${ib.packCustomCommandline}" class="error"></span>\r
+    </td>\r
+  </tr>\r
+\r
+</l:settingsGroup>\r
+\r
diff --git a/nuget-server/resources/pack/viewPack.jsp b/nuget-server/resources/pack/viewPack.jsp
new file mode 100644 (file)
index 0000000..f536bae
--- /dev/null
@@ -0,0 +1,22 @@
+<%--\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
+<%@ taglib prefix="forms" tagdir="/WEB-INF/tags/forms" %>\r
+<%@ taglib prefix="props" tagdir="/WEB-INF/tags/props" %>\r
+<%@ taglib prefix="l" tagdir="/WEB-INF/tags/layout" %>\r
+<%@ 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
diff --git a/nuget-server/src/META-INF/build-server-plugin-nuget-pack-runner.xml b/nuget-server/src/META-INF/build-server-plugin-nuget-pack-runner.xml
new file mode 100644 (file)
index 0000000..638a5c7
--- /dev/null
@@ -0,0 +1,10 @@
+<?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 http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"\r
+       default-autowire="constructor">\r
+\r
+\r
+  <bean class="jetbrains.buildServer.nuget.server.pack.PackRunTypeRegistrar"/>\r
+  <bean class="jetbrains.buildServer.nuget.server.pack.PackRunType"/>\r
+</beans>
\ No newline at end of file
diff --git a/nuget-server/src/jetbrains/buildServer/nuget/server/pack/PackBean.java b/nuget-server/src/jetbrains/buildServer/nuget/server/pack/PackBean.java
new file mode 100644 (file)
index 0000000..080e8a3
--- /dev/null
@@ -0,0 +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.server.pack;\r
+\r
+import jetbrains.buildServer.nuget.common.PackagesConstants;\r
+\r
+/**\r
+ * @author Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ *         Date: 22.08.11 20:32\r
+ */\r
+public class PackBean {\r
+  public String getNuGetPathKey() { return PackagesConstants.NUGET_PATH; }\r
+  public String getPackOutputDirectory() { return PackagesConstants.NUGET_PACK_OUTPUT_DIR; }\r
+  public String getPackBaseDirectory() { return PackagesConstants.NUGET_PACK_BASE_DIR;}\r
+  public String getPackVersion() { return PackagesConstants.NUGET_PACK_VERSION; }\r
+  public String getPackSpecFile() { return PackagesConstants.NUGET_PACK_SPEC_FILE;}\r
+  public String getPackExcludePatterns() { return PackagesConstants.NUGET_PACK_EXCLUDE_FILES; }\r
+  public String getPackProperties() { return PackagesConstants.NUGET_PACK_PROPERTIES; }\r
+  public String getPackCustomCommandline() { return PackagesConstants.NUGET_PACK_CUSOM_COMMANDLINE; }\r
+  public String getPackAsTool() { return PackagesConstants.NUGET_PACK_AS_TOOL; }\r
+  public String getPackSources() { return PackagesConstants.NUGET_PACK_INCLUDE_SOURCES; }\r
+}\r
diff --git a/nuget-server/src/jetbrains/buildServer/nuget/server/pack/PackRunType.java b/nuget-server/src/jetbrains/buildServer/nuget/server/pack/PackRunType.java
new file mode 100644 (file)
index 0000000..425ba6b
--- /dev/null
@@ -0,0 +1,85 @@
+/*\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.server.pack;\r
+\r
+import jetbrains.buildServer.agent.ServerProvidedProperties;\r
+import jetbrains.buildServer.nuget.common.PackagesConstants;\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
+\r
+/**\r
+ * @author Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ *         Date: 22.08.11 21:05\r
+ */\r
+public class PackRunType extends RunType {\r
+  private final PluginDescriptor myDescriptor;\r
+\r
+  public PackRunType(@NotNull final PluginDescriptor descriptor) {\r
+    myDescriptor = descriptor;\r
+  }\r
+\r
+  @NotNull\r
+  @Override\r
+  public String getType() {\r
+    return PackagesConstants.PACK_RUN_TYPE;\r
+  }\r
+\r
+  @Override\r
+  public String getDisplayName() {\r
+    return "NuGet Packages Pack";\r
+  }\r
+\r
+  @Override\r
+  public String getDescription() {\r
+    return "Creates NuGet package from a given spec file";\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
+      }\r
+    };\r
+  }\r
+\r
+  @Override\r
+  public String getEditRunnerParamsJspFilePath() {\r
+    return myDescriptor.getPluginResourcesPath("pack/editPack.jsp");\r
+  }\r
+\r
+  @Override\r
+  public String getViewRunnerParamsJspFilePath() {\r
+    return myDescriptor.getPluginResourcesPath("pack/viewPack.jsp");\r
+  }\r
+\r
+  @Override\r
+  public Map<String, String> getDefaultRunnerProperties() {\r
+    return new HashMap<String, String>(){{\r
+      put(PackagesConstants.NUGET_PACK_VERSION, "%" + ServerProvidedProperties.BUILD_NUMBER_PROP + "%");\r
+    }};\r
+  }\r
+}\r
diff --git a/nuget-server/src/jetbrains/buildServer/nuget/server/pack/PackRunTypeRegistrar.java b/nuget-server/src/jetbrains/buildServer/nuget/server/pack/PackRunTypeRegistrar.java
new file mode 100644 (file)
index 0000000..857ac0b
--- /dev/null
@@ -0,0 +1,32 @@
+/*\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.server.pack;\r
+\r
+import jetbrains.buildServer.serverSide.RunTypeRegistry;\r
+import org.jetbrains.annotations.NotNull;\r
+\r
+/**\r
+ * @author Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ *         Date: 22.08.11 21:13\r
+ */\r
+public class PackRunTypeRegistrar {\r
+  public PackRunTypeRegistrar(@NotNull final PackRunType rt,\r
+                              @NotNull final RunTypeRegistry reg) {\r
+    reg.registerRunType(rt);\r
+  }\r
+\r
+}\r