You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2007/11/20 13:45:01 UTC

svn commit: r596646 - /harmony/enhanced/buildtest/branches/2.0/adaptors/snapshot/adaptor.xml

Author: smishura
Date: Tue Nov 20 04:45:00 2007
New Revision: 596646

URL: http://svn.apache.org/viewvc?rev=596646&view=rev
Log:
Make possible to fetch latest snapshots from file system

Note: 'usetimestamp' in get task works only for HTTP
so all added targets are required to avoid snapshot downloading
in case of others protocols on each CC cycle
(that in turn trigges all dependent suites)

Modified:
    harmony/enhanced/buildtest/branches/2.0/adaptors/snapshot/adaptor.xml

Modified: harmony/enhanced/buildtest/branches/2.0/adaptors/snapshot/adaptor.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/adaptors/snapshot/adaptor.xml?rev=596646&r1=596645&r2=596646&view=diff
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/adaptors/snapshot/adaptor.xml (original)
+++ harmony/enhanced/buildtest/branches/2.0/adaptors/snapshot/adaptor.xml Tue Nov 20 04:45:00 2007
@@ -94,7 +94,18 @@
         <mkdir dir="${snapshot.results.dir}" />
     </target>
 
-    <target name="download.snapshot" depends="-setup-proxy">
+    <!--                                                   -->
+    <!--            Snapshot Downloading                   -->
+    <!-- 'usetimestamp' in get task works only for HTTP    -->
+    <!-- so all targets below are required to avoid        -->
+    <!-- snapshot downloading in case of others protocols  -->
+    <!-- on each CC cycle that in turn trigges all         -->
+    <!-- dependent suites                                  -->
+    <target name="download.snapshot" depends="-download.http,-download.file" />
+
+    <target name="-download.http"
+            if="http.url"
+            depends="-define-protocol,-setup-proxy">
 
         <mkdir dir="${snapshot}" />
         <get src="${downloads.url}/${snapshot.file}"
@@ -103,13 +114,60 @@
              verbose="true" />
     </target>
 
+    <target name="-setup-proxy" if="http.proxyHost">
+        <setproxy proxyhost="${http.proxyHost}" proxyport="${http.proxyPort}" />
+    </target>
+
+    <target name="-download.file"
+            if="is.file.uptodate"
+            depends="-define-protocol">
+
+        <mkdir dir="${snapshot}" />
+        <copy file="${file.url}/${snapshot.file}"
+              tofile="${snapshot}/${snapshot.file}" />
+    </target>
+
+    <target name="-define-protocol">
+
+        <!-- extract protocol from url by setting <schema>.url' property -->
+        <tempfile property="temp.file" />
+        <echo file="${temp.file}" message="${downloads.url}" />
+        <replaceregexp file="${temp.file}" match="://" replace=".url=" />
+        <loadproperties srcFile="${temp.file}" />
+        <delete file="${temp.file}" />
+
+        <fail message="Unsupported URL protocol: ${downloads.url}">
+            <condition>
+                <not>
+                    <or>
+                        <isset property="http.url" />
+                        <isset property="file.url" />
+                    </or>
+                </not>
+            </condition>
+        </fail>
+
+        <!-- check file's timestamp -->
+        <condition property="is.file.uptodate">
+            <and>
+                <isset property="file.url" />
+                <or>
+                    <not>
+                        <available file="${snapshot}/${snapshot.file}" />
+                    </not>
+                    <uptodate srcfile="${snapshot}/${snapshot.file}"
+                              targetfile="${file.url}" />
+                </or>
+            </and>
+        </condition>
+    </target>
+
+    <!--                                   -->
+    <!--                                   -->
+    <!--                                   -->
     <target name="-unzip" if="is.zip">
         <delete dir="${snapshot}/hdk" />
         <unzip src="${snapshot}/${snapshot.file}" dest="${snapshot}" />
-    </target>
-
-    <target name="-setup-proxy" if="http.proxyHost">
-        <setproxy proxyhost="${http.proxyHost}" proxyport="${http.proxyPort}" />
     </target>
 
     <target name="-gunzip" unless="is.zip">