<?xml version="1.0"?>
<!--

  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

-->


<project name="cordovacameraexample" default="main" basedir=".">
   <property name="ROYALE_HOME" location="../../.."/>
    <property name="example" value="CordovaCameraExample" />
    
    <property name="swf.version" value="17" />
    <property name="playerglobal.version" value="11.4" />
    
    <property environment="env"/>
    <property file="${ROYALE_HOME}/local.properties"/>
    <property file="${ROYALE_HOME}/build.properties"/>
    <property name="ROYALE_HOME" value="${ROYALE_HOME}"/>
    <property name="AIR_HOME" value="${env.AIR_HOME}"/>
    <property name="config_arg" value="air" />
    
    <include file="${basedir}/../../build_example.xml" />

    <target name="main" depends="clean,build_example.compile,build_example.compile.cordova" description="Clean build of ${example}">
        <antcall target="cordova-plugins" />
    </target>
    
    <target name="cordova-plugins" if="has.cordova" >
        <ant antfile="${ROYALE_HOME}/cordova-build.xml" target="load-plugin" >
            <property name="plugin" value="cordova-plugin-camera"/>
        </ant>
    </target>

    <target name="cordova" description="Executes the Cordova build script to create Cordova app">
    	<ant antfile="../../../cordova-build.xml" />
    </target>
    
    <target name="run-android" description="Executes the Cordova build script to run the app on a device.">
    	<ant antfile="../../../cordova-build.xml" target="run.android" />
    </target>
    
    <target name="all" depends="main, cordova" description="Builds the app then runs the Cordova script">
    </target>
    
    <target name="run">
        <property name="which" value="debug" />
        <antcall target="build_example.run.air.desktop" />
    </target>
    
    <target name="clean">
        <delete dir="${basedir}/bin" failonerror="false" />
        <delete dir="${basedir}/bin-debug" failonerror="false" />
        <delete dir="${basedir}/bin-release" failonerror="false" />
        <delete dir="${basedir}/app" failonerror="false" />
        <delete dir="${basedir}/target" failonerror="false" />
    </target>
    
    <target name="examine" depends="build_example.get.browser">
        <property name="which" value="debug" />
        <echo message="Take a picture with the camera."/>
        <antcall target="build_example.run.air" />
        <antcall target="build_example.run.cordova" />
    </target>

</project>
