Repository: flex-falcon
Updated Branches:
  refs/heads/develop e7234729f -> cccaa5a16


allow CI builds to use a download cache if downloads fail


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/cccaa5a1
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/cccaa5a1
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/cccaa5a1

Branch: refs/heads/develop
Commit: cccaa5a16d892174cdfa41d36ad5b82b4d98559e
Parents: e723472
Author: Alex Harui <[email protected]>
Authored: Tue Oct 25 12:51:09 2016 -0700
Committer: Alex Harui <[email protected]>
Committed: Tue Oct 25 12:51:09 2016 -0700

----------------------------------------------------------------------
 compiler-jburg-types/build.xml               | 10 ++-
 compiler-jx/src/main/resources/downloads.xml | 90 ++++++++++++++++------
 compiler-jx/src/test/downloads.xml           | 43 ++++++++++-
 compiler-test-utils/build.xml                |  8 +-
 compiler/src/main/resources/downloads.xml    | 94 ++++++++++++++++++-----
 compiler/src/test/downloads.xml              | 57 ++++++++++++--
 debugger/build.xml                           | 36 ++++++++-
 flex-compiler-oem/build.xml                  | 37 ++++++++-
 8 files changed, 314 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cccaa5a1/compiler-jburg-types/build.xml
----------------------------------------------------------------------
diff --git a/compiler-jburg-types/build.xml b/compiler-jburg-types/build.xml
index 7b2568c..69cc3bd 100644
--- a/compiler-jburg-types/build.xml
+++ b/compiler-jburg-types/build.xml
@@ -74,7 +74,15 @@
                
     <target name="main" depends="IASNodeAdapter" />
     
-    <target name="compiler.downloads">
+    <target name="compiler.downloads.cache" if="usingDownloadCache">
+        <ant 
antfile="${compiler-jburg-types}/../compiler/src/main/resources/downloads.xml"
+            dir="${compiler-jburg-types}/../compiler/src/main/resources" 
inheritAll="false">
+            <property name="usingDownloadCache" value="${usingDownloadCache}" 
/>
+            <property name="downloadCacheFolder" 
value="${downloadCacheFolder}" />
+        </ant>
+    </target>
+    
+    <target name="compiler.downloads" depends="compiler.downloads.cache" 
unless="usingDownloadCache">
         <ant 
antfile="${compiler-jburg-types}/../compiler/src/main/resources/downloads.xml"
             dir="${compiler-jburg-types}/../compiler/src/main/resources" 
inheritAll="false"/>
     </target>

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cccaa5a1/compiler-jx/src/main/resources/downloads.xml
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/resources/downloads.xml 
b/compiler-jx/src/main/resources/downloads.xml
index 2bbb1a9..dc05561 100644
--- a/compiler-jx/src/main/resources/downloads.xml
+++ b/compiler-jx/src/main/resources/downloads.xml
@@ -182,7 +182,16 @@
     </antcall>
     <mkdir dir="${lib.dir}/${dest.folder}"/>
 
-    <get src="http://www.apache.org/licenses/LICENSE-2.0"; 
dest="${lib.dir}/${dest.folder}/${name}-LICENSE.txt"/>
+    <get src="http://www.apache.org/licenses/LICENSE-2.0"; 
dest="${lib.dir}/${dest.folder}/${name}-LICENSE.txt" ignoreerrors="true"/>
+    <antcall target="get-from-cache-if-needed" >
+        <param name="srcFile" value="LICENSE-2.0.html" />
+        <param name="destFile" value="${name}-LICENSE.txt" />
+        <param name="destDir" value="${lib.dir}/${dest.folder}" />
+    </antcall>
+    <antcall target="fail-if-not-found" >
+        <param name="destFile" value="${name}-LICENSE.txt" />
+        <param name="destDir" value="${lib.dir}/${dest.folder}" />
+    </antcall>
 
     <condition property="project.download.jar">
       <contains string="${src.filename}" substring=".jar" />
@@ -192,7 +201,8 @@
       <param name="server" value="${src.server}"/>
       <param name="folder" value="${src.folder}"/>
       <param name="srcFileName" value="${src.filename}"/>
-      <param name="destJarFileName" 
value="${lib.dir}/${dest.folder}/${dest.filename}"/>
+      <param name="destDir" value="${lib.dir}/${dest.folder}"/>
+      <param name="destFile" value="${dest.filename}"/>
       <param name="checksum" value="${src.checksum}"/>
     </antcall>
 
@@ -201,7 +211,8 @@
       <param name="folder" value="${src.folder}"/>
       <param name="srcFileName" value="${src.filename}"/>
       <param name="srcJarPath" value="${src.jarPath}"/>
-      <param name="destJarPath" value="${dest.jarPath}"/>
+      <param name="destDir" value="${lib.dir}/${dest.folder}"/>
+      <param name="destFile" value="${dest.filename}"/>
       <param name="checksum" value="${src.checksum}"/>
     </antcall>
   </target>
@@ -231,7 +242,6 @@
       <param name="srcFolder" value="${folder}"/>
       <param name="cacheFolder" value="${folder}"/>
       <param name="srcFile" value="${srcFileName}"/>
-      <param name="destJarFile" value="${destJarFileName}"/>
       <param name="md5" value="${checksum}"/>
     </antcall>
   </target>
@@ -242,7 +252,6 @@
       <param name="srcFolder" value="${folder}"/>
       <param name="srcFile" value="${srcFileName}"/>
       <param name="srcJarPath" value="${srcJarPath}"/>
-      <param name="destJarFile" value="${destJarPath}"/>
       <param name="md5" value="${checksum}"/>
     </antcall>
   </target>
@@ -268,7 +277,8 @@
           srcFile - a .gz file for untar with gzip, else unzip
           [md5]
           [srcJarPath] - both src and dest required for the copy
-          [destJarFile]
+          [destDir]
+          [destFile]
 
       Note: This is purposely coded without <if><else><then> so that a 
dependency on
       ant-contrib.jar isn't required.        
@@ -276,11 +286,13 @@
   <target name="download-zip" depends="check-cache" description="Downloads 
tar/zip, and optionally verifies checksum and copies extracted jar.">
     <mkdir dir="${download.dir}"/>
     <antcall target="get-if-not-cached">
-      <param name="dest" value="${download.dir}/${srcFile}"/>
+      <param name="destDir" value="${download.dir}"/>
+      <param name="destFile" value="${srcFile}"/>
       <param name="message" value="Checksum mismatch for 
${download.dir}/${srcFile}"/>
     </antcall>
     <antcall target="copy-if-cached">
-      <param name="dest" value="${download.dir}/${srcFile}"/>
+        <param name="destDir" value="${download.dir}"/>
+        <param name="destFile" value="${srcFile}"/>
     </antcall>
     <condition property="zip.compressed">
       <matches string="${srcFile}" pattern="^*.zip$"/>
@@ -290,7 +302,8 @@
     <condition property="destination.known">
       <and>
         <isset property="srcJarPath"/>
-        <isset property="destJarFile"/>
+        <isset property="destDir"/>
+        <isset property="destFile"/>
       </and>
     </condition>
     <antcall target="copy-downloaded-jar"/>
@@ -299,17 +312,20 @@
   <target name="download-bz2" depends="check-cache" description="Downloads 
bz2, and optionally verifies checksum and copies extracted jar.">
     <mkdir dir="${download.dir}"/>
     <antcall target="get-if-not-cached">
-      <param name="dest" value="${download.dir}/${srcFile}"/>
+        <param name="destDir" value="${download.dir}"/>
+        <param name="destFile" value="${srcFile}"/>
       <param name="message" value="Checksum mismatch for 
${download.dir}/${srcFile}"/>
     </antcall>
     <antcall target="copy-if-cached">
-      <param name="dest" value="${download.dir}/${srcFile}"/>
+        <param name="destDir" value="${download.dir}"/>
+        <param name="destFile" value="${srcFile}"/>
     </antcall>
     <untar src="${download.dir}/${srcFile}" dest="${download.dir}/temp" 
compression="bzip2"/>
     <condition property="destination.known">
       <and>
         <isset property="srcJarPath"/>
-        <isset property="destJarFile"/>
+        <isset property="destDir"/>
+        <isset property="destFile"/>
       </and>
     </condition>
     <antcall target="copy-downloaded-jar"/>
@@ -323,17 +339,15 @@
           srcDomain
           srcFolder
           srcFile
-          destJarFile
+          destDir
+          destFile
           [md5]
   -->
   <target name="download-jar" depends="check-cache" description="Downloads 
jar, and optionally verifies checksum.">
     <antcall target="get-if-not-cached">
-      <param name="dest" value="${destJarFile}"/>
-      <param name="message" value="Checksum mismatch for ${destJarFile}"/>
-    </antcall>
-    <antcall target="copy-if-cached">
-      <param name="dest" value="${destJarFile}"/>
+      <param name="message" value="Checksum mismatch for 
${destDir}/${destFile}"/>
     </antcall>
+    <antcall target="copy-if-cached"/>
   </target>
 
   <target name="untar-file" unless="zip.compressed" description="Untars 
zipFile">
@@ -345,10 +359,12 @@
   </target>
 
   <target name="get-if-not-cached" unless="found-in-cache">
-    <get src="${srcDomain}/${srcFolder}/${srcFile}" dest="${dest}"/>
+    <get src="${srcDomain}/${srcFolder}/${srcFile}" 
dest="${destDir}/${destFile}" ignoreerrors="true"/>
+    <!-- this is a different cache for the CI servers.  It tries the network 
first, then the cache if failure -->
+    <antcall target="get-from-cache-if-needed" />
+    <antcall target="fail-if-not-found" />
     <antcall target="check-sum">
-      <param name="dest" value="${dest}"/>
-      <param name="message" value="Checksum mismatch for ${dest}"/>
+      <param name="message" value="Checksum mismatch for 
${destDir}/${destFile}"/>
     </antcall>
     <antcall target="put-in-cache"/>
   </target>
@@ -357,7 +373,7 @@
     <!-- this string comes from the FlexJS en_US.properties because for now, 
this
          target won't get called unless this script is called from the FlexJS 
install -->
     <echo>${INFO_USING_CACHED_FILE} 
${downloadCacheFolder}/${srcFolder}/${srcFile}</echo>
-    <copy file="${downloadCacheFolder}/${srcFolder}/${srcFile}" 
tofile="${dest}" overwrite="true"/>
+    <copy file="${downloadCacheFolder}/${srcFolder}/${srcFile}" 
tofile="${destDir}/${destFile}" overwrite="true"/>
   </target>
 
   <target name="check-cache" if="usingDownloadCache">
@@ -365,11 +381,11 @@
   </target>
 
   <target name="put-in-cache" if="usingDownloadCache">
-    <copy tofile="${downloadCacheFolder}/${srcFolder}/${srcFile}" 
file="${dest}"/>
+    <copy tofile="${downloadCacheFolder}/${srcFolder}/${srcFile}" 
file="${destDir}/${destFile}"/>
   </target>
 
   <target name="check-sum" if="md5" description="Verifies MD5 checksum, and 
fails if checksum doesn't match">
-    <checksum file="${dest}" algorithm="MD5" verifyproperty="we.failed" 
property="${md5}"/>
+    <checksum file="${destDir}/${destFile}" algorithm="MD5" 
verifyproperty="we.failed" property="${md5}"/>
     <fail message="${message}">
       <condition>
         <equals arg1="${we.failed}" arg2="false"/>
@@ -379,13 +395,37 @@
 
   <target name="copy-downloaded-jar" if="destination.known">
     <mkdir dir="${lib.dir}"/>
-    <copy file="${download.dir}/temp/${srcJarPath}" toFile="${destJarFile}" 
verbose="true"/>
+    <copy file="${download.dir}/temp/${srcJarPath}" 
toFile="${destDir}/${destFile}" verbose="true"/>
   </target>
 
   <target name="fail-with-message" if="we.failed" description="Conditionally 
fails with the specified message">
     <fail message="${message}"/>
   </target>
 
+    <target name="fail-if-not-found">
+        <fail message="${destDir}/${destFile} could not be downloaded or found 
in cache">
+            <condition>
+                <not>
+                    <available file="${destDir}/${destFile}" />
+                </not>
+            </condition>
+        </fail>
+    </target>
+
+    <target name="double-check-file" >
+        <condition property="still-no-file" value="true">
+            <and>
+                <not>
+                    <available file="${destDir}/${destFile}" />
+                </not>
+                <isset property="env.FLEX_DOWNLOAD_CACHE" />
+            </and>
+        </condition>
+        <echo>Need file: ${still_no_file}</echo>
+    </target>
+    <target name="get-from-cache-if-needed" depends="double-check-file" 
if="still-no-file">
+        <copy file="${env.FLEX_DOWNLOAD_CACHE}/${srcFile}" 
tofile="${destDir}/${destFile}" />
+    </target>
 
 
   <!--

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cccaa5a1/compiler-jx/src/test/downloads.xml
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/downloads.xml 
b/compiler-jx/src/test/downloads.xml
index c7e7f55..025e62e 100644
--- a/compiler-jx/src/test/downloads.xml
+++ b/compiler-jx/src/test/downloads.xml
@@ -77,10 +77,19 @@
     -->
     <target name="download-jar" 
             description="Downloads jar, and optionally verifies checksum.">    
                
-        <get src="${srcUrl}/${srcJarFile}" dest="${destJarFile}"/>
-        <checksum file="${destJarFile}" algorithm="MD5" 
property="${we.failed}"/>
+        <get src="${srcUrl}/${srcJarFile}" dest="${destDir}/${destJarFile}" 
ignoreerrors="true"/>
+        <antcall target="get-from-cache-if-needed" >
+            <param name="srcFile" value="${srcJarFile}" />
+            <param name="destFile" value="${destJarFile}" />
+            <param name="destDir" value="${lib.dir}" />
+        </antcall>
+        <antcall target="fail-if-not-found" >
+            <param name="destFile" value="${destJarFile}" />
+            <param name="destDir" value="${lib.dir}" />
+        </antcall>
+        <checksum file="${destDir}/${destJarFile}" algorithm="MD5" 
property="${we.failed}"/>
         <antcall target="fail-with-message">
-            <param name="message" value="Checksum mismatch for 
${destJarFile}"/>
+            <param name="message" value="Checksum mismatch for 
${destDir}/${destJarFile}"/>
         </antcall>
     </target>
 
@@ -112,8 +121,34 @@
         <antcall target="download-jar">
             <param name="srcUrl" 
value="http://search.maven.org/remotecontent?filepath=junit/junit/4.10"/>
             <param name="srcJarFile" value="junit-4.10.jar"/>
-            <param name="destJarFile" value="${lib.dir}/junit-4.10.jar"/>
+            <param name="destDir" value="${lib.dir}"/>
+            <param name="destJarFile" value="junit-4.10.jar"/>
         </antcall>
     </target>
     
+    <target name="fail-if-not-found">
+        <fail message="${destDir}/${destJarFile} could not be downloaded or 
found in cache">
+            <condition>
+                <not>
+                    <available file="${destDir}/${destJarFile}" />
+                </not>
+            </condition>
+        </fail>
+    </target>
+    
+    <target name="double-check-file" >
+        <condition property="still-no-file" value="true">
+            <and>
+                <not>
+                    <available file="${destDir}/${destJarFile}" />
+                </not>
+                <isset property="env.FLEX_DOWNLOAD_CACHE" />
+            </and>
+        </condition>
+        <echo>Need file: ${still_no_file}</echo>
+    </target>
+    <target name="get-from-cache-if-needed" depends="double-check-file" 
if="still-no-file">
+        <copy file="${env.FLEX_DOWNLOAD_CACHE}/${srcJarFile}" 
tofile="${destDir}/${destJarFile}" />
+    </target>
+
 </project>

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cccaa5a1/compiler-test-utils/build.xml
----------------------------------------------------------------------
diff --git a/compiler-test-utils/build.xml b/compiler-test-utils/build.xml
index 282e24f..d197183 100644
--- a/compiler-test-utils/build.xml
+++ b/compiler-test-utils/build.xml
@@ -58,7 +58,13 @@
         <isset property="env.BUILD_NUMBER"/>
     </condition>
     
-    <target name="compiler.test.downloads">
+    <target name="compiler.test.downloads.cache" if="usingDownloadCache">
+        <ant 
antfile="${compiler-test-utils}/../compiler/src/test/downloads.xml" 
dir="${compiler-test-utils}/../compiler/src/test" inheritAll="false">
+            <property name="usingDownloadCache" value="${usingDownloadCache}" 
/>
+            <property name="downloadCacheFolder" 
value="${downloadCacheFolder}" />
+        </ant>
+    </target>
+    <target name="compiler.test.downloads" 
depends="compiler.test.downloads.cache" unless="usingDownloadCache">
         <ant 
antfile="${compiler-test-utils}/../compiler/src/test/downloads.xml" 
dir="${compiler-test-utils}/../compiler/src/test" inheritAll="false"/>
     </target>
     

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cccaa5a1/compiler/src/main/resources/downloads.xml
----------------------------------------------------------------------
diff --git a/compiler/src/main/resources/downloads.xml 
b/compiler/src/main/resources/downloads.xml
index 2e00733..c547028 100644
--- a/compiler/src/main/resources/downloads.xml
+++ b/compiler/src/main/resources/downloads.xml
@@ -49,10 +49,14 @@
 
   <property name="maven.search.url" value="https://repo1.maven.org/maven2"/>
 
+  <property file="${FALCON_HOME}/env.properties"/>
+  <property environment="env"/>
+  <property file="${FALCON_HOME}/local.properties"/>
+  <property file="${FALCON_HOME}/build.properties"/>
 
 
-  <!-- 
-      Because the downloads requires a network connection and the JARs don't 
change very often, 
+  <!--
+      Because the downloads requires a network connection and the JARs don't 
change very often,
       they are each downloaded only if they don't already exist. 
   -->
   <target name="main" depends="prepare, all" description="Downloads all the 
required thirdparty JARs"/>
@@ -80,6 +84,7 @@
       <param name="dest.folder" value=""/>
       <param name="dest.filename" value="${antlr.name}.jar"/>
       <param name="license.use.url" value="http://www.antlr.org/license.html"/>
+      <param name="license.cacheName" value="antlr-LICENSE.html"/>
     </antcall>
 
     <!--  commons-cli -->
@@ -201,6 +206,7 @@
       <param name="dest.folder" value=""/>
       <param name="dest.filename" value="${lzma.name}-sdk.jar"/>
       <param name="license.use.url" value="http://www.7-zip.org/sdk.html"/>
+      <param name="license.cacheName" value="lzma-sdk-LICENSE.html"/>
     </antcall>
 
       <!--  flex-tool-api -->
@@ -281,7 +287,8 @@
       <param name="server" value="${src.server}"/>
       <param name="folder" value="${src.folder}"/>
       <param name="srcFileName" value="${src.filename}"/>
-      <param name="destJarFileName" 
value="${external.lib.dir}/${dest.folder}/${dest.filename}"/>
+      <param name="destDir" value="${external.lib.dir}/${dest.folder}"/>
+      <param name="destFile" value="${dest.filename}"/>
       <param name="checksum" value="${src.checksum}"/>
     </antcall>
 
@@ -290,17 +297,36 @@
       <param name="folder" value="${src.folder}"/>
       <param name="srcFileName" value="${src.filename}"/>
       <param name="srcJarPath" value="${src.jarPath}"/>
-      <param name="destJarPath" value="${dest.jarPath}"/>
+      <param name="destDir" value="${external.lib.dir}/${dest.folder}"/>
+      <param name="destFile" value="${dest.filename}"/>
       <param name="checksum" value="${src.checksum}"/>
     </antcall>
   </target>
 
   <target name="download-apache-license" if="license.use.apache" 
description="Downloads the Apache license to the lib directory.">
-    <get src="http://www.apache.org/licenses/LICENSE-2.0"; 
dest="${external.lib.dir}/${dest.folder}/${name}-LICENSE.html"/>
+    <get src="http://www.apache.org/licenses/LICENSE-2.0"; 
dest="${external.lib.dir}/${dest.folder}/${name}-LICENSE.html" 
ignoreerrors="true"/>
+    <antcall target="get-from-cache-if-needed" >
+        <param name="srcFile" value="LICENSE-2.0.html" />
+        <param name="destFile" value="${name}-LICENSE.html" />
+        <param name="destDir" value="${external.lib.dir}/${dest.folder}" />
+    </antcall>
+    <antcall target="fail-if-not-found" >
+        <param name="destFile" value="${name}-LICENSE.html" />
+        <param name="destDir" value="${external.lib.dir}/${dest.folder}" />
+    </antcall>
   </target>
   
   <target name="download-other-license" if="license.use.url" 
description="Downloads a non-Apache license to the lib directory.">
-    <get src="${license.use.url}" 
dest="${external.lib.dir}/${dest.folder}/${name}-LICENSE.html"/>
+    <get src="${license.use.url}" 
dest="${external.lib.dir}/${dest.folder}/${name}-LICENSE.html" 
ignoreerrors="true"/>
+    <antcall target="get-from-cache-if-needed" >
+        <param name="srcFile" value="${license.cacheName}" />
+        <param name="destFile" value="${name}-LICENSE.html" />
+        <param name="destDir" value="${external.lib.dir}/${dest.folder}" />
+    </antcall>
+    <antcall target="fail-if-not-found" >
+        <param name="destFile" value="${name}-LICENSE.html" />
+        <param name="destDir" value="${external.lib.dir}/${dest.folder}" />
+    </antcall>
   </target>
   
   <target name="download-dependency-jar" if="project.download.jar" 
description="Downloads a jar to the lib directory.">
@@ -309,7 +335,6 @@
       <param name="srcFolder" value="${folder}"/>
       <param name="cacheFolder" value="${folder}"/>
       <param name="srcFile" value="${srcFileName}"/>
-      <param name="destJarFile" value="${destJarFileName}"/>
       <param name="md5" value="${checksum}"/>
     </antcall>
   </target>
@@ -320,7 +345,6 @@
       <param name="srcFolder" value="${folder}"/>
       <param name="srcFile" value="${srcFileName}"/>
       <param name="srcJarPath" value="${srcJarPath}"/>
-      <param name="destJarFile" value="${destJarPath}"/>
       <param name="md5" value="${checksum}"/>
     </antcall>
   </target>
@@ -345,11 +369,13 @@
   <target name="download-zip" depends="check-cache" description="Downloads 
tar/zip, and optionally verifies checksum and copies extracted jar.">
     <mkdir dir="${download.dir}"/>
     <antcall target="get-if-not-cached">
-      <param name="dest" value="${download.dir}/${srcFile}"/>
+      <param name="destDir" value="${download.dir}"/>
+      <param name="destFile" value="${srcFile}"/>
       <param name="message" value="Checksum mismatch for 
${download.dir}/${srcFile}"/>
     </antcall>
     <antcall target="copy-if-cached">
-      <param name="dest" value="${download.dir}/${srcFile}"/>
+      <param name="destDir" value="${download.dir}"/>
+      <param name="destFile" value="${srcFile}"/>
     </antcall>
     <condition property="zip.compressed">
       <matches string="${srcFile}" pattern="^*.zip$"/>
@@ -359,7 +385,8 @@
     <condition property="destination.known">
       <and>
         <isset property="srcJarPath"/>
-        <isset property="destJarFile"/>
+        <isset property="destDir"/>
+        <isset property="destFile"/>
       </and>
     </condition>
     <antcall target="copy-downloaded-jar"/>
@@ -397,12 +424,9 @@
   -->
   <target name="download-jar" depends="check-cache" description="Downloads 
jar, and optionally verifies checksum.">
     <antcall target="get-if-not-cached">
-      <param name="dest" value="${destJarFile}"/>
       <param name="message" value="Checksum mismatch for ${destJarFile}"/>
     </antcall>
-    <antcall target="copy-if-cached">
-      <param name="dest" value="${destJarFile}"/>
-    </antcall>
+    <antcall target="copy-if-cached" />
   </target>
 
   <target name="untar-file" unless="zip.compressed" description="Untars 
zipFile">
@@ -414,10 +438,12 @@
   </target>
 
   <target name="get-if-not-cached" unless="found-in-cache">
-    <get src="${srcDomain}/${srcFolder}/${srcFile}" dest="${dest}"/>
+    <get src="${srcDomain}/${srcFolder}/${srcFile}" 
dest="${destDir}/${destFile}" ignoreerrors="true"/>
+    <!-- this is a different cache for the CI servers.  It tries the network 
first, then the cache if failure -->
+    <antcall target="get-from-cache-if-needed" />
+    <antcall target="fail-if-not-found" />
     <antcall target="check-sum">
-      <param name="dest" value="${dest}"/>
-      <param name="message" value="Checksum mismatch for ${dest}"/>
+      <param name="message" value="Checksum mismatch for 
${destDir}/${destFile}"/>
     </antcall>
     <antcall target="put-in-cache"/>
   </target>
@@ -430,15 +456,16 @@
   </target>
 
   <target name="check-cache" if="usingDownloadCache">
+      <echo>${downloadCacheFolder} ${srcFolder} ${srcFile}</echo>
     <available file="${downloadCacheFolder}/${srcFolder}/${srcFile}" 
property="found-in-cache"/>
   </target>
 
   <target name="put-in-cache" if="usingDownloadCache">
-    <copy tofile="${downloadCacheFolder}/${srcFolder}/${srcFile}" 
file="${dest}"/>
+    <copy tofile="${downloadCacheFolder}/${srcFolder}/${srcFile}" 
file="${destDir}/${destFile}"/>
   </target>
 
   <target name="check-sum" if="md5" description="Verifies MD5 checksum, and 
fails if checksum doesn't match">
-    <checksum file="${dest}" algorithm="MD5" verifyproperty="we.failed" 
property="${md5}"/>
+    <checksum file="${destDir}/${destFile}" algorithm="MD5" 
verifyproperty="we.failed" property="${md5}"/>
     <fail message="${message}">
       <condition>
         <equals arg1="${we.failed}" arg2="false"/>
@@ -448,13 +475,38 @@
 
   <target name="copy-downloaded-jar" if="destination.known">
     <mkdir dir="${external.lib.dir}"/>
-    <copy file="${download.dir}/temp/${srcJarPath}" toFile="${destJarFile}" 
verbose="true"/>
+    <copy file="${download.dir}/temp/${srcJarPath}" 
toFile="${destDir}/${destFile}" verbose="true"/>
   </target>
 
   <target name="fail-with-message" if="we.failed" description="Conditionally 
fails with the specified message">
     <fail message="${message}"/>
   </target>
 
+    <target name="fail-if-not-found">
+        <fail message="${destDir}/${destFile} could not be downloaded or found 
in cache">
+            <condition>
+                <not>
+                    <available file="${destDir}/${destFile}" />
+                </not>
+            </condition>
+        </fail>
+    </target>
+
+    <target name="double-check-file" >
+        <echo>${env.FLEX_DOWNLOAD_CACHE}</echo>
+        <condition property="still-no-file" value="true">
+            <and>
+                <not>
+                    <available file="${destDir}/${destFile}" />
+                </not>
+                <isset property="env.FLEX_DOWNLOAD_CACHE" />
+            </and>
+        </condition>
+        <echo>Need file: ${still_no_file}</echo>
+    </target>
+    <target name="get-from-cache-if-needed" depends="double-check-file" 
if="still-no-file">
+        <copy file="${env.FLEX_DOWNLOAD_CACHE}/${srcFile}" 
tofile="${destDir}/${destFile}" />
+    </target>
 
 
   <!--

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cccaa5a1/compiler/src/test/downloads.xml
----------------------------------------------------------------------
diff --git a/compiler/src/test/downloads.xml b/compiler/src/test/downloads.xml
index b112916..467685a 100644
--- a/compiler/src/test/downloads.xml
+++ b/compiler/src/test/downloads.xml
@@ -31,7 +31,12 @@
     
        <property name="download.dir" value="${compiler}/in"/>
     
-       <!-- 
+    <property file="${compiler}/../env.properties"/>
+    <property environment="env"/>
+    <property file="${compiler}/../local.properties"/>
+    <property file="${compiler}/../build.properties"/>
+
+    <!--
           Notes:
               For Apache, the JARS must be removed from the repository.
               
@@ -83,10 +88,19 @@
     -->
     <target name="download-jar" 
             description="Downloads jar, and optionally verifies checksum.">    
                
-        <get src="${srcUrl}/${srcJarFile}" dest="${destJarFile}"/>
-        <checksum file="${destJarFile}" algorithm="MD5" 
property="${we.failed}"/>
+        <get src="${srcUrl}/${srcJarFile}" dest="${destDir}/${destJarFile}" 
ignoreerrors="true"/>
+        <antcall target="get-from-cache-if-needed" >
+            <param name="srcFile" value="${srcJarFile}" />
+            <param name="destFile" value="${destJarFile}" />
+            <param name="destDir" value="${external.lib.dir}" />
+        </antcall>
+        <antcall target="fail-if-not-found" >
+            <param name="destFile" value="${destJarFile}" />
+            <param name="destDir" value="${external.lib.dir}" />
+        </antcall>
+        <checksum file="${destDir}/${destJarFile}" algorithm="MD5" 
property="${we.failed}"/>
         <antcall target="fail-with-message">
-            <param name="message" value="Checksum mismatch for 
${destJarFile}"/>
+            <param name="message" value="Checksum mismatch for 
${destDir}/${destJarFile}"/>
         </antcall>
     </target>
 
@@ -118,7 +132,8 @@
         <antcall target="download-jar">
             <param name="srcUrl" 
value="http://search.maven.org/remotecontent?filepath=junit/junit/4.10"/>
             <param name="srcJarFile" value="junit-4.10.jar"/>
-            <param name="destJarFile" 
value="${external.lib.dir}/junit-4.10.jar"/>
+            <param name="destDir" value="${external.lib.dir}"/>
+            <param name="destJarFile" value="junit-4.10.jar"/>
         </antcall>
     </target>
 
@@ -145,7 +160,8 @@
         <antcall target="download-jar">
             <param name="srcUrl" 
value="https://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.10"/>
             <param name="srcJarFile" value="commons-compress-1.10.jar"/>
-            <param name="destJarFile" 
value="${external.lib.dir}/commons-compress-1.10.jar"/>
+            <param name="destDir" value="${external.lib.dir}"/>
+            <param name="destJarFile" value="commons-compress-1.10.jar"/>
         </antcall>
     </target>
 
@@ -172,8 +188,35 @@
         <antcall target="download-jar">
             <param name="srcUrl" 
value="https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.4"/>
             <param name="srcJarFile" value="commons-lang3-3.4.jar"/>
-            <param name="destJarFile" 
value="${external.lib.dir}/commons-lang3-3.4.jar"/>
+            <param name="destDir" value="${external.lib.dir}"/>
+            <param name="destJarFile" value="commons-lang3-3.4.jar"/>
         </antcall>
     </target>
 
+    <target name="fail-if-not-found">
+        <fail message="${destDir}/${destJarFile} could not be downloaded or 
found in cache">
+            <condition>
+                <not>
+                    <available file="${destDir}/${destJarFile}" />
+                </not>
+            </condition>
+        </fail>
+    </target>
+
+    <target name="double-check-file" >
+        <condition property="still-no-file" value="true">
+            <and>
+                <not>
+                    <available file="${destDir}/${destJarFile}" />
+                </not>
+                <isset property="env.FLEX_DOWNLOAD_CACHE" />
+            </and>
+        </condition>
+        <echo>Need file: ${still_no_file}</echo>
+    </target>
+    <target name="get-from-cache-if-needed" depends="double-check-file" 
if="still-no-file">
+        <copy file="${env.FLEX_DOWNLOAD_CACHE}/${srcJarFile}" 
tofile="${destDir}/${destJarFile}" />
+    </target>
+
+
 </project>

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cccaa5a1/debugger/build.xml
----------------------------------------------------------------------
diff --git a/debugger/build.xml b/debugger/build.xml
index bef14b6..46fdcfe 100644
--- a/debugger/build.xml
+++ b/debugger/build.xml
@@ -38,7 +38,16 @@
     <target name="downloads" depends="download_check" 
unless="swfutils.bundled">
         <mkdir dir="${basedir}/target/downloads/java/flash" />
         <get 
src="https://git-wip-us.apache.org/repos/asf/flex-sdk/repo?p=flex-sdk.git;a=snapshot;h=2cfbdd592ef87b40704d3d7145f4da9a369429eb;sf=tgz";
-        dest="${basedir}/target/downloads/flex-sdk-modules-swfutils.tar.gz"/>
+        dest="${basedir}/target/downloads/flex-sdk-modules-swfutils.tar.gz" 
ignoreerrors="true"/>
+        <antcall target="get-from-cache-if-needed" >
+            <param name="srcFile" value="flex-sdk-modules-swfutils.tar.gz" />
+            <param name="destFile" value="flex-sdk-modules-swfutils.tar.gz" />
+            <param name="destDir" value="${basedir}/target/downloads" />
+        </antcall>
+        <antcall target="fail-if-not-found" >
+            <param name="destFile" value="flex-sdk-modules-swfutils.tar.gz" />
+            <param name="destDir" value="${basedir}/target/downloads" />
+        </antcall>
         <untar 
src="${basedir}/target/downloads/flex-sdk-modules-swfutils.tar.gz" 
dest="${basedir}/target/downloads/java/flash" compression="gzip">
             <patternset>
                 <include name="**/localization/**"/>
@@ -128,4 +137,29 @@
         </delete>
     </target>
 
+    <target name="fail-if-not-found">
+        <fail message="${destDir}/${destFile} could not be downloaded or found 
in cache">
+            <condition>
+                <not>
+                    <available file="${destDir}/${destFile}" />
+                </not>
+            </condition>
+        </fail>
+    </target>
+
+    <target name="double-check-file" >
+        <echo>${env.FLEX_DOWNLOAD_CACHE}</echo>
+        <condition property="still-no-file" value="true">
+            <and>
+                <not>
+                    <available file="${destDir}/${destFile}" />
+                </not>
+                <isset property="env.FLEX_DOWNLOAD_CACHE" />
+            </and>
+        </condition>
+        <echo>Need file: ${still_no_file}</echo>
+    </target>
+    <target name="get-from-cache-if-needed" depends="double-check-file" 
if="still-no-file">
+        <copy file="${env.FLEX_DOWNLOAD_CACHE}/${srcFile}" 
tofile="${destDir}/${destFile}" />
+    </target>
 </project>

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cccaa5a1/flex-compiler-oem/build.xml
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/build.xml b/flex-compiler-oem/build.xml
index ebf7445..f1f112c 100644
--- a/flex-compiler-oem/build.xml
+++ b/flex-compiler-oem/build.xml
@@ -81,7 +81,16 @@
     <target name="downloads" depends="download_check" 
unless="swfutils.bundled">
         <mkdir dir="${oem}/target/downloads/java/flash" />
         <get 
src="https://git-wip-us.apache.org/repos/asf/flex-sdk/repo?p=flex-sdk.git;a=snapshot;h=2cfbdd592ef87b40704d3d7145f4da9a369429eb;sf=tgz";
-            dest="${oem}/target/downloads/flex-sdk-modules-swfutils.tar.gz"/>
+            dest="${oem}/target/downloads/flex-sdk-modules-swfutils.tar.gz" 
ignoreerrors="true"/>
+        <antcall target="get-from-cache-if-needed" >
+            <param name="srcFile" value="flex-sdk-modules-swfutils.tar.gz" />
+            <param name="destFile" value="flex-sdk-modules-swfutils.tar.gz" />
+            <param name="destDir" value="${oem}/target/downloads" />
+        </antcall>
+        <antcall target="fail-if-not-found" >
+            <param name="destFile" value="flex-sdk-modules-swfutils.tar.gz" />
+            <param name="destDir" value="${oem}/target/downloads" />
+        </antcall>
         <untar src="${oem}/target/downloads/flex-sdk-modules-swfutils.tar.gz" 
dest="${oem}/target/downloads/java/flash" compression="gzip">
             <patternset>
                  <include name="**/localization/**"/>
@@ -242,4 +251,30 @@
         <delete dir="${oem}/target"/>
     </target>
 
+    <target name="fail-if-not-found">
+        <fail message="${destDir}/${destFile} could not be downloaded or found 
in cache">
+            <condition>
+                <not>
+                    <available file="${destDir}/${destFile}" />
+                </not>
+            </condition>
+        </fail>
+    </target>
+
+    <target name="double-check-file" >
+        <echo>${env.FLEX_DOWNLOAD_CACHE}</echo>
+        <condition property="still-no-file" value="true">
+            <and>
+                <not>
+                    <available file="${destDir}/${destFile}" />
+                </not>
+                <isset property="env.FLEX_DOWNLOAD_CACHE" />
+            </and>
+        </condition>
+        <echo>Need file: ${still_no_file}</echo>
+    </target>
+    <target name="get-from-cache-if-needed" depends="double-check-file" 
if="still-no-file">
+        <copy file="${env.FLEX_DOWNLOAD_CACHE}/${srcFile}" 
tofile="${destDir}/${destFile}" />
+    </target>
+
 </project>

Reply via email to