Wiki source code of Configuring Ant to Build Scala with WebObjects
Last modified by Ravi Mendis on 2010/03/01 16:59
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
34.1 | 1 | === Step1. Setup Properties for Scalac Task === |
2 | |||
![]() |
41.1 | 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. |
![]() |
34.1 | 4 | |
![]() |
41.1 | 5 | {{code 0="xml"}} |
![]() |
34.1 | 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}" /> | ||
![]() |
40.1 | 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" /> | ||
![]() |
34.1 | 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 | |||
![]() |
41.1 | 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 | ||
![]() |
34.1 | 42 | |
![]() |
41.1 | 43 | === Step2. Edit the {{code language="none"}}compile{{/code}} Target === |
![]() |
34.1 | 44 | |
![]() |
41.1 | 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: |
![]() |
34.1 | 46 | |
![]() |
41.1 | 47 | {{code 0="xml"}} |
![]() |
34.1 | 48 | |
49 | <scalac srcdir="Sources" destdir="bin" classpathref="build.classpath"> | ||
50 | <include name="**/*.scala" /> | ||
51 | </scalac> | ||
52 | |||
53 | {{/code}} | ||
![]() |
38.1 | 54 | |
![]() |
41.1 | 55 | === Step3. Add an {{code language="none"}}<otherclasspath>{{/code}} entry for {{code language="none"}}scala-library.jar{{/code}} === |
![]() |
38.1 | 56 | |
![]() |
41.1 | 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. |
![]() |
38.1 | 58 | |
![]() |
41.1 | 59 | {{code 0="xml"}} |
![]() |
38.1 | 60 | |
61 | <otherclasspath root="${scala.home}"> | ||
62 | <include name="lib/scala-library.jar" /> | ||
63 | </otherclasspath> | ||
64 | |||
65 | {{/code}} | ||
![]() |
40.1 | 66 | |
![]() |
41.1 | 67 | === Step4. Add {{code language="none"}}scala.home{{/code}} to {{code language="none"}}build.properties{{/code}} === |
![]() |
40.1 | 68 | |
![]() |
41.1 | 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}} |