Skip to content

Commit b2e915b

Browse files
author
michelou
committed
updated code for Scala 2.10.0
1 parent baa2740 commit b2e915b

File tree

220 files changed

+2714
-1288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+2714
-1288
lines changed

android-app-dev/README.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Note that the build instructions below apply to both the Unix and Windows
1717
environments.
1818

1919
All Android examples have been run successfully on the virtual Android device
20-
"API_8" configured as follows: 2.2 target, 256M SD card and HVGA skin
20+
"API_10" configured as follows: 2.3.3 target, 256M SD card and HVGA skin
2121
(for more details see the documentation page
2222
$ANDROID_SDK_ROOT/docs/guide/developing/tools/avd.html).
2323

@@ -31,14 +31,14 @@ Software Requirements
3131
---------------------
3232

3333
In order to build/run our Android examples we need to install the following
34-
free software distributions (tested versions and download sites are given in
35-
parenthesis) :
34+
free software distributions (last tested versions and download sites are given
35+
in parenthesis) :
3636

37-
1) Sun Java SDK 1.6 or newer (1.6.0_26 , www.sun.com/java/jdk/)
38-
2) Scala SDK 2.7.5 or newer (2.9.1 , www.scala-lang.org/downloads/)
39-
3) Android SDK 9 or newer (16 , developer.android.com/sdk/)
40-
4) Apache Ant 1.7.0 or newer (1.8.2 , ant.apache.org/)
41-
5) ProGuard 4.4 or newer (4.6 , www.proguard.com/)
37+
1) Java SDK 1.6 + (1.6.0_26, www.oracle.com/technetwork/java/javase/downloads/)
38+
2) Scala SDK 2.7.5 + (2.10.0 , www.scala-lang.org/downloads/)
39+
3) Android SDK 9 + (16 , developer.android.com/sdk/)
40+
4) Apache Ant 1.7.0 + (1.8.2 , ant.apache.org/)
41+
5) ProGuard 4.4 + (4.7 , www.proguard.com/)
4242

4343
NB. In this document we rely on Ant tasks featured by the Scala SDK, the
4444
Android SDK and the ProGuard shrinker and obfuscator tool (we will say more
@@ -94,10 +94,10 @@ Project Build
9494
-------------
9595

9696
We assume here the Android emulator is up and running; if not we start it
97-
using the shell command (let us assume the existence of the "API_8"
97+
using the shell command (let us assume the existence of the "API_10"
9898
virtual device) :
9999

100-
android-app-dev> emulator -no-boot-anim -no-jni -avd API_8 &
100+
android-app-dev> emulator -no-boot-anim -no-jni -avd API_10 &
101101

102102
Then we move for instance to the "TriviaQuiz" project directory and execute
103103
one of the following Ant targets :

android-app-dev/TriviaQuiz/build-scala.xml

Lines changed: 93 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -30,42 +30,66 @@
3030
<not><equals arg1="${scala.files.count}" arg2="0" /></not>
3131
</condition>
3232

33-
<target name="-compile-scala" depends="-compile"
34-
if="contains.scala.sources" unless="do.not.compile"
33+
<target name="-compile-scala" depends="-compile" if="contains.scala.sources"
3534
description="Compiles project's .scala files into .class files">
36-
<condition property="logging" value="verbose" else="none">
37-
<istrue value="${verbose}" />
38-
</condition>
39-
<echo message="${scalac.banner}" level="info" taskname="scalac" />
40-
<scalac
41-
destdir="${out.classes.absolute.dir}"
42-
bootclasspathref="android.target.classpath"
43-
logging="${logging}" addparams="${scala.compilerargs}"
44-
classpath="${extensible.classpath}"
45-
classpathref="jar.libs.ref">
46-
<src path="${source.absolute.dir}" />
47-
<src path="${gen.absolute.dir}" />
48-
<classpath>
49-
<pathelement location="${scala-library.jar}" />
50-
<!-- include compiled resources -->
51-
<pathelement location="${out.classes.absolute.dir}" />
52-
<fileset dir="${extensible.libs.classpath}" includes="*.jar" />
53-
</classpath>
54-
</scalac>
35+
<do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
36+
<condition property="logging" value="verbose" else="none">
37+
<istrue value="${verbose}" />
38+
</condition>
39+
<echo message="${scalac.banner}" level="info" taskname="scalac" />
40+
<scalac
41+
destdir="${out.classes.absolute.dir}"
42+
bootclasspathref="android.target.classpath"
43+
logging="${logging}" addparams="${scala.compilerargs}"
44+
classpath="${extensible.classpath}"
45+
classpathref="jar.libs.ref">
46+
<src path="${source.absolute.dir}" />
47+
<src path="${gen.absolute.dir}" />
48+
<classpath>
49+
<pathelement location="${scala-library.jar}" />
50+
<!-- include compiled resources -->
51+
<pathelement location="${out.classes.absolute.dir}" />
52+
<fileset dir="${extensible.libs.classpath}" includes="*.jar" />
53+
</classpath>
54+
</scalac>
55+
<!-- if the project is a library then we generate a jar file -->
56+
<if condition="${project.is.library}">
57+
<then>
58+
<echo>Updating library output jar file...</echo>
59+
<jar destfile="${out.library.jar.file}" update="true">
60+
<fileset dir="${out.classes.absolute.dir}" excludes="**/R.class **/R$*.class"/>
61+
<fileset dir="${source.absolute.dir}" excludes="**/*.scala" />
62+
</jar>
63+
</then>
64+
</if>
65+
66+
<!-- if the project is instrumented, intrument the classes -->
67+
<if condition="${build.is.instrumented}">
68+
<then>
69+
<echo>Instrumenting classes from ${out.absolute.dir}/classes...</echo>
70+
<!-- It only instruments class files, not any external libs -->
71+
<emma enabled="true">
72+
<instr verbosity="${verbosity}"
73+
mode="overwrite"
74+
instrpath="${out.absolute.dir}/classes"
75+
outdir="${out.absolute.dir}/classes">
76+
</instr>
77+
<!-- TODO: exclusion filters on R*.class and allowing custom exclusion from
78+
user defined file -->
79+
</emma>
80+
</then>
81+
</if>
82+
</do-only-if-manifest-hasCode>
5583
</target>
5684

57-
<target name="-post-compile-scala" depends="-compile-scala" unless="do.not.compile"
85+
<target name="-post-compile-scala" depends="-compile-scala"
5886
description="Shrink project class files and Scala library into one .jar file">
5987
<condition property="debug.mode" value="" else="#DEBUG#">
6088
<equals arg1="${build.target}" arg2="debug" />
6189
</condition>
6290
<condition property="release.mode" value="" else="#RELEASE#">
6391
<equals arg1="${build.target}" arg2="release" />
6492
</condition>
65-
<!-- priority is given to local ProGuard configuration if present -->
66-
<condition property="template.cfg" value="${basedir}/local-proguard-template.cfg">
67-
<available file="${basedir}/local-proguard-template.cfg" />
68-
</condition>
6993
<condition property="template.cfg" value="${basedir}/proguard-template.cfg">
7094
<available file="${basedir}/proguard-template.cfg" />
7195
</condition>
@@ -81,12 +105,15 @@
81105
<path id="project.libraries.jars">
82106
<pathelement location="${scala-library.jar}" />
83107
</path>
84-
<!-- we use properties defined in main_rules.xml -->
108+
<!-- we use properties defined in tools/ant/build.xml -->
85109
<property name="injars" value="" />
86110
<property name="outjars" value="" />
87111
<property name="libraryjars" value="" />
88112
</then><else>
89113
<property name="shrinked.jar" location="${out.absolute.dir}/shrinked.jar" />
114+
<!-- Secondary dx input (jar files) is empty since all the jar
115+
files will be in the shrinked jar (see tools/ant/build.xml) -->
116+
<path id="out.dex.jar.input.ref" />
90117
<condition property="shrink.required"><not>
91118
<uptodate targetfile="${shrinked.jar}">
92119
<srcfiles dir="${source.absolute.dir}" includes="**/*.scala" />
@@ -95,22 +122,51 @@
95122
<!-- input for dex will be proguard's output -->
96123
<property name="out.dex.input.absolute.dir" value="${shrinked.jar}" />
97124
<!-- set the compiled project files and Scala library into a single property. -->
98-
<pathconvert property="project.injars">
99-
<path location="${out.classes.absolute.dir}" />
100-
<path location="${scala-library.jar}(!META-INF/MANIFEST.MF,!library.properties)" />
101-
</pathconvert>
125+
<if condition="${uses.ramdisk}"><then>
126+
<pathconvert property="project.injars">
127+
<path location="${out.classes.absolute.dir}" />
128+
<path refid="project.libraries.jars" />
129+
</pathconvert>
130+
</then><else>
131+
<pathconvert property="project.injars">
132+
<path location="${out.classes.absolute.dir}" />
133+
<fileset dir="${jar.libs.dir}" includes="*.jar" />
134+
<path refid="project.libraries.jars" />
135+
<path location="${scala-library.jar}(!META-INF/MANIFEST.MF,!library.properties)" />
136+
</pathconvert>
137+
</else></if>
102138
<split-path property="injars" prefix="-injars" path="${project.injars}" />
103139
<split-path property="outjars" prefix="-outjars" path="${shrinked.jar}" />
104140
<!-- set the android classpath object into a single property. -->
105-
<pathconvert property="project.libraryjars">
106-
<fileset dir="${jar.libs.dir}" includes="*.jar" />
107-
<path refid="android.target.classpath" />
108-
</pathconvert>
141+
<if condition="${uses.ramdisk}"><then>
142+
<pathconvert property="project.libraryjars">
143+
<path location="${scala-library.jar}(!META-INF/MANIFEST.MF,!library.properties)" />
144+
<path refid="android.target.classpath" />
145+
</pathconvert>
146+
</then><else>
147+
<pathconvert property="project.libraryjars">
148+
<path refid="android.target.classpath" />
149+
</pathconvert>
150+
</else></if>
109151
<split-path property="libraryjars" prefix="-libraryjars" path="${project.libraryjars}" />
110152
</else></if>
111153
<!-- Name of the application package extracted from manifest file -->
112154
<xpath input="AndroidManifest.xml" expression="/manifest/@package"
113-
output="manifest.package" />
155+
output="manifest.package" />
156+
<!-- we include local configuration if present -->
157+
<if>
158+
<condition>
159+
<available file="${basedir}/proguard-local.cfg" />
160+
</condition>
161+
<then>
162+
<loadfile
163+
property="includes" srcfile="${basedir}/proguard-local.cfg"
164+
failonerror="false" quiet="true" />
165+
</then>
166+
<else>
167+
<property name="includes" value="" />
168+
</else>
169+
</if>
114170
<copy file="${template.cfg}" tofile="${proguard.cfg}">
115171
<filterchain>
116172
<replacetokens>
@@ -121,6 +177,7 @@
121177
<token key="PACKAGENAME" value="${manifest.package}" />
122178
<token key="DEBUG" value="${debug.mode}" />
123179
<token key="RELEASE" value="${release.mode}" />
180+
<token key="INCLUDES" value="${includes}" />
124181
</replacetokens>
125182
</filterchain>
126183
</copy>
@@ -129,27 +186,8 @@
129186
</then></if>
130187
</target>
131188

132-
<target name="install-release" depends="release"
133-
description="Installs/reinstalls the release package onto a running
134-
emulator or device. If the application was previously
135-
installed, the signatures must match." >
136-
<install-release-helper />
137-
</target>
138-
139189
<!-- Macros -->
140190

141-
<macrodef name="install-release-helper">
142-
<sequential>
143-
<echo>Installing ${out.release.file} onto default emulator or device...</echo>
144-
<exec executable="${adb}" failonerror="true">
145-
<arg line="${adb.device.arg}" />
146-
<arg value="install" />
147-
<arg value="-r" />
148-
<arg path="${out.release.file}" />
149-
</exec>
150-
</sequential>
151-
</macrodef>
152-
153191
<macrodef name="generate-header">
154192
<attribute name="property" />
155193
<sequential>

android-app-dev/TriviaQuiz/proguard-template.cfg

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
##############################################################################
2727
## Android specific settings
2828

29+
-dontwarn com.google.common.collect.MinMaxPriorityQueue
30+
-dontwarn com.google.common.primitives.UnsignedBytes$*
31+
32+
-dontnote android.app.backup.BackupAgentHelper
33+
-dontnote com.android.vending.licensing.ILicensingService
34+
2935
-keep public class * extends android.app.Activity
3036
-keep public class * extends android.app.Application
3137
-keep public class * extends android.app.Service
@@ -35,9 +41,6 @@
3541
-keep public class * extends android.preference.Preference
3642
-keep public class com.android.vending.licensing.ILicensingService
3743

38-
-dontnote android.app.backup.BackupAgentHelper
39-
-dontnote com.android.vending.licensing.ILicensingService
40-
4144
-keepclasseswithmembernames class * {
4245
native <methods>;
4346
}
@@ -68,6 +71,7 @@
6871

6972
-dontwarn **$$anonfun$*
7073
-dontwarn scala.android.**
74+
-dontwarn scala.beans.ScalaBeanInfo
7175
-dontwarn scala.collection.generic.GenTraversableFactory
7276
-dontwarn scala.collection.immutable.RedBlack$Empty
7377
-dontwarn scala.concurrent.forkjoin.**
@@ -116,3 +120,5 @@
116120
scala.concurrent.forkjoin.LinkedTransferQueue$PaddedAtomicReference tail;
117121
scala.concurrent.forkjoin.LinkedTransferQueue$PaddedAtomicReference cleanMe;
118122
}
123+
124+
@INCLUDES@

android-app-dev/configs/ant/InvokedTask.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)