|
1 |
| -<?xml version="1.0" encoding="UTF-8"?> |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <project name="android" default="help">
|
3 | 3 |
|
4 | 4 | <description>
|
5 |
| - Builds the Android applications targeted to the Scala platform. |
| 5 | +Builds the Android applications targeted to the Scala platform. |
6 | 6 | </description>
|
7 | 7 |
|
8 | 8 | <!-- Setting-up Ant contrib tasks -->
|
|
30 | 30 | <ant.dirs target="release"/>
|
31 | 31 | </target>
|
32 | 32 |
|
| 33 | + <target name="install" description="install applications"> |
| 34 | + <!--<confirm message="Is the Android emulator up and ready ?" />--> |
| 35 | + <ant.dirs target="install"/> |
| 36 | + </target> |
| 37 | + |
33 | 38 | <target name="uninstall" description="uninstall applications">
|
34 | 39 | <ant.dirs target="uninstall"/>
|
35 | 40 | </target>
|
|
46 | 51 | <echo message=" release: Build applications in release mode."/>
|
47 | 52 | <echo message=" uninstall: Uninstall applications from a running emulator or device."/>
|
48 | 53 | <echo message=" clean: Clean up build files from projects."/>
|
49 |
| - <echo message=" setenv: Update software locations to current environment."/> |
| 54 | + <echo message="Available advanced targets:"/> |
| 55 | + <echo message=" setenv: Update build.properties files according to current environment."/> |
50 | 56 | </target>
|
51 | 57 |
|
52 | 58 | <target name="setenv">
|
53 | 59 | <condition property="prop.file" value="${basedir}/ant-windows.properties">
|
54 | 60 | <and>
|
55 |
| - <os family="unix" /> |
| 61 | + <os family="windows" /> |
56 | 62 | <available file="${basedir}/ant-windows.properties" />
|
57 | 63 | </and>
|
58 | 64 | </condition>
|
59 | 65 | <condition property="prop.file" value="${basedir}/ant-unix.properties">
|
60 | 66 | <and>
|
61 |
| - <os family="windows" /> |
| 67 | + <os family="unix" /> |
62 | 68 | <available file="${basedir}/ant-unix.properties" />
|
63 | 69 | </and>
|
64 | 70 | </condition>
|
| 71 | + <echo message="Reading environment settings from ${prop.file}" level="verbose" /> |
65 | 72 | <!--<property file="${prop.file}" prefix="os" /> -->
|
66 | 73 | <loadproperties srcfile="${prop.file}" prefix="os" >
|
67 | 74 | <filterchain>
|
|
74 | 81 | <echo message="prop.file=${prop.file}" level="debug" />
|
75 | 82 | <if><isset property="prop.file" />
|
76 | 83 | <then>
|
77 |
| - <for list="Snake" param="dir"><sequential> |
78 |
| - <loadfile |
79 |
| - srcfile="@{dir}/build.properties" |
80 |
| - property="toto"> |
81 |
| - <filterchain> |
82 |
| - <tokenfilter> |
83 |
| - <replaceregex pattern="^sdk\.dir=.*$" replace="sdk.dir=${os.sdk.dir}" flags="gi"/> |
84 |
| - <replaceregex pattern="^scala\.dir=.*$" replace="scala.dir=${os.scala.dir}" flags="gi"/> |
85 |
| - <replaceregex pattern="^yguard\.dir=.*$" replace="yguard.dir=${os.yguard.dir}" flags="gi"/> |
86 |
| - </tokenfilter> |
87 |
| - </filterchain> |
88 |
| - </loadfile> |
89 |
| - <echo message="${toto}" file="@{dir}/build.properties" /> |
| 84 | + <for list="${dirs}" param="dir"><sequential> |
| 85 | + <replaceproperty |
| 86 | + name="sdk.dir" |
| 87 | + value="${os.sdk.dir}" |
| 88 | + dir="@{dir}"/> |
| 89 | + <replaceproperty |
| 90 | + name="scala.dir" |
| 91 | + value="${os.scala.dir}" |
| 92 | + dir="@{dir}"/> |
| 93 | + <replaceproperty |
| 94 | + name="yguard.dir" |
| 95 | + value="${os.yguard.dir}" |
| 96 | + dir="@{dir}"/> |
90 | 97 | </sequential></for>
|
91 | 98 | </then>
|
92 | 99 | <else>
|
93 |
| - <echo message="The setenv task needs a configuration file" /> |
| 100 | + <echo message="The setenv task needs a configuration file" /> |
94 | 101 | </else>
|
95 | 102 | </if>
|
96 | 103 | </target>
|
|
106 | 113 | </sequential>
|
107 | 114 | </macrodef>
|
108 | 115 |
|
| 116 | + <macrodef name="replaceproperty"> |
| 117 | + <attribute name="name" /> |
| 118 | + <attribute name="value" /> |
| 119 | + <attribute name="dir" /> |
| 120 | + <sequential> |
| 121 | + <replaceregexp byline="true"> |
| 122 | + <regexp pattern="^@{name}=(.*)"/> |
| 123 | + <substitution expression="@{name}=@{value}"/> |
| 124 | + <fileset dir="@{dir}" includes="build.properties"/> |
| 125 | + </replaceregexp> |
| 126 | + </sequential> |
| 127 | + </macrodef> |
| 128 | + |
| 129 | + <macrodef name="confirm"> |
| 130 | + <attribute name="message" /> |
| 131 | + <sequential> |
| 132 | + <input message="@{message}" |
| 133 | + validargs="y,n" |
| 134 | + addproperty="do.confirm" |
| 135 | + /> |
| 136 | + <condition property="do.abort"> |
| 137 | + <equals arg1="n" arg2="${do.confirm}"/> |
| 138 | + </condition> |
| 139 | + <fail if="do.abort">Build aborted by user.</fail> |
| 140 | + </sequential> |
| 141 | + </macrodef> |
| 142 | + |
109 | 143 | </project>
|
0 commit comments