@@ -100,24 +100,26 @@ object Plugin {
100
100
ignoring : List [String ]): List [Try [Plugin ]] =
101
101
{
102
102
103
- def fromFile (inputStream : InputStream ): String = {
103
+ def fromFile (inputStream : InputStream , path : Path ): String = {
104
104
val props = new Properties
105
105
props.load(inputStream)
106
106
107
107
val pluginClass = props.getProperty(" pluginClass" )
108
108
109
- if (pluginClass == null ) throw new RuntimeException (" Bad plugin descriptor. " )
109
+ if (pluginClass == null ) throw new RuntimeException (" Bad plugin descriptor: " + path )
110
110
else pluginClass
111
111
}
112
112
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
+ }
115
117
116
118
def loadDescriptionFromJar (jarp : Path ): Try [String ] = {
117
119
// XXX Return to this once we have more ARM support
118
120
def read (is : InputStream ) =
119
121
if (is == null ) throw new PluginLoadException (jarp.path, s " Missing $PluginFile in $jarp" )
120
- else fromFile(is)
122
+ else fromFile(is, jarp )
121
123
122
124
val fileEntry = new java.util.jar.JarEntry (PluginFile )
123
125
Try (read(new Jar (jarp.jpath.toFile).getEntryStream(fileEntry)))
@@ -157,10 +159,9 @@ object Plugin {
157
159
val seen = mutable.HashSet [String ]()
158
160
val enabled = (fromPaths ::: fromDirs) map(_.flatMap {
159
161
case (classname, loader) =>
160
- // a nod to scala/bug#7494, take the plugin classes distinctly
161
162
Plugin .load(classname, loader).flatMap { clazz =>
162
163
val plugin = instantiate(clazz)
163
- if (seen(classname))
164
+ if (seen(classname)) // a nod to scala/bug#7494, take the plugin classes distinctly
164
165
Failure (new PluginLoadException (plugin.name, s " Ignoring duplicate plugin ${plugin.name} ( ${classname}) " ))
165
166
else if (ignoring contains plugin.name)
166
167
Failure (new PluginLoadException (plugin.name, s " Disabling plugin ${plugin.name}" ))
0 commit comments