ソース・プラグインは、自動化プラグインと同様に、upgrade.xml、info.xml 、および plugin.xml の 3 つのファイルで定義されます。最初の 2 ファイルの構造はどちらのタイプのプラグインでも同じです。plugin.xml ファイルの構造はプラグインのタイプによって異なります。このトピックではソース・プラグインの plugin.xml ファイルの構造について説明します。自動化プラグインの plugin.xml ファイルについては、自動化プラグインの plugin.xml ファイルを参照してください。
<server:plugin-type>Source</server:plugin-type> タグはプラグインのタイプを識別します。ソース・プラグインの場合、タイプは Source でなければなりません。
<?xml version="1.0" encoding="UTF-8"?>
<!-- the xmlns:server argument is necessary to parse the tags with the server prefix -->
<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.Name" name="Plugin Name" version="1"/>
<description>Short description</description>
<tag>SCM/Name</tag>
<server:plugin-type>Source</server:plugin-type>
</header>
ソース・プラグインのステップは 1 つで、Import Version という名前でなければなりません。
<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="${JAVA_HOME}/bin/java">
<arg value="${JAVA_OPTS}"/>
<arg value="-jar"/>
<arg file="FileSystemSourceConfig.jar"/>
<arg value="ImportVersion"/>
<arg file="${PLUGIN_INPUT_PROPS}"/>
<arg file="${PLUGIN_OUTPUT_PROPS}"/>
</command>
</step-type>
次のコード・フラグメントが示すように、ソース・プラグインには 2 つのプロパティー・グループが存在します。 Component タイプのプロパティーの構成は「新規コンポーネントの作成」ウィンドウで行います。Import タイプのプロパティーの構成は「コンポーネントのインポート」ウィンドウで行います。
<!-- ==================================== -->
<!-- Properties -->
<!-- ==================================== -->
<server:property-group type="Component" name="FileSystemComponentProperties">
<server:property name="property-name" required="true">
<server:property-ui type="textBox"
label="property-label"
description="property-description" />
</server:property>
</server:property-group>
<!-- If left empty or omitted then no dialog will appear -->
<server:property-group type="Import" name="FileSystemImportProperties">
<server:property name="property-name" required="true">
<server:property-ui type="textBox"
label="property-label"
description="property-description" />
</server:property>
</server:property-group>
</plugin>