Skip to content

Commit f288be3

Browse files
author
michelou
committed
fixed setenv task (Android examples)
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@22197 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
1 parent 30fd1a4 commit f288be3

File tree

2 files changed

+56
-22
lines changed

2 files changed

+56
-22
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sdk.dir=C://Progra~1\\Android
2-
scala.dir=c:${file.separator}Progra~1${file.separator}Scala
3-
yguard.dir=c:\\Progra~1\\yguard-2.3.0.1
1+
sdk.dir=C://Progra~1//Android
2+
scala.dir=c://Progra~1//Scala
3+
yguard.dir=c://Progra~1//yguard-2.3.0.1
44

docs/android-examples/build.xml

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<project name="android" default="help">
33

44
<description>
5-
Builds the Android applications targeted to the Scala platform.
5+
Builds the Android applications targeted to the Scala platform.
66
</description>
77

88
<!-- Setting-up Ant contrib tasks -->
@@ -30,6 +30,11 @@
3030
<ant.dirs target="release"/>
3131
</target>
3232

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+
3338
<target name="uninstall" description="uninstall applications">
3439
<ant.dirs target="uninstall"/>
3540
</target>
@@ -46,22 +51,24 @@
4651
<echo message=" release: Build applications in release mode."/>
4752
<echo message=" uninstall: Uninstall applications from a running emulator or device."/>
4853
<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."/>
5056
</target>
5157

5258
<target name="setenv">
5359
<condition property="prop.file" value="${basedir}/ant-windows.properties">
5460
<and>
55-
<os family="unix" />
61+
<os family="windows" />
5662
<available file="${basedir}/ant-windows.properties" />
5763
</and>
5864
</condition>
5965
<condition property="prop.file" value="${basedir}/ant-unix.properties">
6066
<and>
61-
<os family="windows" />
67+
<os family="unix" />
6268
<available file="${basedir}/ant-unix.properties" />
6369
</and>
6470
</condition>
71+
<echo message="Reading environment settings from ${prop.file}" level="verbose" />
6572
<!--<property file="${prop.file}" prefix="os" /> -->
6673
<loadproperties srcfile="${prop.file}" prefix="os" >
6774
<filterchain>
@@ -74,23 +81,23 @@
7481
<echo message="prop.file=${prop.file}" level="debug" />
7582
<if><isset property="prop.file" />
7683
<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}"/>
9097
</sequential></for>
9198
</then>
9299
<else>
93-
<echo message="The setenv task needs a configuration file" />
100+
<echo message="The setenv task needs a configuration file" />
94101
</else>
95102
</if>
96103
</target>
@@ -106,4 +113,31 @@
106113
</sequential>
107114
</macrodef>
108115

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+
109143
</project>

0 commit comments

Comments
 (0)