2009-05-26 07:13:43 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
2012-06-05 21:49:50 +08:00
|
|
|
<!--
|
2012-02-24 00:36:08 +08:00
|
|
|
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.
|
|
|
|
-->
|
2012-02-02 09:45:49 +08:00
|
|
|
<project name="Cordova" default="jar">
|
2009-05-26 07:13:43 +08:00
|
|
|
|
2011-02-02 11:38:30 +08:00
|
|
|
<!-- LOAD VERSION -->
|
|
|
|
<loadfile property="version" srcFile="../VERSION">
|
|
|
|
<filterchain>
|
|
|
|
<striplinebreaks/>
|
|
|
|
</filterchain>
|
|
|
|
</loadfile>
|
|
|
|
|
2012-09-26 01:09:40 +08:00
|
|
|
<!-- check that the version of ant is at least 1.8.0, as is needed
|
|
|
|
for the dblQuote property -->
|
|
|
|
<antversion property="thisantversion" atleast="1.8.0" />
|
|
|
|
<fail message="The required minimum version of ant is 1.8.0, you have ${ant.version}"
|
|
|
|
unless="thisantversion" />
|
|
|
|
|
|
|
|
<!-- check that commons codec is available. You should copy the codec jar to
|
|
|
|
framework/libs, as it is not included in the Cordova distribution.
|
|
|
|
The name of the jar file in framework/libs does not matter. -->
|
|
|
|
<available classname="org.apache.commons.codec.binary.Base64"
|
|
|
|
property="exists.base64"
|
|
|
|
ignoresystemclasses="true">
|
|
|
|
<classpath>
|
|
|
|
<pathelement path="${classpath}" />
|
|
|
|
<fileset dir="libs">
|
|
|
|
<include name="*.jar" />
|
|
|
|
</fileset>
|
|
|
|
</classpath>
|
|
|
|
</available>
|
|
|
|
<fail message="You need to put a copy of Apache Commons Codec jar in the framework/libs directory"
|
|
|
|
unless="exists.base64" />
|
|
|
|
|
|
|
|
<!-- The local.properties file is created and updated by the 'android'
|
|
|
|
tool. (For example "sdkdir/tools/android update project -p ." inside
|
|
|
|
of this directory where the AndroidManifest.xml file exists. This
|
|
|
|
properties file that gets built contains the path to the SDK. It
|
|
|
|
should *NOT* be checked into Version Control Systems since it holds
|
|
|
|
data about the local machine. -->
|
|
|
|
<available file="local.properties" property="exists.local.properties" />
|
|
|
|
<fail message="You need to create the file 'local.properties' by running 'android update project -p .' here."
|
|
|
|
unless="exists.local.properties" />
|
2011-10-21 02:13:44 +08:00
|
|
|
<loadproperties srcFile="local.properties" />
|
2009-05-26 07:13:43 +08:00
|
|
|
|
2011-10-21 02:13:44 +08:00
|
|
|
<!-- The ant.properties file can be created by you. It is only edited by the
|
|
|
|
'android' tool to add properties to it.
|
|
|
|
This is the place to change some Ant specific build properties.
|
2009-05-26 07:13:43 +08:00
|
|
|
Here are some properties you may want to change/update:
|
|
|
|
|
2010-02-04 02:27:49 +08:00
|
|
|
source.dir
|
2011-10-21 02:13:44 +08:00
|
|
|
The name of the source directory. Default is 'src'.
|
2010-02-04 02:27:49 +08:00
|
|
|
out.dir
|
2011-10-21 02:13:44 +08:00
|
|
|
The name of the output directory. Default is 'bin'.
|
2009-05-26 07:13:43 +08:00
|
|
|
|
2011-10-21 02:13:44 +08:00
|
|
|
For other overridable properties, look at the beginning of the rules
|
|
|
|
files in the SDK, at tools/ant/build.xml
|
2009-05-26 07:13:43 +08:00
|
|
|
|
2011-10-21 02:13:44 +08:00
|
|
|
Properties related to the SDK location or the project target should
|
|
|
|
be updated using the 'android' tool with the 'update' action.
|
|
|
|
This file is an integral part of the build system for your
|
|
|
|
application and should be checked into Version Control Systems.
|
2009-05-26 07:13:43 +08:00
|
|
|
|
|
|
|
-->
|
2011-10-21 02:13:44 +08:00
|
|
|
<property file="ant.properties" />
|
2012-06-05 21:49:50 +08:00
|
|
|
|
2011-07-09 02:35:31 +08:00
|
|
|
<!-- We need to setup the double quote. -->
|
|
|
|
<property name="dblQuote">"</property>
|
2011-10-21 02:13:44 +08:00
|
|
|
|
|
|
|
<!-- The project.properties file is created and updated by the 'android'
|
|
|
|
tool, as well as ADT.
|
|
|
|
|
|
|
|
This contains project specific properties such as project target, and library
|
|
|
|
dependencies. Lower level build properties are stored in ant.properties
|
|
|
|
(or in .classpath for Eclipse projects).
|
|
|
|
|
|
|
|
This file is an integral part of the build system for your
|
|
|
|
application and should be checked into Version Control Systems. -->
|
|
|
|
<loadproperties srcFile="project.properties" />
|
|
|
|
|
2012-09-26 01:09:40 +08:00
|
|
|
<!-- quick check on sdk.dir -->
|
2011-10-21 02:13:44 +08:00
|
|
|
<fail
|
|
|
|
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
|
|
|
unless="sdk.dir"
|
|
|
|
/>
|
|
|
|
|
2012-09-26 01:09:40 +08:00
|
|
|
<!-- version-tag: custom -->
|
2011-10-21 04:26:30 +08:00
|
|
|
<!-- extension targets. Uncomment the ones where you want to do custom work
|
|
|
|
in between standard targets -->
|
|
|
|
<!--
|
|
|
|
<target name="-pre-build">
|
|
|
|
</target>
|
|
|
|
<target name="-pre-compile">
|
|
|
|
</target>
|
|
|
|
|
|
|
|
/* This is typically used for code obfuscation.
|
|
|
|
Compiled code location: ${out.classes.absolute.dir}
|
|
|
|
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
|
|
|
<target name="-post-compile">
|
|
|
|
</target>
|
|
|
|
-->
|
|
|
|
|
|
|
|
<!-- Import the actual build file.
|
|
|
|
|
|
|
|
To customize existing targets, there are two options:
|
|
|
|
- Customize only one target:
|
|
|
|
- copy/paste the target into this file, *before* the
|
|
|
|
<import> task.
|
|
|
|
- customize it to your needs.
|
|
|
|
- Customize the whole content of build.xml
|
|
|
|
- copy/paste the content of the rules files (minus the top node)
|
|
|
|
into this file, replacing the <import> task.
|
|
|
|
- customize to your needs.
|
|
|
|
|
|
|
|
***********************
|
|
|
|
****** IMPORTANT ******
|
|
|
|
***********************
|
|
|
|
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
|
|
|
in order to avoid having your file be overridden by tools such as "android update project"
|
2009-05-26 07:13:43 +08:00
|
|
|
-->
|
2012-09-26 01:09:40 +08:00
|
|
|
<import file="${sdk.dir}/tools/ant/build.xml" />
|
2011-10-21 02:13:44 +08:00
|
|
|
|
2012-02-02 09:45:49 +08:00
|
|
|
<!-- Combine JavaScript files into one cordova-uncompressed.js file. -->
|
2012-03-02 03:56:37 +08:00
|
|
|
<target name="build-javascript" depends="clean">
|
2012-06-05 21:49:50 +08:00
|
|
|
|
2010-12-01 09:00:30 +08:00
|
|
|
<!-- Clean up existing files -->
|
2012-02-02 09:45:49 +08:00
|
|
|
<!--<delete file="assets/www/cordova_${version}.js"/>-->
|
2012-06-05 21:49:50 +08:00
|
|
|
|
2010-12-01 09:00:30 +08:00
|
|
|
<!-- Create uncompressed JS file -->
|
2012-02-02 09:45:49 +08:00
|
|
|
<concat destfile="assets/www/cordova-${version}.js">
|
2012-02-18 07:30:25 +08:00
|
|
|
<filelist dir="assets/js" files="cordova.android.js"/>
|
2010-12-01 09:00:30 +08:00
|
|
|
</concat>
|
|
|
|
|
2012-02-02 09:45:49 +08:00
|
|
|
<!-- update project files to reference cordova-x.x.x.min.js -->
|
|
|
|
<replaceregexp match="cordova(.*)\.js" replace="cordova-${version}.js" byline="true">
|
2012-06-05 21:49:50 +08:00
|
|
|
<fileset file="assets/www/index.html" />
|
2012-06-09 08:43:29 +08:00
|
|
|
<fileset file="../bin/templates/project/assets/www/index.html" />
|
2011-02-02 11:38:30 +08:00
|
|
|
</replaceregexp>
|
2012-03-10 04:36:08 +08:00
|
|
|
|
2011-10-21 02:13:44 +08:00
|
|
|
<!-- This is sketchy, but it works, ${dblQuote} does not -->
|
2012-02-02 09:45:49 +08:00
|
|
|
<replaceregexp match="cordovaVersion = [\u0022].*[\u0022];" replace='cordovaVersion = ${dblQuote}${version}${dblQuote};' byline="true">
|
|
|
|
<fileset file="src/org/apache/cordova/Device.java" />
|
2011-07-09 02:35:31 +08:00
|
|
|
</replaceregexp>
|
2010-12-01 09:00:30 +08:00
|
|
|
</target>
|
2009-11-19 07:43:59 +08:00
|
|
|
|
2012-02-02 09:45:49 +08:00
|
|
|
<!-- Build Cordova jar file that includes all native code, and Cordova JS file
|
2010-12-01 09:00:30 +08:00
|
|
|
that includes all JavaScript code.
|
|
|
|
-->
|
2011-10-21 02:13:44 +08:00
|
|
|
<target name="jar" depends="build-javascript, -compile">
|
2012-02-02 09:45:49 +08:00
|
|
|
<jar jarfile="cordova-${version}.jar" basedir="bin/classes" excludes="org/apache/cordova/R.class,org/apache/cordova/R$*.class"/>
|
2009-11-25 09:20:34 +08:00
|
|
|
</target>
|
2009-11-19 07:43:59 +08:00
|
|
|
|
2011-12-31 08:35:50 +08:00
|
|
|
<!-- tests for Java files -->
|
2012-02-02 09:45:49 +08:00
|
|
|
<property name="test.dir" location="test/org/apache/cordova" />
|
2011-12-31 08:35:50 +08:00
|
|
|
|
|
|
|
<path id="test.classpath">
|
2012-02-02 09:45:49 +08:00
|
|
|
<!-- requires both junit and cordova -->
|
2011-12-31 08:35:50 +08:00
|
|
|
<pathelement location="libs/junit-4.10.jar" />
|
2012-02-02 09:45:49 +08:00
|
|
|
<pathelement location="cordova-${version}.jar" />
|
2011-12-31 08:35:50 +08:00
|
|
|
<pathelement location="${test.dir}" />
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<target name="compile-test">
|
|
|
|
<javac srcdir="${test.dir}" >
|
|
|
|
<classpath refid="test.classpath" />
|
|
|
|
</javac>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="test" depends="jar, compile-test">
|
|
|
|
<junit showoutput="true">
|
|
|
|
<classpath refid="test.classpath" />
|
|
|
|
<formatter type="brief" usefile="false" />
|
|
|
|
<batchtest fork="yes">
|
|
|
|
<fileset dir="${test.dir}">
|
|
|
|
<include name="*Test.java" />
|
|
|
|
<include name="**/*Test.java" />
|
|
|
|
</fileset>
|
|
|
|
</batchtest>
|
|
|
|
</junit>
|
|
|
|
</target>
|
|
|
|
|
2012-02-02 09:45:49 +08:00
|
|
|
<target name="cordova_debug" depends="build-javascript, debug">
|
2010-02-04 02:27:49 +08:00
|
|
|
</target>
|
2009-11-19 07:43:59 +08:00
|
|
|
|
2012-02-02 09:45:49 +08:00
|
|
|
<target name="cordova_release" depends="build-javascript, release">
|
2009-11-19 07:43:59 +08:00
|
|
|
</target>
|
2009-11-18 03:33:41 +08:00
|
|
|
|
2009-05-26 07:13:43 +08:00
|
|
|
</project>
|