blob: 7b1f7601857ef01d9730ea10f47c20179db5fc07 [file] [log] [blame]
dacarver60a270d2010-05-05 18:51:40 +00001<!--
2 This script is completely boilerplate, and is used to bootstrap before building.
3
4 To use it, call it like this from within your build.xml's run target:
5
6<project default="run">
7 <target name="run">
8 <ant antfile="bootstrap.xml" target="init">
9 <property name="basebuilderTag" value="r35x_v20090811" />
10 <property name="commonrelengTag" value="HEAD" />
11 <property name="ANTCONTRIB_VERSION" value="1.0b2" />
12 <property name="ANT4ECLIPSE_VERSION" value="1.0.0.M3" />
13 <property name="build.properties" value="build.properties" />
14 </ant>
15 ...
16 <condition property="JAVA_HOME" value="${java.home}" else="${java.home}/..">
17 <available file="${java.home}/bin/javac" type="file" />
18 </condition>
19 ...
20 <property name="build.properties" value="build.properties" />
21 <property file="${build.properties}" />
22 <ant antfile="${relengCommonBuilderDir}/build.xml" />
23 </target>
24</project>
25-->
26
27<project default="init">
28 <condition property="isInHudson" value="true">
29 <or>
30 <contains string="${user.dir}" substring="hudson" />
31 <contains string="${user.name}" substring="hudson" />
32 <contains string="${user.home}" substring="hudson" />
33 </or>
34 </condition>
35 <target name="local" unless="isInHudson">
36 <property name="WORKINGDIR" value="${basedir}/.." />
37 <property name="COMMON_TOOLS" value="${java.io.tmpdir}/build/downloads" />
38 <property name="writableBuildRoot" value="${WORKSPACE}/build" />
39 </target>
40
41 <!-- if required: use a newer version -->
42 <target name="get.ant-contrib" unless="ant-contrib.jar.exists">
43 <property name="ANTCONTRIB_VERSION" value="1.0b2" />
44 <property name="ANTCONTRIB_MIRROR" value="http://downloads.sourceforge.net/ant-contrib/" />
45 <get usetimestamp="true"
46 dest="${COMMON_TOOLS}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip"
47 src="${ANTCONTRIB_MIRROR}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip"
48 />
49 <touch file="${COMMON_TOOLS}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip" />
50 <mkdir dir="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_" />
51 <unzip src="${COMMON_TOOLS}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip"
52 dest="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_"
53 overwrite="true"
54 />
55 <copy file="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_/ant-contrib/lib/ant-contrib.jar"
56 tofile="${COMMON_TOOLS}/ant-contrib.jar"
57 failonerror="true"
58 />
59 <delete dir="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_"
60 includeemptydirs="true"
61 quiet="true"
62 />
63 </target>
64
65 <!-- if required: use a newer version -->
66 <target name="get.ant4eclipse" unless="ant4eclipse.jar.exists">
67 <property name="ANT4ECLIPSE_VERSION" value="1.0.0.M3" />
68 <property name="ANT4ECLIPSE_MIRROR" value="http://downloads.sourceforge.net/ant4eclipse/" />
69 <get usetimestamp="true"
70 dest="${COMMON_TOOLS}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip"
71 src="${ANT4ECLIPSE_MIRROR}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip"
72 />
73 <touch file="${COMMON_TOOLS}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip" />
74 <mkdir dir="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_" />
75 <unzip src="${COMMON_TOOLS}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip"
76 dest="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_"
77 overwrite="true"
78 />
79 <copy file="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.jar"
80 tofile="${COMMON_TOOLS}/ant4eclipse.jar"
81 failonerror="true"
82 />
83 <delete dir="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_"
84 includeemptydirs="true"
85 quiet="true"
86 />
87 </target>
88
89 <target name="get.athena.common.releng.and.releng.basebuilder">
90 <!-- find relengCommonBuilderDir and relengBaseBuilderDir -->
91 <for param="dir" list="${COMMON_TOOLS}, ${basedir}/../.., ${basedir}/.." delimiter=", ">
92 <sequential>
93 <if>
94 <available file="@{dir}/org.eclipse.dash.common.releng" type="dir" />
95 <then>
96 <property name="relengCommonBuilderDir" value="@{dir}/org.eclipse.dash.common.releng" />
97 </then>
98 </if>
99 <if>
100 <available file="@{dir}/org.eclipse.releng.basebuilder" type="dir" />
101 <then>
102 <property name="relengBaseBuilderDir" value="@{dir}/org.eclipse.releng.basebuilder" />
103 </then>
104 </if>
105
106 </sequential>
107 </for>
108
109 <if>
110 <or>
111 <not>
112 <isset property="relengCommonBuilderDir" />
113 </not>
114 <not>
115 <isset property="relengBaseBuilderDir" />
116 </not>
117 </or>
118 <then>
119 <!-- fetch projects using psf file; create it if needed -->
120 <if>
121 <not>
dacarvere0d4af22010-05-15 18:41:17 +0000122 <available file="${COMMON_TOOLS}/psfs/athena.psf" type="file" />
dacarver60a270d2010-05-05 18:51:40 +0000123 </not>
124 <then>
125 <!-- if required: use a different tag/branch -->
126 <property name="basebuilderTag" value="r35x_v20090811" />
127 <property name="commonrelengTag" value="HEAD" />
128
dacarvere0d4af22010-05-15 18:41:17 +0000129 <echo>Create ${COMMON_TOOLS}/psfs/athena.psf file</echo>
130 <mkdir dir="${COMMON_TOOLS}/psfs" />
dacarveree8cf7a2010-05-15 18:39:24 +0000131 <echo file="${COMMON_TOOLS}/psfs/athena.psf">&lt;?xml version="1.0" encoding="UTF-8"?>
dacarver60a270d2010-05-05 18:51:40 +0000132&lt;psf version="2.0">
133&lt;provider id="org.eclipse.team.cvs.core.cvsnature">
134&lt;project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/technology,org.eclipse.dash/athena/org.eclipse.dash.commonbuilder/org.eclipse.dash.commonbuilder.releng,org.eclipse.dash.common.releng,${commonrelengTag}"/>
135&lt;project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse,org.eclipse.releng.basebuilder,org.eclipse.releng.basebuilder,${basebuilderTag}"/>
136&lt;/provider>
137&lt;/psf></echo>
138 </then>
139 </if>
140 <echo>Fetch projects from athena.psf into ${COMMON_TOOLS}</echo>
141 <cvsGetProjectSet cvsreallyquiet="true"
142 cvsUser="anonymous"
143 cvsPwd=""
144 command="checkout"
dacarveree8cf7a2010-05-15 18:39:24 +0000145 projectSet="${COMMON_TOOLS}/psfs/athena.psf"
dacarver60a270d2010-05-05 18:51:40 +0000146 destination="${COMMON_TOOLS}"
147 />
148 <property name="relengCommonBuilderDir" value="${COMMON_TOOLS}/org.eclipse.dash.common.releng" />
149 <property name="relengBaseBuilderDir" value="${COMMON_TOOLS}/org.eclipse.releng.basebuilder" />
150 </then>
151 </if>
152 </target>
153
154 <target name="init" depends="local">
155 <property name="WORKINGDIR" value="${basedir}/.." />
156 <property name="COMMON_TOOLS" value="${basedir}/../tools" />
157 <mkdir dir="${COMMON_TOOLS}" />
158
159 <available file="${COMMON_TOOLS}/ant-contrib.jar" type="file" property="ant-contrib.jar.exists" />
160 <antcall target="get.ant-contrib" />
161 <taskdef resource="net/sf/antcontrib/antlib.xml">
162 <classpath>
163 <pathelement location="${COMMON_TOOLS}/ant-contrib.jar" />
164 </classpath>
165 </taskdef>
166
167 <available file="${COMMON_TOOLS}/ant4eclipse.jar" type="file" property="ant4eclipse.jar.exists" />
168 <antcall target="get.ant4eclipse" />
169 <taskdef resource="org/ant4eclipse/antlib.xml">
170 <classpath>
171 <pathelement location="${COMMON_TOOLS}/ant4eclipse.jar" />
172 </classpath>
173 </taskdef>
174
175 <antcallback target="get.athena.common.releng.and.releng.basebuilder"
176 return="relengCommonBuilderDir, relengBaseBuilderDir"
177 />
178
179 <if>
180 <or>
181 <not>
182 <isset property="relengCommonBuilderDir" />
183 </not>
184 <not>
185 <isset property="relengBaseBuilderDir" />
186 </not>
187 </or>
188 <then>
189 <fail>Error!
190 $${relengBaseBuilderDir} or $${relengCommonBuilderDir} could not be found!
191
192 Try checking out manually using psfs/athena.psf
193</fail>
194 </then>
195 </if>
196 <property name="build.properties" value="build.properties" />
197 <echo file="${build.properties}" append="true">
198
199#bootstrap.xml properties
200WORKINGDIR=${WORKINGDIR}
201COMMON_TOOLS=${COMMON_TOOLS}
202relengCommonBuilderDir=${relengCommonBuilderDir}
203relengBaseBuilderDir=${relengBaseBuilderDir}
204</echo>
205 <if>
206 <isset property="writableBuildRoot" />
207 <then>
208 <echo file="${build.properties}" append="true">writableBuildRoot=${writableBuildRoot}
209</echo>
210 </then>
211 </if>
212 </target>
213
214</project>