@@ -28,6 +28,8 @@ class ScoveragePlugin(val global: Global) extends Plugin {
28
28
error(" Unknown option: " + opt)
29
29
}
30
30
}
31
+ if (! opts.exists(_.startsWith(" dataDir:" )))
32
+ throw new RuntimeException (" Cannot invoke plugin without specifiying <dataDir>" )
31
33
instrumentationComponent.setOptions(options)
32
34
}
33
35
@@ -41,7 +43,7 @@ class ScoveragePlugin(val global: Global) extends Plugin {
41
43
42
44
class ScoverageOptions {
43
45
var excludedPackages : Seq [String ] = Nil
44
- var dataDir : String = File .createTempFile(" scoverage_find_temp_dir " , " .tmp" ).getParent
46
+ var dataDir : String = File .createTempFile(" scoverage_datadir_not_defined " , " .tmp" ).getParent
45
47
}
46
48
47
49
class ScoveragePreComponent (val global : Global ) extends PluginComponent with TypingTransformers with Transform {
@@ -99,6 +101,7 @@ class ScoverageInstrumentationComponent(val global: Global)
99
101
def setOptions (options : ScoverageOptions ): Unit = {
100
102
this .options = options
101
103
coverageFilter = new RegexCoverageFilter (options.excludedPackages)
104
+ new File (options.dataDir).mkdirs()
102
105
}
103
106
104
107
override def newPhase (prev : scala.tools.nsc.Phase ): Phase = new Phase (prev) {
@@ -288,7 +291,7 @@ class ScoverageInstrumentationComponent(val global: Global)
288
291
tree match {
289
292
290
293
// ignore synthetic trees that contain non-syths. Probably macros. Either way breaks due to range validation
291
- case t if isSynthetic(t) && containsNonSynthetic(t) => super .transform(t)
294
+ case t if isSynthetic(t) && containsNonSynthetic(t) && ! t.pos.isDefined => super .transform(t)
292
295
293
296
/**
294
297
* Object creation from new.
0 commit comments