Merged xdebug from 1.3.x
[phpeclipse.git] / utilities / pluginbuilder / build-files / build_shared.xml
1 <project name="Shared build targets">\r
2         <!-- the following properties must be set from the calling script \r
3     <property name="eclipse.installation.dir" value="${buildDirectory}"/>\r
4     <property name="eclipse.local.tar.non.server" value="${test.eclipse.host}"/>\r
5     eclipse.download.cache,pluginbuilder.eclipse.url\r
6     optional:\r
7     <property name="pluginbuilder.additional.feature.urls" value="featureurl1,featureurl2"/>\r
8     -->\r
9     \r
10         <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${buildHome}/build-files/ant-contrib.jar" />\r
11         \r
12         <target name="unpack.eclipse">\r
13                 <condition property="unpack.eclipse">\r
14                         <not>\r
15                                 <available type="dir" file="${eclipse.installation.dir}"/>\r
16                         </not>\r
17                 </condition>\r
18                 <antcall target="-unpack.eclipse.ifnecessary"/>\r
19         </target>    \r
20     \r
21         <!-- call either with or feature.url or pluginbuilder.eclipse.url\r
22                  sets property archive.location to the archive path in download cache.\r
23          -->\r
24         <target name="-set.archive.location" if="pluginbuilder.is.server">\r
25                 <condition property="archive.url" value="${feature.url}" else="${pluginbuilder.eclipse.url}">\r
26                                 <isset property="feature.url"/>\r
27                 </condition>\r
28                 <mkdir dir="${eclipse.download.cache}"/>\r
29                 <tempfile destdir="${eclipse.download.cache}" property="tmp.file" suffix=".txt" prefix="downloadurl"/>          \r
30                 <echo file="${tmp.file}" message="${archive.url}"/>\r
31                 <checksum file="${tmp.file}" property="pluginbuilder.eclipse.url.checksum"/>\r
32                 <delete file="${tmp.file}"/>\r
33                 <property name="archive.location" value="${eclipse.download.cache}/${pluginbuilder.eclipse.url.checksum}"/>\r
34                 <!-- <echo message="${archive.location} is archive location for ${archive.url}"/> -->\r
35         </target>\r
36         \r
37         <target name="-set.eclipse.local.tar.server" if="pluginbuilder.is.server" depends="-set.archive.location">\r
38                 <property name="eclipse.local.tar" value="${archive.location}"/>\r
39         </target>\r
40         \r
41         <target name="-set.eclipse.local.tar.non.server" unless="pluginbuilder.is.server">\r
42                 <property name="eclipse.local.tar" value="${eclipse.local.tar.non.server}"/>\r
43         </target>\r
44         \r
45         <target name="-get.archive.ifnecessary" unless="eclipse.is.downloaded">\r
46                 <condition property="archive.url" value="${feature.url}" else="${pluginbuilder.eclipse.url}">\r
47                                 <isset property="feature.url"/>\r
48                 </condition>\r
49                 <get src="${archive.url}" dest="${archive.location}" />         \r
50         </target>\r
51         \r
52         <target name="-get.archive" depends="-set.archive.location" if="pluginbuilder.is.server">\r
53                 <condition property="eclipse.is.downloaded">\r
54                         <available file="${archive.location}" property="${eclipse.is.downloaded}"/>\r
55                 </condition>            \r
56                 <antcall target="-get.archive.ifnecessary"/> \r
57         </target>\r
58         \r
59         <target name="-get.features" if="pluginbuilder.is.server" >\r
60                 <property name="pluginbuilder.feature.urls" value=""/>\r
61                 <foreach list="${pluginbuilder.feature.urls}" param="feature.url" delimiter="," target="-get.archive" inheritall="true"/>\r
62         </target>\r
63         \r
64         <target name="-unpack.features" if="pluginbuilder.is.server">\r
65                 <property name="pluginbuilder.feature.urls" value=""/>\r
66                 <foreach list="${pluginbuilder.feature.urls}" param="feature.url" delimiter="," target="-unpack.feature" inheritall="true"/>\r
67         </target>\r
68         \r
69         <target name="-unpack.feature" depends="-set.archive.location">\r
70                 <property name="tempunziplocation" value="${buildDirectory}/tmpunzip"/>\r
71                 <delete dir="${tempunziplocation}" failonerror="false"/>\r
72                 <mkdir dir="${tempunziplocation}"/>\r
73                 <unzip src="${archive.location}" overwrite="true" dest="${tempunziplocation}"/>\r
74                 <condition property="moveroot" value="${tempunziplocation}/eclipse" else="${tempunziplocation}">\r
75                                 <available file="${tempunziplocation}/eclipse" type="dir"/>\r
76                 </condition>\r
77                 <move todir="${eclipse.installation.dir}" includeemptydirs="true">\r
78                         <fileset dir="${moveroot}" includes="**"/>\r
79                 </move>\r
80         </target>\r
81                         \r
82         <target name="-unpack.eclipse.ifnecessary" if="unpack.eclipse">\r
83                 <antcall target="-get.archive"/>\r
84                 <condition property="is.windows">\r
85                   <os family="windows"/>\r
86                 </condition>\r
87                 <antcall target="-unpack.eclipse.windows"/>\r
88                 <antcall target="-unpack.eclipse.linux"/>\r
89                 <antcall target="-get.features"/>\r
90                 <antcall target="-unpack.features"/>\r
91         </target>\r
92         \r
93         <target name="-unpack.eclipse.windows" if="is.windows" depends="-set.eclipse.local.tar.server,-set.eclipse.local.tar.non.server">\r
94                 <unzip src="${eclipse.local.tar}" overwrite="true" dest="${eclipse.installation.dir}/.."/>              \r
95         </target>\r
96         \r
97         <target name="-unpack.eclipse.linux" unless="is.windows" depends="-set.eclipse.local.tar.server,-set.eclipse.local.tar.non.server">\r
98                 <untar src="${eclipse.local.tar}" overwrite="true" dest="${eclipse.installation.dir}/.." compression="gzip"/>           \r
99         </target>\r
100         \r
101         <target name="test">\r
102                 <property name="buildDirectory" value="C:/Temp/tst"/>\r
103                 <mkdir dir="${buildDirectory}"/>\r
104                 <property name="eclipse.download.cache" value="C:/Temp/downloadcache"/>\r
105                 <property name="pluginbuilder.is.server" value="true"/>\r
106                 <property name="pluginbuilder.eclipse.url" value="http://mirror.yoxos-eclipse-distribution.de/eclipse.org/eclipse/downloads/drops/R-3.2.2-200702121330/eclipse-PDE-3.2.2.zip"/>\r
107                 \r
108                 <property name="eclipse.installation.dir" value="C:/Temp/eclipse_root/eclipse"/>\r
109                 <delete dir="${eclipse.installation.dir}" failonerror="false"/>\r
110                 <property name="pluginbuilder.feature.urls" value="http://self.pluginbuilder.org/0.2.0/org.pluginbuilder.feature-0.2.0.20070218PRD.zip,http://mirror.yoxos-eclipse-distribution.de/eclipse.org/eclipse/downloads/drops/R-3.2.2-200702121330/eclipse-examples-3.2.2.zip"/>\r
111                 <antcall target="unpack.eclipse"/>\r
112         </target>\r
113         \r
114 </project>