Skip to content

Commit 6184078

Browse files
authored
Merge pull request scala#8345 from retronym/topic/plugin-classloader-tweak
Use the first scalac-plugin.xml from the plugin classpath
2 parents 692c0f9 + a37b257 commit 6184078

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/compiler/scala/tools/nsc/plugins/Plugin.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ object Plugin {
152152

153153
val fromLoaders = paths.map {path =>
154154
val loader = findPluginClassloader(path)
155-
loader.getResources(PluginXML).asScala.toList.lastOption match {
156-
case None => Failure(new MissingPluginException(path))
157-
case Some(url) =>
155+
loader.getResource(PluginXML) match {
156+
case null => Failure(new MissingPluginException(path))
157+
case url =>
158158
val inputStream = url.openStream
159159
try {
160160
Try((PluginDescription.fromXML(inputStream), loader))

src/compiler/scala/tools/nsc/plugins/Plugins.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ trait Plugins { global: Global =>
6262
/**
6363
* Locate or create the classloader to load a compiler plugin with `classpath`.
6464
*
65-
* Subclasses may override to customise the behaviour.
65+
* Subclasses may override to customise the behaviour. The returned classloader must return the first
66+
* from plugin descriptor from `classpath` when `getResource("scalac-plugin.xml")` is called.
6667
*
6768
* @param classpath
6869
* @return

0 commit comments

Comments
 (0)