Skip to content

Build improvements #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
language: scala

scala:
- 2.10.6
- 2.11.8

script:
- sbt ++$TRAVIS_SCALA_VERSION test

jdk:
- oraclejdk7
- 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
41 changes: 16 additions & 25 deletions project/Scoverage.scala → build.sbt
Original file line number Diff line number Diff line change
@@ -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"),
Expand All @@ -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")
Expand Down Expand Up @@ -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(
Expand All @@ -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: _*)
Expand All @@ -108,4 +100,3 @@ object Scoverage extends Build {
Nil
}
})
}
10 changes: 4 additions & 6 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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")
}
}

Expand Down