Adding the pluginbuilder files that are used in the nightly build process.
[phpeclipse.git] / utilities / pluginbuilder / build-files / build_shared.xml
diff --git a/utilities/pluginbuilder/build-files/build_shared.xml b/utilities/pluginbuilder/build-files/build_shared.xml
new file mode 100644 (file)
index 0000000..f6073b9
--- /dev/null
@@ -0,0 +1,114 @@
+<project name="Shared build targets">\r
+       <!-- the following properties must be set from the calling script \r
+    <property name="eclipse.installation.dir" value="${buildDirectory}"/>\r
+    <property name="eclipse.local.tar.non.server" value="${test.eclipse.host}"/>\r
+    eclipse.download.cache,pluginbuilder.eclipse.url\r
+    optional:\r
+    <property name="pluginbuilder.additional.feature.urls" value="featureurl1,featureurl2"/>\r
+    -->\r
+    \r
+       <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${buildHome}/build-files/ant-contrib.jar" />\r
+       \r
+       <target name="unpack.eclipse">\r
+               <condition property="unpack.eclipse">\r
+                       <not>\r
+                               <available type="dir" file="${eclipse.installation.dir}"/>\r
+                       </not>\r
+               </condition>\r
+               <antcall target="-unpack.eclipse.ifnecessary"/>\r
+       </target>    \r
+    \r
+       <!-- call either with or feature.url or pluginbuilder.eclipse.url\r
+                sets property archive.location to the archive path in download cache.\r
+        -->\r
+       <target name="-set.archive.location" if="pluginbuilder.is.server">\r
+               <condition property="archive.url" value="${feature.url}" else="${pluginbuilder.eclipse.url}">\r
+                               <isset property="feature.url"/>\r
+               </condition>\r
+               <mkdir dir="${eclipse.download.cache}"/>\r
+               <tempfile destdir="${eclipse.download.cache}" property="tmp.file" suffix=".txt" prefix="downloadurl"/>          \r
+               <echo file="${tmp.file}" message="${archive.url}"/>\r
+               <checksum file="${tmp.file}" property="pluginbuilder.eclipse.url.checksum"/>\r
+               <delete file="${tmp.file}"/>\r
+               <property name="archive.location" value="${eclipse.download.cache}/${pluginbuilder.eclipse.url.checksum}"/>\r
+               <!-- <echo message="${archive.location} is archive location for ${archive.url}"/> -->\r
+       </target>\r
+       \r
+       <target name="-set.eclipse.local.tar.server" if="pluginbuilder.is.server" depends="-set.archive.location">\r
+               <property name="eclipse.local.tar" value="${archive.location}"/>\r
+       </target>\r
+       \r
+       <target name="-set.eclipse.local.tar.non.server" unless="pluginbuilder.is.server">\r
+               <property name="eclipse.local.tar" value="${eclipse.local.tar.non.server}"/>\r
+       </target>\r
+       \r
+       <target name="-get.archive.ifnecessary" unless="eclipse.is.downloaded">\r
+               <condition property="archive.url" value="${feature.url}" else="${pluginbuilder.eclipse.url}">\r
+                               <isset property="feature.url"/>\r
+               </condition>\r
+               <get src="${archive.url}" dest="${archive.location}" />         \r
+       </target>\r
+       \r
+       <target name="-get.archive" depends="-set.archive.location" if="pluginbuilder.is.server">\r
+               <condition property="eclipse.is.downloaded">\r
+                       <available file="${archive.location}" property="${eclipse.is.downloaded}"/>\r
+               </condition>            \r
+               <antcall target="-get.archive.ifnecessary"/> \r
+       </target>\r
+       \r
+       <target name="-get.features" if="pluginbuilder.is.server" >\r
+               <property name="pluginbuilder.feature.urls" value=""/>\r
+               <foreach list="${pluginbuilder.feature.urls}" param="feature.url" delimiter="," target="-get.archive" inheritall="true"/>\r
+       </target>\r
+       \r
+       <target name="-unpack.features" if="pluginbuilder.is.server">\r
+               <property name="pluginbuilder.feature.urls" value=""/>\r
+               <foreach list="${pluginbuilder.feature.urls}" param="feature.url" delimiter="," target="-unpack.feature" inheritall="true"/>\r
+       </target>\r
+       \r
+       <target name="-unpack.feature" depends="-set.archive.location">\r
+               <property name="tempunziplocation" value="${buildDirectory}/tmpunzip"/>\r
+               <delete dir="${tempunziplocation}" failonerror="false"/>\r
+               <mkdir dir="${tempunziplocation}"/>\r
+               <unzip src="${archive.location}" overwrite="true" dest="${tempunziplocation}"/>\r
+               <condition property="moveroot" value="${tempunziplocation}/eclipse" else="${tempunziplocation}">\r
+                               <available file="${tempunziplocation}/eclipse" type="dir"/>\r
+               </condition>\r
+               <move todir="${eclipse.installation.dir}" includeemptydirs="true">\r
+                       <fileset dir="${moveroot}" includes="**"/>\r
+               </move>\r
+       </target>\r
+                       \r
+       <target name="-unpack.eclipse.ifnecessary" if="unpack.eclipse">\r
+               <antcall target="-get.archive"/>\r
+               <condition property="is.windows">\r
+                 <os family="windows"/>\r
+               </condition>\r
+               <antcall target="-unpack.eclipse.windows"/>\r
+               <antcall target="-unpack.eclipse.linux"/>\r
+               <antcall target="-get.features"/>\r
+               <antcall target="-unpack.features"/>\r
+       </target>\r
+       \r
+       <target name="-unpack.eclipse.windows" if="is.windows" depends="-set.eclipse.local.tar.server,-set.eclipse.local.tar.non.server">\r
+               <unzip src="${eclipse.local.tar}" overwrite="true" dest="${eclipse.installation.dir}/.."/>              \r
+       </target>\r
+       \r
+       <target name="-unpack.eclipse.linux" unless="is.windows" depends="-set.eclipse.local.tar.server,-set.eclipse.local.tar.non.server">\r
+               <untar src="${eclipse.local.tar}" overwrite="true" dest="${eclipse.installation.dir}/.." compression="gzip"/>           \r
+       </target>\r
+       \r
+       <target name="test">\r
+               <property name="buildDirectory" value="C:/Temp/tst"/>\r
+               <mkdir dir="${buildDirectory}"/>\r
+               <property name="eclipse.download.cache" value="C:/Temp/downloadcache"/>\r
+               <property name="pluginbuilder.is.server" value="true"/>\r
+               <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
+               \r
+               <property name="eclipse.installation.dir" value="C:/Temp/eclipse_root/eclipse"/>\r
+               <delete dir="${eclipse.installation.dir}" failonerror="false"/>\r
+               <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
+               <antcall target="unpack.eclipse"/>\r
+       </target>\r
+       \r
+</project>
\ No newline at end of file