<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed Materials - Property of IBM* and/or HCL**
- UrbanCode Deploy
- UrbanCode Build
- UrbanCode Release
- AnthillPro
- (c) Copyright IBM Corporation 2011, 2017. All Rights Reserved.
- (c) Copyright HCL Technologies Ltd. 2018. All Rights Reserved.
-
- U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by
- GSA ADP Schedule Contract with IBM Corp.
-
- * Trademark of International Business Machines
- ** Trademark of HCL Technologies Limited
-->
<plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1"
    xmlns:server="http://www.urbancode.com/PluginServerXMLSchema_v1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <header>
    <identifier id="com.urbancode.air.plugin.source.uBuild" name="uBuild" version="11"/>
    <description>
      The UrbanCode Build plugin automates uploading artifacts from a UrbanCode Build server.
      </description>
    <tag>Source and Repositories/uBuild</tag>
    <server:plugin-type>Source</server:plugin-type>
  </header>

    <step-type name="Import Version">
      <description>Creates a new component version and imports artifacts</description>
      <properties>
      </properties>
      <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>

      <command program="${PLUGIN_HOME}/javawrapper.sh">
        <arg value="-jar"/>
        <arg file="uBuildSourceConfig.jar"/>
        <arg value="ImportVersion"/>
        <arg file="${PLUGIN_INPUT_PROPS}"/>
        <arg file="${PLUGIN_OUTPUT_PROPS}"/>
      </command>

    </step-type>

    <!-- ==================================== -->
    <!--   Properties                         -->
    <!-- ==================================== -->
    <server:property-group type="Component" name="uBuildComponentProperties">
      <server:property name="uBuildUrl" required="true">
        <server:property-ui type="textBox"
                            label="UrbanCode Build Url"
                            description="URL of the UrbanCode Build server."
                            placeholder= "https://uBuildrepo.example.com"/>
      </server:property>
      <server:property name="user" required="true">
        <server:property-ui type="textBox"
                            label="User" />
      </server:property>
      <server:property name="password" required="true">
        <server:property-ui type="secureBox"
                            label="Password" />
      </server:property>
      <server:property name="project" required="true">
        <server:property-ui type="textBox"
                            label="Project"
                            description="The name of the UrbanCode Build project. Projects
                            roughly correspond to UrbanCode Deploy components."
                            placeholder="myproject" />
      </server:property>
      <server:property name="workflow" required="true">
        <server:property-ui type="textBox"
                            label="Build Process"
                            description="Name of the workflow in UrbanCode Build to import builds from."
                            placeholder="build workflow [master]" />
      </server:property>
      <server:property name="status" required="true">
        <server:property-ui type="textBox"
                            label="Status"
                            description="The status that build lives must have before they can be
                            imported. Only buildlives with this status are imported."
                            placeholder="success" />
      </server:property>
      <server:property name="artifactSets" required="true">
        <server:property-ui type="textAreaBox"
                            label="Artifact Sets"
                            default-value="Default"
                            description="If Copy to CodeStation is checked, type the list of artifact
                            sets to resolve in CodeStation. Place each list item on a new line." />
      </server:property>
      <server:property name="saveFileExecuteBits">
        <server:property-ui type="checkBox"
                            label="Preserve execute permissions"
                            description="For Linux and UNIX operating systems, select this check
                          box to retain the execute permissions for each file."/>
      </server:property>
      <server:property name="extensions">
      <server:property-ui type="textBox"
                          label="Extensions of files to Convert"
                          description="If text-type files must be converted into another character set,
                          type the list of file extensions to be converted. Matching file types are
                          converted into the default or system character set of the system where the
                          agent is located. Separate list items with commas."
                          placeholder=".txt,.log,.properties" />
    </server:property>
    </server:property-group>
</plugin>
