Files
kotlin-fork/pluginPublisher/TeamCityPluginPublisher.xml
T
2013-07-25 20:23:27 +04:00

126 lines
5.1 KiB
XML

<project name="Plugin Publisher" default="verifyAndPublish">
<!--
External params:
eap - for getting idea from eap page
release - for getting idea from download site
version - idea version
actual.branch - current branch name
expected.branch - "verifyAndPublish" target will work only if actual and expected branches is equal
-->
<condition property="is.expected.branch">
<equals arg1="${actual.branch}" arg2="${expected.branch}" />
</condition>
<property name="idea.eap.download.page.url" value="http://confluence.jetbrains.com/display/IDEADEV/IDEA+${version}+EAP"/>
<property name="idea.release.download.page.url" value="http://download.jetbrains.com/idea/ideaIC-${version}.tar.gz"/>
<property name="plugin.repository.url" value="http://www.jetbrains.com/kotlin/eap-plugin-repository"/>
<property name="updatePlugins.xml" value="updatePlugins.xml"/>
<property name="jdk16.home" value="${java.home}"/>
<macrodef name="verifyPlugin">
<attribute name="verify.plugin.path" />
<attribute name="verify.against.idea.dir" />
<attribute name="verifier.jar" />
<sequential>
<!-- Run plugin verifier -->
<java fork="true" failonerror="true" jar="@{verifier.jar}">
<arg value="-r"/>
<arg value="${jdk16.home}"/>
<arg value="@{verify.plugin.path}"/>
<arg value="@{verify.against.idea.dir}"/>
</java>
</sequential>
</macrodef>
<target name="setEapDownload" if="eap">
<loadresource property="download.url">
<url url="${idea.eap.download.page.url}"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replaceregex pattern="^(.*)(http://download\.jetbrains\.com/idea/ideaIC\-\d+\.\d+\.tar\.gz)(.*)$"
replace="\2" flags="s"/>
</tokenfilter>
</filterchain>
</loadresource>
</target>
<target name="setReleasedDownload" if="release">
<property name="download.url" value="${idea.release.download.page.url}" />
</target>
<target name="verifyAndPublish" depends="setEapDownload, setReleasedDownload" if="is.expected.branch">
<echo message="External parameters: ${eap} Release ${release} Version ${version}" />
<!-- Download and extract IDEA -->
<echo message="Downloading IDEA from ${download.url}"/>
<get src="${download.url}" dest="ideaIC.tar.gz" verbose="on" usetimestamp="true"/>
<untar src="ideaIC.tar.gz" dest="${basedir}" overwrite="on" compression="gzip"/>
<!-- Get extracted IDEA directory -->
<pathconvert property="idea.dir">
<dirset dir="${basedir}">
<include name="idea-IC-*"/>
</dirset>
</pathconvert>
<loadfile property="idea.version" srcfile="${idea.dir}/build.txt" />
<echo message="IDEA version is ${idea.version} located ${idea.dir}"/>
<!-- Get plugin verifier -->
<delete file="plugin-verifier.jar" failonerror="false"/>
<get src="http://teamcity.jetbrains.com/guestAuth/repository/download/bt351/.lastPinned/plugin-verifier-1.0-SNAPSHOT.jar"
dest="plugin-verifier.jar"/>
<!-- Get kotlin plugin -->
<pathconvert property="kotlin.plugin.path">
<fileset dir="${basedir}">
<include name="kotlin-plugin-*"/>
</fileset>
</pathconvert>
<basename property="kotlin.plugin.filename" file="${kotlin.plugin.path}"/>
<loadresource property="kotlin.plugin.version">
<string value="${kotlin.plugin.filename}"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replaceregex pattern="^kotlin-plugin-(\d+\.\d+\.\d+).zip$" replace="\1" flags="s"/>
</tokenfilter>
</filterchain>
</loadresource>
<echo message="Kotlin Plugin version is ${kotlin.plugin.version} located ${kotlin.plugin.path}"/>
<!-- Get kannotator plugin -->
<pathconvert property="kannotator.plugin.path">
<fileset dir="${basedir}">
<include name="kannotator-plugin-*"/>
</fileset>
</pathconvert>
<basename property="kannotator.plugin.filename" file="${kannotator.plugin.path}"/>
<loadresource property="kannotator.plugin.version">
<string value="${kannotator.plugin.filename}"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replaceregex pattern="^kannotator-plugin-(\d+\.\d+\.\d+).zip$" replace="\1" flags="s"/>
</tokenfilter>
</filterchain>
</loadresource>
<echo message="Kannotator Plugin version is ${kannotator.plugin.version} located ${kannotator.plugin.path}"/>
<!-- Verify both plugins -->
<verifyPlugin verifier.jar="plugin-verifier.jar" verify.against.idea.dir="${idea.dir}" verify.plugin.path="${kotlin.plugin.path}" />
<verifyPlugin verifier.jar="plugin-verifier.jar" verify.against.idea.dir="${idea.dir}" verify.plugin.path="${kannotator.plugin.path}" />
<!-- Everything is ok, publish plugin and xml descriptor -->
<echo message="##teamcity[buildStatus text='kotlin-${kotlin.plugin.version} and kannotator-${kannotator.plugin.version} have been verified against ${idea.version}']"/>
<echo message="##teamcity[publishArtifacts '${kotlin.plugin.path}']"/>
<echo message="##teamcity[publishArtifacts '${kannotator.plugin.path}']"/>
</target>
</project>