Skip to content

Commit

Permalink
Make scct compile with 2.10.0-RC1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikko Koponen committed Oct 29, 2012
1 parent a2d7713 commit e7de953
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name := "scct"

version := "0.2-SNAPSHOT"

scalaVersion := "2.9.2"
scalaVersion := "2.10.0-RC1"

crossScalaVersions := Seq("2.9.2", "2.9.1-1", "2.9.1", "2.9.0-1", "2.9.0")
crossScalaVersions := Seq("2.10.0-RC1", "2.9.2", "2.9.1-1", "2.9.1", "2.9.0-1", "2.9.0")

libraryDependencies <+= (scalaVersion) { v =>
"org.scala-lang" % "scala-compiler" % v % "provided"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/reaktor/scct/Coverage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object Coverage {
val values = MetadataPickler.load(env.coverageFile)
Map(values.map(x => (x.id, x)): _*)
} catch {
case e => {
case e:Exception => {
System.err.println("Fail: " + e)
e.printStackTrace
throw e
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/reaktor/scct/ScctInstrumentPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ScctTransformComponent(val global: Global, val opts:ScctInstrumentPluginOp
if (continue) super.transform(result) else result
}

private def hasSkipAnnotation(t: Tree) = t.hasSymbol && t.symbol.hasAnnotation(definitions.getClass("reaktor.scct.uncovered"))
private def hasSkipAnnotation(t: Tree) = t.hasSymbol && t.symbol.hasAnnotation(definitions.getClass(global.stringToTypeName("reaktor.scct.uncovered")))
private def isSynthetic(t: Tree) = t.hasSymbol && t.symbol.isSynthetic && !t.symbol.isAnonymousFunction
private def isObjectOrTraitConstructor(s: Symbol) = s.isConstructor && (currentClass.isModuleClass || currentClass.isTrait)
private def isGeneratedMethod(t: DefDef) = !t.symbol.isConstructor && t.pos.point == currentClass.pos.point
Expand Down Expand Up @@ -230,7 +230,7 @@ class ScctTransformComponent(val global: Global, val opts:ScctInstrumentPluginOp

private def rawCoverageCall(id: Int) = {
val fun = Select( Select( Select(Ident("reaktor"), newTermName("scct") ), newTermName("Coverage") ), newTermName("invoked") )
Apply(fun, List(Literal(opts.compilationId), Literal(id)))
Apply(fun, List(Literal(Constant(opts.compilationId)), Literal(Constant(id))))
}
}

Expand Down
20 changes: 12 additions & 8 deletions src/test/scala/reaktor/scct/InstrumentationSpec.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package reaktor.scct

import scala.tools.nsc.reporters.ConsoleReporter
import java.io.{File, FileOutputStream}
import java.io.{FileNotFoundException, File, FileOutputStream}
import org.specs2.matcher.{Expectable, Matcher}
import org.specs2.mutable._
import tools.nsc._
Expand Down Expand Up @@ -59,17 +59,21 @@ trait InstrumentationSupport {
}

def locateCompiledClasses() = {
val first = new File("./target/scala-"+scalaVersion+"/classes")
val second = new File("./scct/target/scala-"+scalaVersion+"/classes")
val scalaTargetDir = scalaVersion match {
case "2.10.0-RC1" => "2.10"
case x => x
}
val first = new File("./target/scala-"+scalaTargetDir+"/classes")
val second = new File("./scct/target/scala-"+scalaTargetDir+"/classes")
if (first.exists) {
// sbt || IDEA with module dir as working dir
"./target/scala-"+scalaVersion+"/classes"
"./target/scala-"+scalaTargetDir+"/classes"
} else if (second.exists) {
// IDEA, with project dir as working dir
"./scct/target/scala-"+scalaVersion+"/classes"
"./scct/target/scala-"+scalaTargetDir+"/classes"
} else {
val err = "Compiled classes not found. Looked in " + first.getAbsolutePath + " and " + second.getAbsolutePath
throw new MissingRequirementError(err+ " Check InstrumentationSpec:locateCompiledClasses")
throw new FileNotFoundException(err+ " Check InstrumentationSpec:locateCompiledClasses")
}
}

Expand All @@ -86,7 +90,7 @@ trait InstrumentationSupport {
// Probably IDEA with project dir instead of module dir as working dir
scalaJars.map("./scct/project/boot/scala-"+scalaVersion+"/lib/"+_)
} else {
throw new MissingRequirementError("scala jars not found. Check InstrumentationSpec:locateScalaJars")
throw new FileNotFoundException("scala jars not found. Check InstrumentationSpec:locateScalaJars")
}
}

Expand Down Expand Up @@ -204,7 +208,7 @@ class PluginRunner(settings: Settings, debug: Boolean) extends Global(settings,
phasesSet += analyzer.typerFactory
phasesSet += superAccessors
phasesSet += pickler
phasesSet += refchecks
phasesSet += refChecks
phasesSet += scctComponent
}
}

0 comments on commit e7de953

Please sign in to comment.