@@ -100,24 +100,26 @@ object Plugin {
100100 ignoring : List [String ]): List [Try [Plugin ]] =
101101 {
102102
103- def fromFile (inputStream : InputStream ): String = {
103+ def fromFile (inputStream : InputStream , path : Path ): String = {
104104 val props = new Properties
105105 props.load(inputStream)
106106
107107 val pluginClass = props.getProperty(" pluginClass" )
108108
109- if (pluginClass == null ) throw new RuntimeException (" Bad plugin descriptor. " )
109+ if (pluginClass == null ) throw new RuntimeException (" Bad plugin descriptor: " + path )
110110 else pluginClass
111111 }
112112
113- def loadDescriptionFromDir (f : Path ): Try [String ] =
114- Try (fromFile(new java.io.FileInputStream ((f / PluginFile ).jpath.toFile)))
113+ def loadDescriptionFromDir (f : Path ): Try [String ] = {
114+ val path = f / PluginFile
115+ Try (fromFile(new java.io.FileInputStream (path.jpath.toFile), path))
116+ }
115117
116118 def loadDescriptionFromJar (jarp : Path ): Try [String ] = {
117119 // XXX Return to this once we have more ARM support
118120 def read (is : InputStream ) =
119121 if (is == null ) throw new PluginLoadException (jarp.path, s " Missing $PluginFile in $jarp" )
120- else fromFile(is)
122+ else fromFile(is, jarp )
121123
122124 val fileEntry = new java.util.jar.JarEntry (PluginFile )
123125 Try (read(new Jar (jarp.jpath.toFile).getEntryStream(fileEntry)))
@@ -157,10 +159,9 @@ object Plugin {
157159 val seen = mutable.HashSet [String ]()
158160 val enabled = (fromPaths ::: fromDirs) map(_.flatMap {
159161 case (classname, loader) =>
160- // a nod to scala/bug#7494, take the plugin classes distinctly
161162 Plugin .load(classname, loader).flatMap { clazz =>
162163 val plugin = instantiate(clazz)
163- if (seen(classname))
164+ if (seen(classname)) // a nod to scala/bug#7494, take the plugin classes distinctly
164165 Failure (new PluginLoadException (plugin.name, s " Ignoring duplicate plugin ${plugin.name} ( ${classname}) " ))
165166 else if (ignoring contains plugin.name)
166167 Failure (new PluginLoadException (plugin.name, s " Disabling plugin ${plugin.name}" ))
0 commit comments