Skip to content
Snippets Groups Projects
Commit 629343e2 authored by Philippe Suter's avatar Philippe Suter
Browse files

migrated the plugin to Scala 2.8...

parent eed35d3a
No related branches found
No related tags found
No related merge requests found
...@@ -15,16 +15,16 @@ ...@@ -15,16 +15,16 @@
<property name="base.dir" value="${basedir}" /> <property name="base.dir" value="${basedir}" />
<property name="sources.dir" value="${base.dir}/src" /> <property name="sources.dir" value="${base.dir}/src" />
<property name="examples.dir" value="${base.dir}/examples" /> <property name="examples.dir" value="${base.dir}/examples" />
<property name="tests.dir" value="${base.dir}/tests" /> <!-- <property name="tests.dir" value="${base.dir}/tests" /> -->
<property name="dist.dir" value="${base.dir}/dist" /> <property name="dist.dir" value="${base.dir}/dist" />
<property name="lib.dir" value="${basedir}/lib" /> <property name="lib.dir" value="${basedir}/lib" />
<property name="build.dir" value="${base.dir}/bin" /> <property name="build.dir" value="${base.dir}/bin" />
<property name="build.plugin.funcheck.dir" value="${build.dir}/plugin" /> <property name="build.plugin.funcheck.dir" value="${build.dir}/plugin" />
<property name="build.funcheck.lib.dir" value="${build.dir}/lib" /> <property name="build.funcheck.lib.dir" value="${build.dir}/lib" />
<property name="build.scala.lib.extension.dir" value="${build.dir}/scala" /> <!-- <property name="build.scala.lib.extension.dir" value="${build.dir}/scala" /> -->
<property name="build.examples.dir" value="${build.dir}/examples" /> <!-- <property name="build.examples.dir" value="${build.dir}/examples" /> -->
<property name="build.tests.dir" value="${build.dir}/tests" /> <!-- <property name="build.tests.dir" value="${build.dir}/tests" /> -->
<!-- other properties --> <!-- other properties -->
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<property name="script.file" value="${base.dir}/scalac-funcheck" /> <property name="script.file" value="${base.dir}/scalac-funcheck" />
<property name="scalac.default.params" value="-deprecation -unchecked" /> <property name="scalac.default.params" value="-deprecation -unchecked" />
<property name="scalac.funcheck.plugin" value="-Xplugin:${dist.jar} ${scalac.default.params}"/> <property name="scalac.funcheck.plugin" value="-Xplugin:${dist.jar} ${scalac.default.params}"/>
<!-- required to use the tasks scalac, fsc and scaladoc --> <!-- required to use the tasks scalac, fsc and scaladoc -->
<taskdef resource="scala/tools/ant/antlib.xml"> <taskdef resource="scala/tools/ant/antlib.xml">
<classpath> <classpath>
...@@ -48,43 +48,48 @@ ...@@ -48,43 +48,48 @@
<pathelement location="${scala-compiler.jar}" /> <pathelement location="${scala-compiler.jar}" />
</path> </path>
<path id="funcheck.lib.path"> <path id="funcheck.lib.path">
<pathelement location="${build.funcheck.lib.dir}"/> <pathelement location="${build.funcheck.lib.dir}"/>
</path> </path>
<path id="scala.lib.extension.path"> <!--
<pathelement location="${build.scala.lib.extension.dir}"/> <path id="scala.lib.extension.path">
</path> <pathelement location="${build.scala.lib.extension.dir}"/>
</path>
-->
<path id="build.path"> <path id="build.path">
<path refid="scalac.class.path"/> <path refid="scalac.class.path"/>
<path refid="funcheck.lib.path"/> <path refid="funcheck.lib.path"/>
<pathelement location="${build.plugin.funcheck.dir}" /> <pathelement location="${build.plugin.funcheck.dir}" />
</path> </path>
<path id="scalacheck.lib.path"> <!--
<pathelement location="${lib.dir}/ScalaCheck-1.5.jar"/> <path id="scalacheck.lib.path">
</path> <pathelement location="${lib.dir}/ScalaCheck-1.5.jar"/>
</path>
<path id="test.lib.path"> -->
<path refid="scalacheck.lib.path"/>
<!--
<path id="test.lib.path">
<path refid="scalacheck.lib.path"/>
<pathelement location="${lib.dir}/scalatest-0.9.5.jar" /> <pathelement location="${lib.dir}/scalatest-0.9.5.jar" />
<pathelement location="${lib.dir}/specs-1.5.0.jar" /> <pathelement location="${lib.dir}/specs-1.5.0.jar" />
</path> </path>
-->
<!-- phases definitions --> <!-- phases definitions -->
<target name="compile-funcheck-lib" description="compile the FunCheck library (used for specification)"> <target name="compile-funcheck-lib" description="compile the FunCheck library (used for specification)">
<mkdir dir="${build.funcheck.lib.dir}" /> <mkdir dir="${build.funcheck.lib.dir}" />
<scalac srcdir="${sources.dir}" destdir="${build.funcheck.lib.dir}" force="changed" addparams="${scalac.default.params}"> <scalac srcdir="${sources.dir}" destdir="${build.funcheck.lib.dir}" force="changed" addparams="${scalac.default.params}">
<classpath> <classpath>
<path refid="scalac.class.path" /> <path refid="scalac.class.path" />
</classpath> </classpath>
<include name="funcheck/lib/**/*.scala" /> <include name="funcheck/lib/**/*.scala" />
</scalac> </scalac>
</target> </target>
<!--
<target name="compile-scalac-lib-extension" description="compile Scala library extension for immutable Multiset"> <target name="compile-scalac-lib-extension" description="compile Scala library extension for immutable Multiset">
<mkdir dir="${build.scala.lib.extension.dir}" /> <mkdir dir="${build.scala.lib.extension.dir}" />
<scalac srcdir="${sources.dir}" destdir="${build.scala.lib.extension.dir}" force="changed" addparams="${scalac.default.params}"> <scalac srcdir="${sources.dir}" destdir="${build.scala.lib.extension.dir}" force="changed" addparams="${scalac.default.params}">
...@@ -92,16 +97,17 @@ ...@@ -92,16 +97,17 @@
<include name="scala/collection/**/*.scala" /> <include name="scala/collection/**/*.scala" />
</scalac> </scalac>
</target> </target>
-->
<target name="compile" depends="compile-funcheck-lib, compile-scalac-lib-extension" description="compile the FunCheck plugin"> <target name="compile" depends="compile-funcheck-lib" description="compile the FunCheck plugin">
<mkdir dir="${build.plugin.funcheck.dir}" /> <mkdir dir="${build.plugin.funcheck.dir}" />
<scalac srcdir="${sources.dir}" destdir="${build.plugin.funcheck.dir}" force="changed" addparams="${scalac.default.params}"> <scalac srcdir="${sources.dir}" destdir="${build.plugin.funcheck.dir}" force="changed" addparams="${scalac.default.params}">
<classpath> <classpath>
<path refid="scalac.class.path" /> <path refid="scalac.class.path" />
</classpath> </classpath>
<exclude name="scala/collection/**/*.scala"/> <exclude name="scala/collection/**/*"/>
<exclude name="funcheck/lib/**/*.scala"/> <exclude name="funcheck/lib/**/*"/>
<exclude name="funcheck/scalacheck/**/*" />
</scalac> </scalac>
</target> </target>
...@@ -123,16 +129,17 @@ ...@@ -123,16 +129,17 @@
<chmod file="${script.file}" perm="u+x" /> <chmod file="${script.file}" perm="u+x" />
</target> </target>
<!--
<target name="compile-examples" depends="dist" description="compile the examples"> <target name="compile-examples" depends="dist" description="compile the examples">
<mkdir dir="${build.examples.dir}" /> <mkdir dir="${build.examples.dir}" />
<scalac srcdir="${examples.dir}" destdir="${build.examples.dir}" force="changed" <scalac srcdir="${examples.dir}" destdir="${build.examples.dir}" force="changed"
addparams="${scalac.default.params}"> addparams="${scalac.default.params}">
<!-- addparams="${scalac.funcheck.plugin}" crashes for some unknown reason --> < ! - - addparams="${scalac.funcheck.plugin}" crashes for some unknown reason - - >
<classpath> <classpath>
<path refid="scalac.class.path" /> <path refid="scalac.class.path" />
<path refid="scala.lib.extension.path" /> <path refid="scala.lib.extension.path" />
<path refid="funcheck.lib.path" /> <path refid="funcheck.lib.path" />
<path refid="scalacheck.lib.path" /> <path refid="scalacheck.lib.path" />
</classpath> </classpath>
</scalac> </scalac>
</target> </target>
...@@ -143,41 +150,43 @@ ...@@ -143,41 +150,43 @@
<mkdir dir="${build.tests.dir}" /> <mkdir dir="${build.tests.dir}" />
<scalac srcdir="${tests.dir}" destdir="${build.tests.dir}" force="changed" addparams="${scalac.default.params}"> <scalac srcdir="${tests.dir}" destdir="${build.tests.dir}" force="changed" addparams="${scalac.default.params}">
<classpath> <classpath>
<path refid="scala.lib.extension.path" /> <path refid="scala.lib.extension.path" />
<path refid="test.lib.path" /> <path refid="test.lib.path" />
<path refid="build.path" /> <path refid="build.path" />
<pathelement location="${build.examples.dir}"/> <pathelement location="${build.examples.dir}"/>
</classpath> </classpath>
</scalac> </scalac>
</target> </target>
<target name="run-test" depends="compile-tests" <target name="run-test" depends="compile-tests"
description="run a test (test name is provided by the user)"> description="run a test (test name is provided by the user)">
<input message="Please enter the name of the test you want to run <input message="Please enter the name of the test you want to run
(e.g., package_name.ClassName)" (e.g., package_name.ClassName)"
addproperty="test.name" addproperty="test.name"
/> />
<echo message="--- running test ${test.name}."/> <echo message="- - running test ${test.name}."/>
<java classname="scala.tools.nsc.MainGenericRunner" fork="true"> <java classname="scala.tools.nsc.MainGenericRunner" fork="true">
<classpath> <classpath>
<path refid="scala.lib.extension.path" /> <path refid="scala.lib.extension.path" />
<path refid="test.lib.path" /> <path refid="test.lib.path" />
<path refid="build.path" /> <path refid="build.path" />
<pathelement location="${build.examples.dir}"/> <pathelement location="${build.examples.dir}"/>
<pathelement location="${build.tests.dir}"/> <pathelement location="${build.tests.dir}"/>
</classpath> </classpath>
<arg line="${test.name}" /> <arg line="${test.name}" />
</java> </java>
</target>
-->
<target name="clean" description="clean the project space">
<delete file="${script.file}" quiet="yes" failonerror="no" />
<delete dir="${build.dir}" includeemptydirs="yes" quiet="yes" failonerror="no" />
<delete dir="${dist.dir}" includeemptydirs="yes" quiet="yes" failonerror="no" />
<delete>
<fileset dir="${basedir}" includes="**/*.class" />
</delete>
</target> </target>
<target name="clean" description="clean the project space">
<delete file="${script.file}" quiet="yes" failonerror="no" />
<delete dir="${build.dir}" includeemptydirs="yes" quiet="yes" failonerror="no" />
<delete dir="${dist.dir}" includeemptydirs="yes" quiet="yes" failonerror="no" />
<delete>
<fileset dir="${basedir}" includes="**/*.class" />
</delete>
</target>
<target name="new" description="clean and rebuilds" depends="clean, dist" /> <target name="new" description="clean and rebuilds" depends="clean, dist" />
</project> </project>
...@@ -12,9 +12,9 @@ class AnalysisComponent(val global: Global, val pluginInstance: FunCheckPlugin) ...@@ -12,9 +12,9 @@ class AnalysisComponent(val global: Global, val pluginInstance: FunCheckPlugin)
{ {
import global._ import global._
// when we use 2.8.x, swap the following two lines // This is how it works from 2.8 on..
val runsAfter = "refchecks" override val runsRightAfter: Option[String] = None
// override val runsRightAfter = "refchecks" override val runsAfter: List[String] = List("refchecks")
val phaseName = pluginInstance.name val phaseName = pluginInstance.name
......
...@@ -48,7 +48,7 @@ see examples in: ...@@ -48,7 +48,7 @@ see examples in:
/* Control flow */ /* Control flow */
case class FunctionInvocation(funDef: FunDef, args: Seq[Expr]) extends Expr { case class FunctionInvocation(funDef: FunDef, args: Seq[Expr]) extends Expr {
assert(args.map(_.getType).equalsWith(funDef.argTypes)(_ == _)) assert(args.map(_.getType).corresponds(funDef.argTypes)(_ == _))
lazy val getType = funDef.returnType lazy val getType = funDef.returnType
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment