|
<?xml version="1.0" encoding="UTF-8"?> |
|
<project name="ant-bootstrap" basedir="." default="test"> |
|
<property name="ANT_CONTRIB_VERSION" value="1.0b3"/> |
|
<property name="JFROG_CLI_VERSION" value="1.16.2"/> |
|
<macrodef name="jfrog-cli"> |
|
<attribute name="taskname" default="jfrog-cli"/> |
|
<attribute name="resultproperty" default="jfrog-cli.result.last"/> |
|
<element name="jfrog-args" implicit="true"/> |
|
<sequential> |
|
<if> |
|
<isset property="@{resultproperty}"/> |
|
<then> |
|
<echo level="debug">previous @{resultproperty} was ${@{resultproperty}}</echo> |
|
<var name="@{resultproperty}" unset="true"/> |
|
</then> |
|
</if> |
|
<exec taskname="@{taskname}" executable="bin/jfrog" failonerror="true" resultproperty="@{resultproperty}"> |
|
<jfrog-args/> |
|
</exec> |
|
</sequential> |
|
</macrodef> |
|
<target name="download"> |
|
<mkdir dir="bin"/> |
|
<get src="https://sourceforge.net/projects/ant-contrib/files/ant-contrib/${ANT_CONTRIB_VERSION}/ant-contrib-${ANT_CONTRIB_VERSION}-bin.tar.gz" dest="bin/ant-contrib-${ANT_CONTRIB_VERSION}-bin.tar.gz"/> |
|
<untar src="bin/ant-contrib-${ANT_CONTRIB_VERSION}-bin.tar.gz" dest="bin/" compression="gzip"/> |
|
<get src="https://dl.bintray.com/jfrog/jfrog-cli-go/${JFROG_CLI_VERSION}/jfrog-cli-windows-amd64/jfrog.exe" dest="bin/jfrog.exe"/> |
|
<taskdef resource="net/sf/antcontrib/antlib.xml"> |
|
<classpath> |
|
<pathelement location="bin/ant-contrib/ant-contrib-1.0b3.jar"/> |
|
</classpath> |
|
</taskdef> |
|
<property environment="env"/> |
|
</target> |
|
<target name="test" depends="download"> |
|
<jfrog-cli taskname="config"> |
|
<arg value="rt"/> |
|
<arg value="c"/> |
|
<arg value="test-artifactory-server"/> |
|
<arg value="--url"/> |
|
<arg value="${env.ARTIFACTORY_URL}"/> |
|
<arg value="--apikey"/> |
|
<arg value="${env.ARTIFACTORY_API_KEY}"/> |
|
</jfrog-cli> |
|
<jfrog-cli taskname="use"> |
|
<arg value="rt"/> |
|
<arg value="use"/> |
|
<arg value="test-artifactory-server"/> |
|
</jfrog-cli> |
|
</jfrog-cli> |
|
<for param="file" parallel="true" threadCount="3"> |
|
<path> |
|
<fileset dir="." includes="*.filespec"/> |
|
</path> |
|
<sequential> |
|
<echo level="info">Downloading artifacts from @{file}</echo> |
|
<jfrog-cli taskname="download-${file}"> |
|
<arg value="rt"/> |
|
<arg value="dl"/> |
|
<arg value="--spec-vars" /> |
|
<arg value="downloadBase=output" /> |
|
<arg value="--spec"/> |
|
<arg value="@{file}"/> |
|
<arg value="--build-number"/> |
|
<arg value="1"/> |
|
<arg value="--build-name"/> |
|
<arg value="mybuild"/> |
|
</jfrog-cli> |
|
</sequential> |
|
</for> |
|
<jfrog-cli taskname="bp"> |
|
<arg value="rt"/> |
|
<arg value="bp"/> |
|
<arg value="mybuild"/> |
|
<arg value="1"/> |
|
</jfrog-cli> |
|
</target> |
|
</project> |