| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <project name="org.apache.easyant.plugins#compile-test-scala" xmlns:ea="antlib:org.apache.easyant"> |
| <ea:core-version requiredrevision="[0.9,+]" /> |
| |
| <ea:plugin module="abstract-compile" revision="0.9" /> |
| |
| <ea:parameter property="src.test.scala" default="${basedir}/src/test/scala" description="directory where test sources to be compiled are" /> |
| <ea:parameter property="src.test.integration.scala" default="${basedir}/src/integration-test/scala" |
| description="directory where integration test sources to be compiled are" /> |
| <available file="${src.test.scala}" property="has.src.test.scala" /> |
| <available file="${src.test.integration.scala}" property="has.src.test.integration.scala" /> |
| |
| <target name="compile-test-scala:configure" depends="abstract-compile:compile-ready"> |
| <ea:findclasspath pathid="resolved.scala.classpath" organisation="org.scala-lang" module="scala-compiler" |
| revision="2.9.2"> |
| <ea:project-dependency-strategy /> |
| <ea:environment-strategy env="SCALA_HOME" /> |
| <ea:basic-configuration-strategy /> |
| </ea:findclasspath> |
| <taskdef resource="scala/tools/ant/antlib.xml" classpathref="resolved.scala.classpath" /> |
| <!-- when you specify classpath parameter to <scalac /> task it overrides class path |
| defined inside <taskdef /> rather then adds to it. So just add scala jars to your own class path. |
| source http://www.softwaresecretweapons.com/jspwiki/scalatoolsnscfatalerror-object-scala-not-found --> |
| <ea:path pathid="compile.test.classpath" overwrite="prepend"> |
| <path refid="resolved.scala.classpath" /> |
| </ea:path> |
| </target> |
| |
| <macrodef name="compile-scala-tests"> |
| <attribute name="prefix" /> |
| <sequential> |
| <mkdir dir="${target.@{prefix}.classes}" /> |
| <scalac srcdir="${src.@{prefix}.scala}" destdir="${target.@{prefix}.classes}" classpathref="compile.test.classpath" |
| includes="${@{prefix}.compile.includes.pattern}" excludes="${@{prefix}.compile.excludes.pattern}" |
| scalacdebugging="${scalac.debug.mode}"> |
| </scalac> |
| </sequential> |
| </macrodef> |
| |
| <target name="compile-test-scala:compile" depends="compile-test-scala:configure" if="has.src.test.scala" |
| extensionOf="abstract-compile:compile"> |
| <ea:parameter property="test.compile.includes.pattern" default="**/*.scala" |
| description="Pattern describing files included in test compilation process" /> |
| <ea:parameter property="test.compile.excludes.pattern" default="" |
| description="Pattern describing files excluded in test compilation process" /> |
| <compile-scala-tests prefix="test" /> |
| </target> |
| |
| <target name="compile-test-scala:compile-integration" depends="compile-test-scala:configure" if="has.src.test.integration.scala" |
| extensionOf="abstract-compile:compile"> |
| <ea:parameter property="test.integration.compile.includes.pattern" default="**/*.scala" |
| description="Pattern describing files included in integration test compilation process" /> |
| <ea:parameter property="test.integration.compile.excludes.pattern" default="" |
| description="Pattern describing files excluded in integration test compilation process" /> |
| <compile-scala-tests prefix="test.integration" /> |
| </target> |
| </project> |