<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <header>
    <identifier id="com.urbancode.air.plugin.Preflight" 
            version="3" name="Preflight"/>
    <description>The Preflight plugin provides steps that can be used for developer Preflight builds</description>
    <tag>Build/Preflight</tag>
  </header>

  <step-type name="Transfer Source Step">
    <description></description>
    <properties>
      <property name="serverHost">
        <property-ui type="textBox" hidden="true" default-value="${p:preflight.serverHost}"/>
      </property>
      <property name="serverPort">
        <property-ui type="textBox" hidden="true" default-value="${p:preflight.serverPort}"/>
      </property>
    </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="${JAVA_HOME}/bin/java">
      <arg value="-jar"/>
      <arg file="preflight-plugin.jar"/>
      <arg value="source"/>
      <arg value="${serverHost}" />
      <arg value="${serverPort}" />
    </command>
  </step-type>

  <step-type name="Transfer Artifacts Step">
    <description></description>
    <properties>
      <property name="serverHost">
        <property-ui type="textBox" hidden="true" default-value="${p:preflight.serverHost}"/>
      </property>
      <property name="serverPort">
        <property-ui type="textBox" hidden="true" default-value="${p:preflight.serverPort}"/>
      </property>
    </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="${JAVA_HOME}/bin/java">
      <arg value="-jar"/>
      <arg file="preflight-plugin.jar"/>
      <arg value="artifacts"/>
      <arg value="${serverHost}" />
      <arg value="${serverPort}" />
    </command>
  </step-type>
</plugin>
