Skip to content

Commit 989329d

Browse files
authored
Merge pull request #181 from gslowikowski/build-fixes-2
Build improvements
2 parents c9d19f9 + 6e73f81 commit 989329d

File tree

5 files changed

+50
-109
lines changed

5 files changed

+50
-109
lines changed

.travis.yml

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
language: scala
22

3-
scala:
4-
- 2.10.6
5-
- 2.11.8
6-
73
script:
84
- sbt ++$TRAVIS_SCALA_VERSION test
95

106
jdk:
11-
- oraclejdk7
7+
- oraclejdk7
8+
9+
scala:
10+
- 2.10.6
11+
- 2.11.8
12+
13+
before_cache:
14+
- find "$HOME/.sbt/" -name '*.lock' -print0 | xargs -0 rm
15+
- find "$HOME/.ivy2/" -name 'ivydata-*.properties' -print0 | xargs -0 rm
16+
17+
cache:
18+
directories:
19+
- $HOME/.ivy2/cache
20+
- $HOME/.sbt

project/Scoverage.scala renamed to build.sbt

+16-25
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
import sbt.Keys._
21
import sbt._
3-
import sbtrelease.ReleasePlugin
4-
import sbtrelease.ReleasePlugin.ReleaseKeys
2+
import sbt.Keys._
3+
import sbtrelease.ReleasePlugin.autoImport._
54
import com.typesafe.sbt.pgp.PgpKeys
5+
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
66
import org.scalajs.sbtplugin.cross.CrossProject
77
import org.scalajs.sbtplugin.cross.CrossType
8-
import org.scalajs.sbtplugin.ScalaJSPlugin
9-
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
10-
11-
object Scoverage extends Build {
12-
13-
val Org = "org.scoverage"
14-
val MockitoVersion = "1.9.5"
15-
val ScalatestVersion = "3.0.0"
168

17-
lazy val LocalTest = config("local") extend Test
9+
val Org = "org.scoverage"
10+
val MockitoVersion = "1.10.19"
11+
val ScalatestVersion = "3.0.0"
1812

19-
val appSettings = Seq(
13+
val appSettings = Seq(
2014
organization := Org,
2115
scalaVersion := "2.11.8",
2216
crossScalaVersions := Seq("2.10.6", "2.11.8"),
@@ -25,13 +19,11 @@ object Scoverage extends Build {
2519
publishArtifact in Test := false,
2620
parallelExecution in Test := false,
2721
scalacOptions := Seq("-unchecked", "-deprecation", "-feature", "-encoding", "utf8"),
28-
resolvers := ("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2") +: resolvers.value,
2922
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1),
30-
javacOptions := Seq("-source", "1.6", "-target", "1.6"),
3123
publishTo <<= version {
3224
(v: String) =>
3325
val nexus = "https://oss.sonatype.org/"
34-
if (v.trim.endsWith("SNAPSHOT"))
26+
if (v.trim.endsWith("-SNAPSHOT"))
3527
Some(Resolver.sonatypeRepo("snapshots"))
3628
else
3729
Some("releases" at nexus + "service/local/staging/deploy/maven2")
@@ -60,18 +52,18 @@ object Scoverage extends Build {
6052
pomIncludeRepository := {
6153
_ => false
6254
}
63-
) ++ ReleasePlugin.releaseSettings ++ Seq(
64-
ReleaseKeys.crossBuild := true,
65-
ReleaseKeys.publishArtifactsAction := PgpKeys.publishSigned.value
55+
) ++ Seq(
56+
releaseCrossBuild := true,
57+
releasePublishArtifactsAction := PgpKeys.publishSigned.value
6658
)
6759

68-
lazy val root = Project("scalac-scoverage", file("."))
60+
lazy val root = Project("scalac-scoverage", file("."))
6961
.settings(name := "scalac-scoverage")
7062
.settings(appSettings: _*)
7163
.settings(publishArtifact := false)
7264
.aggregate(plugin, runtime.jvm, runtime.js)
7365

74-
lazy val runtime = CrossProject("scalac-scoverage-runtime", file("scalac-scoverage-runtime"), CrossType.Full)
66+
lazy val runtime = CrossProject("scalac-scoverage-runtime", file("scalac-scoverage-runtime"), CrossType.Full)
7567
.settings(name := "scalac-scoverage-runtime")
7668
.settings(appSettings: _*)
7769
.jvmSettings(
@@ -85,10 +77,10 @@ object Scoverage extends Build {
8577
scalaJSStage := FastOptStage
8678
)
8779

88-
lazy val `scalac-scoverage-runtimeJVM` = runtime.jvm
89-
lazy val `scalac-scoverage-runtimeJS` = runtime.js
80+
lazy val `scalac-scoverage-runtimeJVM` = runtime.jvm
81+
lazy val `scalac-scoverage-runtimeJS` = runtime.js
9082

91-
lazy val plugin = Project("scalac-scoverage-plugin", file("scalac-scoverage-plugin"))
83+
lazy val plugin = Project("scalac-scoverage-plugin", file("scalac-scoverage-plugin"))
9284
.dependsOn(`scalac-scoverage-runtimeJVM` % "test")
9385
.settings(name := "scalac-scoverage-plugin")
9486
.settings(appSettings: _*)
@@ -108,4 +100,3 @@ object Scoverage extends Build {
108100
Nil
109101
}
110102
})
111-
}

project/plugins.sbt

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
resolvers += Classpaths.sbtPluginReleases
1+
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")
22

3-
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.3.2")
3+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.1")
44

5-
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
5+
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.3")
66

7-
addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8.5")
8-
9-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.9")
7+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.12")

scalac-scoverage-plugin/src/test/scala/scoverage/LocationCompiler.scala

+6-34
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class LocationCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tools
2727

2828
class LocationSetter(val global: Global) extends PluginComponent with TypingTransformers with Transform {
2929

30-
override val phaseName: String = "location-setter"
31-
override val runsAfter: List[String] = List("typer")
32-
override val runsBefore = List[String]("patmat")
30+
override val phaseName = "location-setter"
31+
override val runsAfter = List("typer")
32+
override val runsBefore = List("patmat")
3333

3434
override protected def newTransformer(unit: global.CompilationUnit): global.Transformer = new Transformer(unit)
3535
class Transformer(unit: global.CompilationUnit) extends TypingTransformer(unit) {
@@ -44,35 +44,7 @@ class LocationCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tools
4444
}
4545

4646
override def computeInternalPhases() {
47-
val phs = List(
48-
syntaxAnalyzer -> "parse source into ASTs, perform simple desugaring",
49-
analyzer.namerFactory -> "resolve names, attach symbols to named trees",
50-
analyzer.packageObjects -> "load package objects",
51-
analyzer.typerFactory -> "the meat and potatoes: type the trees",
52-
locationSetter -> "sets locations",
53-
patmat -> "translate match expressions",
54-
superAccessors -> "add super accessors in traits and nested classes",
55-
extensionMethods -> "add extension methods for inline classes",
56-
pickler -> "serialize symbol tables",
57-
refChecks -> "reference/override checking, translate nested objects",
58-
uncurry -> "uncurry, translate function values to anonymous classes",
59-
tailCalls -> "replace tail calls by jumps",
60-
specializeTypes -> "@specialized-driven class and method specialization",
61-
explicitOuter -> "this refs to outer pointers, translate patterns",
62-
erasure -> "erase types, add interfaces for traits",
63-
postErasure -> "clean up erased inline classes",
64-
lazyVals -> "allocate bitmaps, translate lazy vals into lazified defs",
65-
lambdaLift -> "move nested functions to top level",
66-
constructors -> "move field definitions into constructors",
67-
mixer -> "mixin composition",
68-
cleanup -> "platform-specific cleanups, generate reflective calls",
69-
genicode -> "generate portable intermediate code",
70-
inliner -> "optimization: do inlining",
71-
inlineExceptionHandlers -> "optimization: inline exception handlers",
72-
closureElimination -> "optimization: eliminate uncalled closures",
73-
deadCode -> "optimization: eliminate dead code",
74-
terminal -> "The last phase in the compiler chain"
75-
)
76-
phs foreach (addToPhasesSet _).tupled
47+
super.computeInternalPhases()
48+
addToPhasesSet(locationSetter, "sets locations")
7749
}
78-
}
50+
}

scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala

+10-39
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ class ScoverageCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tool
111111

112112
class PositionValidator(val global: Global) extends PluginComponent with TypingTransformers with Transform {
113113

114-
override val phaseName: String = "scoverage-validator"
115-
override val runsAfter: List[String] = List("typer")
116-
override val runsBefore = List[String]("scoverage-instrumentation")
114+
override val phaseName = "scoverage-validator"
115+
override val runsAfter = List("typer")
116+
override val runsBefore = List("scoverage-instrumentation")
117117

118118
override protected def newTransformer(unit: global.CompilationUnit): global.Transformer = new Transformer(unit)
119119
class Transformer(unit: global.CompilationUnit) extends TypingTransformer(unit) {
@@ -129,10 +129,9 @@ class ScoverageCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tool
129129

130130
val sources = new ListBuffer[String]
131131

132-
override val phaseName: String = "scoverage-teststore"
133-
override val runsAfter: List[String] = List("dce")
134-
// deadcode
135-
override val runsBefore = List[String]("terminal")
132+
override val phaseName = "scoverage-teststore"
133+
override val runsAfter = List("dce")
134+
override val runsBefore = List("terminal")
136135

137136
override protected def newTransformer(unit: global.CompilationUnit): global.Transformer = new Transformer(unit)
138137
class Transformer(unit: global.CompilationUnit) extends TypingTransformer(unit) {
@@ -145,38 +144,10 @@ class ScoverageCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tool
145144
}
146145

147146
override def computeInternalPhases() {
148-
val phs = List(
149-
syntaxAnalyzer -> "parse source into ASTs, perform simple desugaring",
150-
analyzer.namerFactory -> "resolve names, attach symbols to named trees",
151-
analyzer.packageObjects -> "load package objects",
152-
analyzer.typerFactory -> "the meat and potatoes: type the trees",
153-
validator -> "scoverage validator",
154-
instrumentationComponent -> "scoverage instrumentationComponent",
155-
patmat -> "translate match expressions",
156-
superAccessors -> "add super accessors in traits and nested classes",
157-
extensionMethods -> "add extension methods for inline classes",
158-
pickler -> "serialize symbol tables",
159-
refChecks -> "reference/override checking, translate nested objects",
160-
uncurry -> "uncurry, translate function values to anonymous classes",
161-
tailCalls -> "replace tail calls by jumps",
162-
specializeTypes -> "@specialized-driven class and method specialization",
163-
explicitOuter -> "this refs to outer pointers, translate patterns",
164-
erasure -> "erase types, add interfaces for traits",
165-
postErasure -> "clean up erased inline classes",
166-
lazyVals -> "allocate bitmaps, translate lazy vals into lazified defs",
167-
lambdaLift -> "move nested functions to top level",
168-
constructors -> "move field definitions into constructors",
169-
mixer -> "mixin composition",
170-
cleanup -> "platform-specific cleanups, generate reflective calls",
171-
genicode -> "generate portable intermediate code",
172-
inliner -> "optimization: do inlining",
173-
inlineExceptionHandlers -> "optimization: inline exception handlers",
174-
closureElimination -> "optimization: eliminate uncalled closures",
175-
deadCode -> "optimization: eliminate dead code",
176-
testStore -> "scoverage teststore",
177-
terminal -> "The last phase in the compiler chain"
178-
)
179-
phs foreach (addToPhasesSet _).tupled
147+
super.computeInternalPhases()
148+
addToPhasesSet(validator, "scoverage validator")
149+
addToPhasesSet(instrumentationComponent, "scoverage instrumentationComponent")
150+
addToPhasesSet(testStore, "scoverage teststore")
180151
}
181152
}
182153

0 commit comments

Comments
 (0)