<?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.plugin.source.TFS_SCM" name="TFS_SCM" version="16"/>
    <description>
      The TFS_SCM plugins automates importing version artifacts from a TFS server.
    </description>
    <tag>Source and Repositories/Team Foundation Server SCM</tag>
    <server:plugin-type>Source</server:plugin-type>
  </header>
  <step-type name="Import Version">
    <description>Import a new version from TFS_SCM</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="TFS_SCM-SourceConfig.jar"/>
      <arg value="ImportVersion"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>

  <!-- ==================================== -->
    <!--   Properties                         -->
    <!-- ==================================== -->
    <server:property-group type="Component" name="TFS_SCMComponentProperties">
      <server:property name="url" required="true">
        <server:property-ui type="textBox"
                          label="Collection URL"
                          description="The URL of the Team Foundation Server (TFS) or Visual Studio Online (VSO) collection, for example: https://{username}.visualstudio.com/DefaultCollection."
                          placeholder="http://tfs2010:8080/tfs/mygroup"/>
      </server:property>
      <server:property name="serverFolder" required="true">
        <server:property-ui type="textBox"
                          label="Server Project Folder"
                          description="The path variable to the project folder on Visual Studio Online or the Team Foundation Server server. 
			  	By default, this variable is $/ followed by the name of the project."
                          placeholder="$/ProjectName"/>
      </server:property>
      <server:property name="tfExePath">
        <server:property-ui type="textBox"
                          label="Path to tf.exe or tf.cmd"
                          default-value="tf.exe"
                          description="The full path to the tf.exe or tf.cmd file that comes with Visual Studio or Team Explorer Everywhere. If a value is not
			  	specified, the tf executable file must be available on the agent's PATH environment variable."
                          placeholder="&lt;Visual_Studio_Install_Dir&gt;\tf.exe"/>
      </server:property>
      <server:property name="username">
        <server:property-ui type="textBox"
                          label="User"
                          description="The user name for the account that has access to the Team Foundation Server or Visual Studio Online repository."/>
      </server:property>
      <server:property name="password">
        <server:property-ui type="secureBox"
                          label="Password"
                          description="The password for the account that has access to the Team Foundation Server or Visual Studio Online repository."/>
      </server:property>
      <server:property name="workspace">
        <server:property-ui type="textBox"
                          label="Workspace"
                          description="TThe name of the Team Foundation Server or Visual Studio Online workspace. To get a list of workspace names 
				  from the server, run the following command: TF workspaces /server:Repository_URL /login:user,password. 
				  For Visual Studio Online, alternate authentication credentials must be enabled."
                          placeholder="MyWorkspaceName"/>
      </server:property>
      <server:property name="localFolder">
        <server:property-ui type="textBox"
                          label="Local Workspace Folder"
                          description="The path to the local workspace folder of the computer with the agent. If the folder does not exist, it is
				  created to the specified path. This value is only used if the Workspace property is specified.
				  Otherwise, a temporary folder will be created in the agent's working directory."
                          placeholder="C:\Users\UserName\Source\Workspaces\Workspace"/>
      </server:property>
      <server:property name="saveFileExecuteBits">
        <server:property-ui type="checkBox"
                          label="Preserve execute permissions"
                          description="For Linux and UNIX operating systems, 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" />
    </server:property>
    </server:property-group>

    <server:property-group type="Import" name="TFS_SCMImportProperties">
      <server:property name="label" >
        <server:property-ui type="textBox"
                            label="Label"
                            description="Optional: The name of the version label to load."/>
      </server:property>
      <server:property name="changeSet" >
        <server:property-ui type="textBox"
                            label="Changeset"
                            description="Optional: The version integer of the Team Foundation Server changeset to load."/>
      </server:property>
    </server:property-group>
</plugin>
