Wiki source code of Configuring Ant to Build Scala with WebObjects
Last modified by Ravi Mendis on 2010/03/01 16:59
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | === Step1. Setup Properties for Scalac Task === | ||
2 | |||
3 | You may edit (or add to) the {{code language="none"}}init.properties{{/code}} Ant target in order to set up the appropriate properties for the {{code language="none"}}scalac{{/code}} Ant task. | ||
4 | |||
5 | {{code 0="xml"}} | ||
6 | |||
7 | <property name="scala-library.jar" value="${scala.home}/lib/scala-library.jar" /> | ||
8 | |||
9 | <path id="build.classpath"> | ||
10 | <pathelement location="${scala-library.jar}" /> | ||
11 | <pathelement location="${wo.local.frameworks}/ERExtensions.framework/Resources/Java/ERExtensions.jar" /> | ||
12 | <pathelement location="${wo.local.frameworks}/ERJars.framework/Resources/Java/log4j-1.2.14.jar" /> | ||
13 | <pathelement location="${wo.system.frameworks}/JavaWebObjects.framework/Resources/Java/javawebobjects.jar" /> | ||
14 | <pathelement location="${wo.system.frameworks}/JavaEOAccess.framework/Resources/Java/javaeoaccess.jar" /> | ||
15 | <pathelement location="${wo.system.frameworks}/JavaEOControl.framework/Resources/Java/javaeocontrol.jar" /> | ||
16 | <pathelement location="${wo.system.frameworks}/JavaFoundation.framework/Resources/Java/javafoundation.jar" /> | ||
17 | <pathelement location="${wo.local.frameworks}/ERAttachment.framework/Resources/Java/ERAttachment.jar" /> | ||
18 | <!--pathelement location="Other custom framework path, etc" /--> | ||
19 | |||
20 | <pathelement location="bin" /> | ||
21 | <fileset dir="Libraries"> | ||
22 | <include name="*.jar" /> | ||
23 | </fileset> | ||
24 | <fileset dir="${wo.extensions}"> | ||
25 | <include name="*.jar" /> | ||
26 | </fileset> | ||
27 | </path> | ||
28 | |||
29 | <taskdef resource="scala/tools/ant/antlib.xml"> | ||
30 | <classpath> | ||
31 | <pathelement location="${scala.home}/lib/scala-compiler.jar" /> | ||
32 | <pathelement location="${scala-library.jar}" /> | ||
33 | </classpath> | ||
34 | </taskdef> | ||
35 | |||
36 | {{/code}} | ||
37 | |||
38 | ===== Notes: ===== | ||
39 | |||
40 | 1. The first block of {{code language="none"}}pathelements{{/code}} define the classpaths required by the scala compiler. | ||
41 | 1. The {{code language="none"}}taskdef{{/code}} sets up the Ant scalac task | ||
42 | |||
43 | === Step2. Edit the {{code language="none"}}compile{{/code}} Target === | ||
44 | |||
45 | Add the {{code language="none"}}scalac{{/code}} task to the {{code language="none"}}compile{{/code}} target. Make sure that it's placed after the {{code language="none"}}mkdir{{/code}} task: | ||
46 | |||
47 | {{code 0="xml"}} | ||
48 | |||
49 | <scalac srcdir="Sources" destdir="bin" classpathref="build.classpath"> | ||
50 | <include name="**/*.scala" /> | ||
51 | </scalac> | ||
52 | |||
53 | {{/code}} | ||
54 | |||
55 | === Step3. Add an {{code language="none"}}<otherclasspath>{{/code}} entry for {{code language="none"}}scala-library.jar{{/code}} === | ||
56 | |||
57 | In the {{code language="none"}}build.woapp{{/code}} target, add the following entry to add Scala to the built classpath for your WebObjects app. | ||
58 | |||
59 | {{code 0="xml"}} | ||
60 | |||
61 | <otherclasspath root="${scala.home}"> | ||
62 | <include name="lib/scala-library.jar" /> | ||
63 | </otherclasspath> | ||
64 | |||
65 | {{/code}} | ||
66 | |||
67 | === Step4. Add {{code language="none"}}scala.home{{/code}} to {{code language="none"}}build.properties{{/code}} === | ||
68 | |||
69 | Finally, you must set the {{code language="none"}}scala.home{{/code}} property in the {{code language="none"}}build.properties{{/code}} file. | ||
70 | This is the location of the Scala installation on your system. e.g: {{code language="none"}}/usr/share/scala{{/code}} |