Repository: flex-asjs
Updated Branches:
  refs/heads/develop 78d3ff9e5 -> 02febf26d


Checks to see if a platform needs to be loaded and if so, uses Cordova to load 
it.


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

Branch: refs/heads/develop
Commit: 02febf26d1c9234f52c9594a890437f7e87aa1e1
Parents: 78d3ff9
Author: Peter Ent <p...@apache.org>
Authored: Thu Oct 20 17:43:39 2016 -0400
Committer: Peter Ent <p...@apache.org>
Committed: Thu Oct 20 17:43:39 2016 -0400

----------------------------------------------------------------------
 cordova-build.xml | 62 ++++++++++++++++++++++++++++++++++----------------
 1 file changed, 43 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02febf26/cordova-build.xml
----------------------------------------------------------------------
diff --git a/cordova-build.xml b/cordova-build.xml
index 58af158..5217dbc 100644
--- a/cordova-build.xml
+++ b/cordova-build.xml
@@ -106,22 +106,6 @@
                        <arg value="org.apache.flex.examples.${appname}" />
                        <arg value="${appname}" />
                </exec>
-               
-               <echo>Adding in platform(s). This may take awhile.</echo>
-
-               <!-- add in the platforms -->
-               <exec executable="${cordova.executable}" 
dir="${cordova.target.dir}">
-            <env key="PATH" path="${env.PATH}:${cordova.path}"/>
-                       <arg value="platform" />
-                       <arg value="add" />
-                       <arg value="${platform.android}" />
-               </exec>
-               <exec executable="${cordova.executable}" 
dir="${cordova.target.dir}">
-            <env key="PATH" path="${env.PATH}:${cordova.path}"/>
-                       <arg value="platform" />
-                       <arg value="add" />
-                       <arg value="${platform.ios}" />
-               </exec>
     </target>
     
     <!-- Clean www directory -->
@@ -142,7 +126,43 @@
     </target>
     
     <!--
-       Running the app on the platform
+       Check to see if the Android platform needs to be loaded.
+    -->
+    
+    <target name="check-platform.android">
+       <property name="android.platform" 
value="${projectdir}/app/${appname}/platforms/android" />
+       <available file="${android.platform}" type="dir" 
property="platform.loaded" />
+    </target>
+    
+    <target name="load-platform.android" depends="check-platform.android" 
unless="platform.loaded">
+       <exec executable="${cordova.executable}" dir="${cordova.target.dir}">
+            <env key="PATH" path="${env.PATH}:${cordova.path}"/>
+                       <arg value="platform" />
+                       <arg value="add" />
+                       <arg value="${platform.android}" />
+               </exec>
+    </target>
+    
+    <!--
+       Check to see if the iOS platform needs to be loaded.
+    -->
+    
+    <target name="check-platform.ios">
+       <property name="android.ios" 
value="${projectdir}/app/${appname}/platforms/ios" />
+       <available file="${ios.platform}" type="dir" property="platform.loaded" 
/>
+    </target>
+    
+    <target name="load-platform.ios" depends="check-platform.ios" 
unless="platform.loaded">
+       <exec executable="${cordova.executable}" dir="${cordova.target.dir}">
+            <env key="PATH" path="${env.PATH}:${cordova.path}"/>
+                       <arg value="platform" />
+                       <arg value="add" />
+                       <arg value="${platform.ios}" />
+               </exec>
+    </target>
+    
+    <!-- 
+       Check to see if the Cordova File Plugin is needed and if so, load it.
     -->
     
     <target name="check-fileplugin">
@@ -160,7 +180,11 @@
        </exec>
        </target>
     
-    <target name="run.android" depends="find.cordova.mac,load-fileplugin" 
description="Runs the Cordova application on the specified platform">
+    <!--
+       Running the app on the platform
+    -->
+    
+    <target name="run.android" 
depends="find.cordova.mac,load-platform.android,load-fileplugin" 
description="Runs the Cordova application on the specified platform">
        <echo message="Launching ${appname} on platform ${platform.android}" />
        <exec executable="${cordova.executable}" dir="${cordova.target.dir}">
             <env key="PATH" path="${env.PATH}:${cordova.path}"/>
@@ -169,7 +193,7 @@
        </exec>
     </target>
     
-    <target name="run.ios" depends="find.cordova.mac,load-fileplugin" 
description="Runs the Cordova application on the specified platform">
+    <target name="run.ios" 
depends="find.cordova.mac,load-platform.ios,load-fileplugin" description="Runs 
the Cordova application on the specified platform">
        <echo message="Launching ${appname} on platform ${platform.ios}" />
        <exec executable="${cordova.executable}" dir="${cordova.target.dir}">
             <env key="PATH" path="${env.PATH}:${cordova.path}"/>

Reply via email to