Download GCL only if GOOG_HOME is not set

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

Branch: refs/heads/develop
Commit: 6a17d2c1a6f39d5a6a2ed7e067f5b9b0f9f8723f
Parents: 75e4c27
Author: OmPrakash Muppirala <[email protected]>
Authored: Tue Aug 4 18:06:07 2015 -0700
Committer: OmPrakash Muppirala <[email protected]>
Committed: Tue Aug 4 19:04:21 2015 -0700

----------------------------------------------------------------------
 build.xml                | 21 +++++++++++++++++----
 frameworks/downloads.xml | 10 +++++++++-
 2 files changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6a17d2c1/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index ee3d5af..11a9164 100644
--- a/build.xml
+++ b/build.xml
@@ -747,16 +747,29 @@
          -->
        
        <!-- Google Closure Library -->
-       <copy todir="${basedir}/temp/js/lib/google/closure-library">
-                   <fileset dir="${basedir}/js/lib/google/closure-library" />
-               </copy>
-       
+       <!-- If GOOG_HOME is set, copy GCL from there, else copy from the 
downloaded folder -->
+       <antcall target="copy-gcl-from-goog-home" if="${GOOG_HOME}" />
+       <antcall target="copy-gcl-from-downloaded" unless="${GOOG_HOME}" />
                  
         <antcall target="binary-package-zip"/>        
         <antcall target="binary-package-tgz"/>
         <copy todir="${basedir}/out" 
file="${basedir}/apache-flex-flexjs-installer-config.xml" />
     </target>
 
+       <target name="copy-gcl-from-goog-home">
+               <echo message="Copying GCL from ${GOOG_HOME}"></echo>
+               <copy todir="${basedir}/temp/js/lib/google/closure-library">
+                       <fileset dir="${GOOG_HOME}" />
+               </copy>
+       </target>
+       
+       <target name="copy-gcl-from-downloaded">
+               <echo message="Copying GCL from 
${basedir}/temp/js/lib/google/closure-library"></echo>
+               <copy todir="${basedir}/temp/js/lib/google/closure-library">
+                       <fileset 
dir="${GOOG_HOME}/js/lib/google/closure-library" />
+               </copy>
+       </target>
+       
     <!-- 
         Packages the binary distribution with ZIP. 
     -->

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6a17d2c1/frameworks/downloads.xml
----------------------------------------------------------------------
diff --git a/frameworks/downloads.xml b/frameworks/downloads.xml
index 10551e8..e6461e7 100644
--- a/frameworks/downloads.xml
+++ b/frameworks/downloads.xml
@@ -118,7 +118,7 @@
     </target>
        
        <!-- Google Closure Library -->
-    <target name="gcl-download" description="Downloads Google Closure Library">
+    <target name="gcl-download" depends="check-goog-home" unless="GOOG_HOME" 
description="Downloads Google Closure Library">
        <mkdir dir="${download.dir}"/>
        <get src="https://github.com/google/closure-library/archive/master.zip";
                dest="${download.dir}/google-closure-library-master.zip"
@@ -134,5 +134,13 @@
        <echo message="Deleting Google Closure Library"/>
         <delete dir="${FLEXJS_HOME}/js/lib" failonerror="false" />
     </target>
+       
+    <target name="check-goog-home" description="Check that GOOG_HOME is a 
directory">
+        <echo message="GOOG_HOME is ${env.GOOG_HOME}"/>
+        <available file="${env.GOOG_HOME}" 
+            type="dir" 
+            property="GOOG_HOME"
+            value="${env.GOOG_HOME}" />
+    </target>
         
 </project>

Reply via email to