diff --git a/.travis.yml b/.travis.yml index a68139ac..805c2b44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,20 @@ language: scala -scala: - - 2.10.6 - - 2.11.8 - script: - sbt ++$TRAVIS_SCALA_VERSION test jdk: - - oraclejdk7 \ No newline at end of file + - oraclejdk7 + +scala: + - 2.10.6 + - 2.11.8 + +before_cache: + - find "$HOME/.sbt/" -name '*.lock' -print0 | xargs -0 rm + - find "$HOME/.ivy2/" -name 'ivydata-*.properties' -print0 | xargs -0 rm + +cache: + directories: + - $HOME/.ivy2/cache + - $HOME/.sbt diff --git a/project/Scoverage.scala b/build.sbt similarity index 74% rename from project/Scoverage.scala rename to build.sbt index 8eb0a7ff..40e5f66c 100644 --- a/project/Scoverage.scala +++ b/build.sbt @@ -1,22 +1,16 @@ -import sbt.Keys._ import sbt._ -import sbtrelease.ReleasePlugin -import sbtrelease.ReleasePlugin.ReleaseKeys +import sbt.Keys._ +import sbtrelease.ReleasePlugin.autoImport._ import com.typesafe.sbt.pgp.PgpKeys +import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ import org.scalajs.sbtplugin.cross.CrossProject import org.scalajs.sbtplugin.cross.CrossType -import org.scalajs.sbtplugin.ScalaJSPlugin -import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ - -object Scoverage extends Build { - - val Org = "org.scoverage" - val MockitoVersion = "1.9.5" - val ScalatestVersion = "3.0.0" - lazy val LocalTest = config("local") extend Test +val Org = "org.scoverage" +val MockitoVersion = "1.10.19" +val ScalatestVersion = "3.0.0" - val appSettings = Seq( +val appSettings = Seq( organization := Org, scalaVersion := "2.11.8", crossScalaVersions := Seq("2.10.6", "2.11.8"), @@ -25,13 +19,11 @@ object Scoverage extends Build { publishArtifact in Test := false, parallelExecution in Test := false, scalacOptions := Seq("-unchecked", "-deprecation", "-feature", "-encoding", "utf8"), - resolvers := ("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2") +: resolvers.value, concurrentRestrictions in Global += Tags.limit(Tags.Test, 1), - javacOptions := Seq("-source", "1.6", "-target", "1.6"), publishTo <<= version { (v: String) => val nexus = "https://oss.sonatype.org/" - if (v.trim.endsWith("SNAPSHOT")) + if (v.trim.endsWith("-SNAPSHOT")) Some(Resolver.sonatypeRepo("snapshots")) else Some("releases" at nexus + "service/local/staging/deploy/maven2") @@ -60,18 +52,18 @@ object Scoverage extends Build { pomIncludeRepository := { _ => false } - ) ++ ReleasePlugin.releaseSettings ++ Seq( - ReleaseKeys.crossBuild := true, - ReleaseKeys.publishArtifactsAction := PgpKeys.publishSigned.value + ) ++ Seq( + releaseCrossBuild := true, + releasePublishArtifactsAction := PgpKeys.publishSigned.value ) - lazy val root = Project("scalac-scoverage", file(".")) +lazy val root = Project("scalac-scoverage", file(".")) .settings(name := "scalac-scoverage") .settings(appSettings: _*) .settings(publishArtifact := false) .aggregate(plugin, runtime.jvm, runtime.js) - lazy val runtime = CrossProject("scalac-scoverage-runtime", file("scalac-scoverage-runtime"), CrossType.Full) +lazy val runtime = CrossProject("scalac-scoverage-runtime", file("scalac-scoverage-runtime"), CrossType.Full) .settings(name := "scalac-scoverage-runtime") .settings(appSettings: _*) .jvmSettings( @@ -85,10 +77,10 @@ object Scoverage extends Build { scalaJSStage := FastOptStage ) - lazy val `scalac-scoverage-runtimeJVM` = runtime.jvm - lazy val `scalac-scoverage-runtimeJS` = runtime.js +lazy val `scalac-scoverage-runtimeJVM` = runtime.jvm +lazy val `scalac-scoverage-runtimeJS` = runtime.js - lazy val plugin = Project("scalac-scoverage-plugin", file("scalac-scoverage-plugin")) +lazy val plugin = Project("scalac-scoverage-plugin", file("scalac-scoverage-plugin")) .dependsOn(`scalac-scoverage-runtimeJVM` % "test") .settings(name := "scalac-scoverage-plugin") .settings(appSettings: _*) @@ -108,4 +100,3 @@ object Scoverage extends Build { Nil } }) -} diff --git a/project/plugins.sbt b/project/plugins.sbt index c8c17aa4..f123535b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,9 +1,7 @@ -resolvers += Classpaths.sbtPluginReleases +addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0") -addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.3.2") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.1") -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") +addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.3") -addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8.5") - -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.9") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.12") diff --git a/scalac-scoverage-plugin/src/test/scala/scoverage/LocationCompiler.scala b/scalac-scoverage-plugin/src/test/scala/scoverage/LocationCompiler.scala index 57af802b..10c9fd2a 100644 --- a/scalac-scoverage-plugin/src/test/scala/scoverage/LocationCompiler.scala +++ b/scalac-scoverage-plugin/src/test/scala/scoverage/LocationCompiler.scala @@ -27,9 +27,9 @@ class LocationCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tools class LocationSetter(val global: Global) extends PluginComponent with TypingTransformers with Transform { - override val phaseName: String = "location-setter" - override val runsAfter: List[String] = List("typer") - override val runsBefore = List[String]("patmat") + override val phaseName = "location-setter" + override val runsAfter = List("typer") + override val runsBefore = List("patmat") override protected def newTransformer(unit: global.CompilationUnit): global.Transformer = new Transformer(unit) class Transformer(unit: global.CompilationUnit) extends TypingTransformer(unit) { @@ -44,35 +44,7 @@ class LocationCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tools } override def computeInternalPhases() { - val phs = List( - syntaxAnalyzer -> "parse source into ASTs, perform simple desugaring", - analyzer.namerFactory -> "resolve names, attach symbols to named trees", - analyzer.packageObjects -> "load package objects", - analyzer.typerFactory -> "the meat and potatoes: type the trees", - locationSetter -> "sets locations", - patmat -> "translate match expressions", - superAccessors -> "add super accessors in traits and nested classes", - extensionMethods -> "add extension methods for inline classes", - pickler -> "serialize symbol tables", - refChecks -> "reference/override checking, translate nested objects", - uncurry -> "uncurry, translate function values to anonymous classes", - tailCalls -> "replace tail calls by jumps", - specializeTypes -> "@specialized-driven class and method specialization", - explicitOuter -> "this refs to outer pointers, translate patterns", - erasure -> "erase types, add interfaces for traits", - postErasure -> "clean up erased inline classes", - lazyVals -> "allocate bitmaps, translate lazy vals into lazified defs", - lambdaLift -> "move nested functions to top level", - constructors -> "move field definitions into constructors", - mixer -> "mixin composition", - cleanup -> "platform-specific cleanups, generate reflective calls", - genicode -> "generate portable intermediate code", - inliner -> "optimization: do inlining", - inlineExceptionHandlers -> "optimization: inline exception handlers", - closureElimination -> "optimization: eliminate uncalled closures", - deadCode -> "optimization: eliminate dead code", - terminal -> "The last phase in the compiler chain" - ) - phs foreach (addToPhasesSet _).tupled + super.computeInternalPhases() + addToPhasesSet(locationSetter, "sets locations") } -} \ No newline at end of file +} diff --git a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala index 96573a8a..85bf55c1 100644 --- a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala +++ b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala @@ -111,9 +111,9 @@ class ScoverageCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tool class PositionValidator(val global: Global) extends PluginComponent with TypingTransformers with Transform { - override val phaseName: String = "scoverage-validator" - override val runsAfter: List[String] = List("typer") - override val runsBefore = List[String]("scoverage-instrumentation") + override val phaseName = "scoverage-validator" + override val runsAfter = List("typer") + override val runsBefore = List("scoverage-instrumentation") override protected def newTransformer(unit: global.CompilationUnit): global.Transformer = new Transformer(unit) class Transformer(unit: global.CompilationUnit) extends TypingTransformer(unit) { @@ -129,10 +129,9 @@ class ScoverageCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tool val sources = new ListBuffer[String] - override val phaseName: String = "scoverage-teststore" - override val runsAfter: List[String] = List("dce") - // deadcode - override val runsBefore = List[String]("terminal") + override val phaseName = "scoverage-teststore" + override val runsAfter = List("dce") + override val runsBefore = List("terminal") override protected def newTransformer(unit: global.CompilationUnit): global.Transformer = new Transformer(unit) class Transformer(unit: global.CompilationUnit) extends TypingTransformer(unit) { @@ -145,38 +144,10 @@ class ScoverageCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tool } override def computeInternalPhases() { - val phs = List( - syntaxAnalyzer -> "parse source into ASTs, perform simple desugaring", - analyzer.namerFactory -> "resolve names, attach symbols to named trees", - analyzer.packageObjects -> "load package objects", - analyzer.typerFactory -> "the meat and potatoes: type the trees", - validator -> "scoverage validator", - instrumentationComponent -> "scoverage instrumentationComponent", - patmat -> "translate match expressions", - superAccessors -> "add super accessors in traits and nested classes", - extensionMethods -> "add extension methods for inline classes", - pickler -> "serialize symbol tables", - refChecks -> "reference/override checking, translate nested objects", - uncurry -> "uncurry, translate function values to anonymous classes", - tailCalls -> "replace tail calls by jumps", - specializeTypes -> "@specialized-driven class and method specialization", - explicitOuter -> "this refs to outer pointers, translate patterns", - erasure -> "erase types, add interfaces for traits", - postErasure -> "clean up erased inline classes", - lazyVals -> "allocate bitmaps, translate lazy vals into lazified defs", - lambdaLift -> "move nested functions to top level", - constructors -> "move field definitions into constructors", - mixer -> "mixin composition", - cleanup -> "platform-specific cleanups, generate reflective calls", - genicode -> "generate portable intermediate code", - inliner -> "optimization: do inlining", - inlineExceptionHandlers -> "optimization: inline exception handlers", - closureElimination -> "optimization: eliminate uncalled closures", - deadCode -> "optimization: eliminate dead code", - testStore -> "scoverage teststore", - terminal -> "The last phase in the compiler chain" - ) - phs foreach (addToPhasesSet _).tupled + super.computeInternalPhases() + addToPhasesSet(validator, "scoverage validator") + addToPhasesSet(instrumentationComponent, "scoverage instrumentationComponent") + addToPhasesSet(testStore, "scoverage teststore") } }