|
| 1 | +<!-- |
| 2 | +Copyright (c) 2009-2010 Michel Kraemer |
| 3 | +
|
| 4 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | +of this software and associated documentation files (the "Software"), to deal |
| 6 | +in the Software without restriction, including without limitation the rights |
| 7 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 | +copies of the Software, and to permit persons to whom the Software is |
| 9 | +furnished to do so, subject to the following conditions: |
| 10 | +
|
| 11 | +The above copyright notice and this permission notice shall be included in |
| 12 | +all copies or substantial portions of the Software. |
| 13 | +
|
| 14 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 20 | +THE SOFTWARE. |
| 21 | +--> |
| 22 | + |
| 23 | +<project name="Build specific targets and properties" |
| 24 | + xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors"> |
| 25 | + |
| 26 | + <property name="scala.version" value="2.11.5"/> |
| 27 | + <target name="pre.clean"></target> |
| 28 | + <target name="post.clean"></target> |
| 29 | + |
| 30 | + <target name="pre.@dot"></target> |
| 31 | + |
| 32 | + <target name="post.@dot"></target> |
| 33 | + |
| 34 | + <target name="pre.build.jars"></target> |
| 35 | + <target name="post.build.jars"></target> |
| 36 | + |
| 37 | + <target name="pre.gather.bin.parts"></target> |
| 38 | + <target name="post.gather.bin.parts"></target> |
| 39 | + |
| 40 | + <target name="pre.gather.logs"></target> |
| 41 | + <target name="post.gather.logs"></target> |
| 42 | + |
| 43 | + <target name="post.compile.@dot"> |
| 44 | + <!-- find eclipse.home --> |
| 45 | + <pathconvert property="eclipse.home"> |
| 46 | + <path location="${eclipse.launcher}" /> |
| 47 | + <mapper> |
| 48 | + <!-- map "${eclipse.home}/eclipse.exe" to "${eclipse.home}" --> |
| 49 | + <globmapper from="*/eclipse.exe" to="*" handledirsep="true" /> |
| 50 | + </mapper> |
| 51 | + </pathconvert> |
| 52 | + <echo message="Eclipse home: ${eclipse.home}" /> |
| 53 | + |
| 54 | + <!-- find scala library bundle --> |
| 55 | + <pathconvert property="scala_library_bundle"> |
| 56 | + <path> |
| 57 | + <fileset dir="${eclipse.home}/plugins"> |
| 58 | + <include name="org.scala-lang.scala-library_${scala.version}*" /> |
| 59 | + </fileset> |
| 60 | + </path> |
| 61 | + </pathconvert> |
| 62 | + <echo message="Using Scala Library Bundle: ${scala_library_bundle}" /> |
| 63 | + |
| 64 | + <!-- find scala compiler --> |
| 65 | + <pathconvert property="scala_compiler_bundle"> |
| 66 | + <path> |
| 67 | + <fileset dir="${eclipse.home}/plugins"> |
| 68 | + <include name="org.scala-lang.scala-compiler_${scala.version}*" /> |
| 69 | + </fileset> |
| 70 | + </path> |
| 71 | + </pathconvert> |
| 72 | + <echo message="Using Scala Compiler Bundle: ${scala_compiler_bundle}" /> |
| 73 | + |
| 74 | + <!-- unpack scala library --> |
| 75 | + <unjar dest="${build.result.folder}/scala-library" src="${scala_library_bundle}" /> |
| 76 | + <property name="scala_library_jar" location="${build.result.folder}/scala-library/lib/scala-library.jar" /> |
| 77 | + |
| 78 | + <!-- unpack scala compiler --> |
| 79 | + <unjar dest="${build.result.folder}/scala-compiler" src="${scala_compiler_bundle}" /> |
| 80 | + <property name="scala_compiler_jar" location="${build.result.folder}/scala-compiler/lib/scala-compiler.jar" /> |
| 81 | + |
| 82 | + <!-- define scalac task --> |
| 83 | + <taskdef resource="scala/tools/ant/antlib.xml"> |
| 84 | + <classpath> |
| 85 | + <pathelement location="${scala_compiler_jar}" /> |
| 86 | + <pathelement location="${scala_library_jar}" /> |
| 87 | + </classpath> |
| 88 | + </taskdef> |
| 89 | + |
| 90 | + <!-- create classpath --> |
| 91 | + <pathconvert property="my.classpath"> |
| 92 | + <restrict> |
| 93 | + <path> |
| 94 | + <path refid="@dot.classpath" /> |
| 95 | + <pathelement location="${scala_library_jar}" /> |
| 96 | + </path> |
| 97 | + <!-- remove libraries from classpath that don't exist (optional) --> |
| 98 | + <rsel:exists /> |
| 99 | + </restrict> |
| 100 | + </pathconvert> |
| 101 | + <echo message="Classpath: ${my.classpath}" /> |
| 102 | + |
| 103 | + <!-- compile scala source files --> |
| 104 | + <mkdir dir="${target.folder}" /> |
| 105 | + <scalac srcdir="${source.folder1}" |
| 106 | + destdir="${target.folder}" |
| 107 | + classpath="${my.classpath}" |
| 108 | + encoding="UTF-8"> |
| 109 | +<!-- encoding="cp1252"--> |
| 110 | + <include name="**/*.scala" /> |
| 111 | + </scalac> |
| 112 | + |
| 113 | + <!-- delete scala source files in output folder --> |
| 114 | + <delete> |
| 115 | + <fileset dir="${target.folder}" includes="**/*.scala" /> |
| 116 | + </delete> |
| 117 | + </target> |
| 118 | +</project> |
0 commit comments