harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r937895 - /harmony/enhanced/java/branches/mrh/classlib/make/depends-common.xml
Date Sun, 25 Apr 2010 21:46:12 GMT
Author: hindessm
Date: Sun Apr 25 21:46:12 2010
New Revision: 937895

URL: http://svn.apache.org/viewvc?rev=937895&view=rev
Log:
Fixing fetch-depends target

Modified:
    harmony/enhanced/java/branches/mrh/classlib/make/depends-common.xml

Modified: harmony/enhanced/java/branches/mrh/classlib/make/depends-common.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/mrh/classlib/make/depends-common.xml?rev=937895&r1=937894&r2=937895&view=diff
==============================================================================
--- harmony/enhanced/java/branches/mrh/classlib/make/depends-common.xml (original)
+++ harmony/enhanced/java/branches/mrh/classlib/make/depends-common.xml Sun Apr 25 21:46:12
2010
@@ -185,4 +185,72 @@ But @{src} doesn't exist.
         <symlink resource="${src}" link="${basedir}/${dest}" />
     </target>
 
+    <macrodef name="fetch">
+        <attribute name="dep" />
+        <sequential>
+            <dirname file="${@{dep}}" property="@{dep}.dir"/>
+            <mkdir dir="${@{dep}.dir}"/>
+            <download-one-file dest="${@{dep}}" 
+                src="${@{dep}.url}" md5="${@{dep}.md5}"/>
+            <unzip-one-file dep="@{dep}"/>
+        </sequential>
+    </macrodef>
+
+    <target name="-really-unzip" unless="unzipped" if="unzip.path">
+        <tempfile destdir="${dest}" property="tmp"/>
+        <unzip src="${src}" dest="${tmp}" >
+            <patternset includes="${unzip.path}"/>
+        </unzip>
+        <touch>
+            <fileset dir="${tmp}">
+                <patternset includes="${unzip.path}"/>
+            </fileset>
+        </touch>
+        <move todir="${dest}" flatten="yes" failonerror="no">
+            <fileset dir="${tmp}">
+                <patternset includes="${unzip.path}"/>
+            </fileset>
+        </move>
+        <delete dir="${tmp}" />
+    </target>
+
+    <macrodef name="unzip-one-file">
+        <attribute name="dep" />
+        <sequential>
+            <dirname file="${@{dep}}" property="@{dep}.dir"/>
+            <!-- quite tricky way to detect if unzip operation is pending,
+                still not very robust ...
+                Life could be simpler if unzip supported nested mappers
+            -->
+            <basename file="${@{dep}}" property="@{dep}.basename"/>
+            <basename file="${@{dep}.unzip.path}" property="@{dep}.unzip.basename"/>
+            <pathconvert property="@{dep}.matching.list" setonempty="no">
+                <path><fileset dir="${@{dep}.dir}" includes="${@{dep}.unzip.basename}"/></path>
+            </pathconvert>
+            <pathconvert property="@{dep}.uptodate.list" setonempty="no">
+                <path>
+                    <fileset dir="${@{dep}.dir}" includes="${@{dep}.unzip.basename}">
+                        <depend targetdir="${@{dep}.dir}">
+                            <mapper type="merge" to="${@{dep}.basename}"/>
+                        </depend>
+                    </fileset>
+                </path>
+            </pathconvert>
+            <condition property="@{dep}.unzipped">
+                <equals arg1="${@{dep}.uptodate.list}" arg2="${@{dep}.matching.list}"/>
+                <!--uptodate srcfile="${@{dep}}"
+                        targetfile="${@{dep}.dir}/${@{dep}.unzip.basename}"/-->
+            </condition>
+
+            <antcall target="-really-unzip">
+                <param name="src" value="${@{dep}}" />
+                <param name="dest" value="${@{dep}.dir}" />
+                <propertyset>
+                  <propertyref prefix="@{dep}.unzip"/>
+                  <globmapper from="@{dep}.*" to="*"/>
+                </propertyset>
+            </antcall>
+        </sequential>
+    </macrodef>
+
 </project>



Mime
View raw message