only copy resource folder if it exists

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

Branch: refs/heads/develop
Commit: 2143ae28ec3bbf4a9f8d43c87c954f2fa9b04e66
Parents: 7ff7894
Author: Alex Harui <[email protected]>
Authored: Sun Dec 11 23:33:47 2016 -0800
Committer: Alex Harui <[email protected]>
Committed: Sun Dec 11 23:36:30 2016 -0800

----------------------------------------------------------------------
 examples/build_example.xml | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2143ae28/examples/build_example.xml
----------------------------------------------------------------------
diff --git a/examples/build_example.xml b/examples/build_example.xml
index 820209d..79a7e64 100644
--- a/examples/build_example.xml
+++ b/examples/build_example.xml
@@ -134,13 +134,7 @@
             versionrevision="0" 
             output="${basedir}/bin-debug"/> 
  
-        <copy todir="${basedir}/bin-debug">
-            <fileset dir="${basedir}/src/main/resources">
-                <include name="**/*.png" />
-                <include name="**/*.jpg" />
-                <include name="**/*.json" />
-            </fileset>
-        </copy>
+        <antcall target="build_example.copy-resources" />
         <copy todir="${basedir}/bin-debug/fonts">
             <fileset dir="${FLEX_HOME}/frameworks/fonts">
                 <include name="**/*.swf" />
@@ -177,12 +171,7 @@
             <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
         </mxmlc>
         
-        <copy todir="${basedir}/bin-debug">
-            <fileset dir="${basedir}/src/main/resources">
-                <include name="**/*.png" />
-                <include name="**/*.jpg" />
-            </fileset>
-        </copy>
+        <antcall target="build_example.copy-resources" />
         <copy todir="${basedir}/bin-debug">
             <fileset dir="${basedir}">
                 <include name="*-app.xml" />
@@ -457,4 +446,19 @@
         </sequential>
     </macrodef>
     
+    <target name="check-resources" >
+        <available file="${basedir}/src/main/resources"
+        type="dir"
+        property="has-resources"/>
+    </target>
+    
+    <target name="copy-resources" depends="check-resources" if="has-resources">
+        <copy todir="${basedir}/bin-debug">
+            <fileset dir="${basedir}/src/main/resources">
+                <include name="**/*.png" />
+                <include name="**/*.jpg" />
+                <include name="**/*.json" />
+            </fileset>
+        </copy>
+    </target>
 </project>

Reply via email to