This repository was archived by the owner on Sep 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +45
-2
lines changed
src/compiler/scala/tools/nsc/plugins Expand file tree Collapse file tree 5 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -158,8 +158,8 @@ object Plugin {
158
158
def loop (qs : List [Path ]): Try [PluginDescription ] = qs match {
159
159
case Nil => Failure (new MissingPluginException (ps))
160
160
case p :: rest =>
161
- if (p.isDirectory) loadDescriptionFromFile(p.toDirectory / PluginXML )
162
- else if (p.isFile) loadDescriptionFromJar(p.toFile)
161
+ if (p.isDirectory) loadDescriptionFromFile(p.toDirectory / PluginXML ) orElse loop(rest)
162
+ else if (p.isFile) loadDescriptionFromJar(p.toFile) orElse loop(rest)
163
163
else loop(rest)
164
164
}
165
165
loop(ps)
Original file line number Diff line number Diff line change
1
+ package scala .test .plugins
2
+
3
+ import scala .tools .nsc
4
+ import nsc .Global
5
+ import nsc .Phase
6
+ import nsc .plugins .Plugin
7
+ import nsc .plugins .PluginComponent
8
+
9
+ class ThePlugin (val global : Global ) extends Plugin {
10
+ import global ._
11
+
12
+ val name = " timebomb"
13
+ val description = " Explodes if run. Maybe I haven't implemented it yet."
14
+ val components = List [PluginComponent ](thePhase1)
15
+
16
+ private object thePhase1 extends PluginComponent {
17
+ val global = ThePlugin .this .global
18
+
19
+ val runsAfter = List [String ](" parser" )
20
+ override val runsBefore = List [String ](" namer" )
21
+ val phaseName = ThePlugin .this .name
22
+
23
+ def newPhase (prev : Phase ) = new ThePhase (prev)
24
+ }
25
+
26
+ private class ThePhase (prev : Phase ) extends Phase (prev) {
27
+ override def name = ThePlugin .this .name
28
+ override def run = ???
29
+ }
30
+ }
31
+
Original file line number Diff line number Diff line change
1
+ -Xplugin:/tmp:. -Xplugin-require:timebomb -Ystop-after:parser
Original file line number Diff line number Diff line change
1
+
2
+ package sample
3
+
4
+ // just a sample that is compiled with the explosive plugin disabled
5
+ object Sample extends App {
6
+ }
Original file line number Diff line number Diff line change
1
+ <plugin >
2
+ <name >ignored</name >
3
+ <classname >scala.test.plugins.ThePlugin</classname >
4
+ </plugin >
5
+
You can’t perform that action at this time.
0 commit comments