| <?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="createproject" default="main" basedir="."> |
| |
| <condition property="project.name.specified" value="true"> |
| <isset property="PROJECT_NAME" /> |
| </condition> |
| <fail message="PROJECT_NAME not specified. Should specify desired name of cordova project" unless="project.name.specified"/> |
| |
| <condition property="target.dir.specified" value="true"> |
| <isset property="TARGET_DIR" /> |
| </condition> |
| <fail message="TARGET_DIR not specified. Should specify folder to contain cordova project folder" unless="target.dir.specified"/> |
| |
| <condition property="project.dir.specified" value="true"> |
| <isset property="PROJECT_DIR" /> |
| </condition> |
| <fail message="PROJECT_DIR not specified. Should specify folder that contains the bin/js-debug output of a FlexJS project" unless="project.dir.specified"/> |
| |
| <property name="target.dir" value="${TARGET_DIR}" /> |
| <property name="project.name" value="${PROJECT_NAME}" /> |
| <property name="project.dir" value="${PROJECT_DIR}" /> |
| |
| <property name="app.dir" value="${target.dir}/${project.name}" /> |
| <available file="${app.dir}" type="dir" property="app.dir.exists"/> |
| |
| <available file="${target.dir}" type="dir" property="target.dir.exists"/> |
| <fail message="${target.dir} does not exist" unless="target.dir.exists"/> |
| <available file="${project.dir}/bin/js-debug" type="dir" property="project.dir.exists"/> |
| <fail message="${project.dir}/bin/js-debug does not exist" unless="project.dir.exists"/> |
| |
| <target name="create" unless="app.dir.exists"> |
| <!-- create the project --> |
| <exec executable="cordova" dir="${target.dir}"> |
| <arg value="create" /> |
| <arg value="${project.name}" /> |
| <arg value="org.apache.flex.mobile" /> |
| <arg value="${project.name}" /> |
| </exec> |
| |
| <!-- add in the platforms --> |
| <exec executable="cordova" dir="${app.dir}"> |
| <arg value="platform" /> |
| <arg value="add" /> |
| <arg value="android" /> |
| </exec> |
| </target> |
| |
| <target name="copyfiles" depends="create"> |
| <echo message="Removing www directory contents" /> |
| <delete includeEmptyDirs="true"> |
| <fileset dir="${app.dir}/www" includes="**/*" /> |
| </delete> |
| <echo message="Copying files from project" /> |
| <copy todir="${app.dir}/www"> |
| <fileset dir="${project.dir}/bin/js-debug" /> |
| </copy> |
| </target> |
| |
| <target name="build" depends="copyfiles"> |
| <!-- build the app --> |
| <exec executable="cordova" dir="${app.dir}"> |
| <arg value="build" /> |
| </exec> |
| </target> |
| |
| <target name="main" depends="build"> |
| <echo message="App = ${app.dir} and basedir = ${basedir}" /> |
| </target> |
| |
| <target name="help"> |
| <echo message="ant -f cordova-build.xml -DPROJECT_NAME=name -DPROJECT_DIR=FlexJSProjectDirectory -DTARGET_DIR=PhoneGapProjectDirectory" /> |
| <echo message="PhoneGap project is created inside of PhoneGapProjectDirectory with the PROJECT name and all files are copied" /> |
| <echo message="from FlexJSProjectDirectory/bin/js-debug into the PhoneGap project." /> |
| </target> |
| |
| </project> |
| |