1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Fix the XML file names.

This commit is contained in:
Cedric Beust 2015-12-18 05:39:03 +04:00
parent 767b617638
commit 9594cbce79

View file

@ -79,18 +79,23 @@ class PluginInfo(val xml: KobaltPluginXml, val classLoader: ClassLoader?) {
companion object { companion object {
/** /**
* The name needs to be different from kobalt-plugin.xml because classloaders * Where plug-ins define their plug-in actors.
*/
val PLUGIN_XML = "META-INF/kobalt-plugin.xml" // Plugins.PLUGIN_XML)
/**
* Kobalt's core XML file needs to be different from kobalt-plugin.xml because classloaders
* can put a plug-in's jar file in front of Kobalt's, which means we'll read * can put a plug-in's jar file in front of Kobalt's, which means we'll read
* that one instead of the core one. * that one instead of the core one.
*/ */
val PLUGIN_XML = "META-INF/kobalt-core-plugin.xml" // Plugins.PLUGIN_XML) val PLUGIN_CORE_XML = "META-INF/kobalt-core-plugin.xml" // Plugins.PLUGIN_XML)
/** /**
* Read Kobalt's own kobalt-plugin.xml. * Read Kobalt's own kobalt-plugin.xml.
*/ */
fun readKobaltPluginXml(): PluginInfo { fun readKobaltPluginXml(): PluginInfo {
// Note: use forward slash here since we're looking up this file in a .jar file // Note: use forward slash here since we're looking up this file in a .jar file
val url = Kobalt::class.java.classLoader.getResource(PLUGIN_XML) val url = Kobalt::class.java.classLoader.getResource(PLUGIN_CORE_XML)
log(2, "URL for core kobalt-plugin.xml: $url") log(2, "URL for core kobalt-plugin.xml: $url")
if (url != null) { if (url != null) {
return readPluginXml(url.openConnection().inputStream) return readPluginXml(url.openConnection().inputStream)
@ -106,7 +111,7 @@ class PluginInfo(val xml: KobaltPluginXml, val classLoader: ClassLoader?) {
val jaxbContext = JAXBContext.newInstance(KobaltPluginXml::class.java) val jaxbContext = JAXBContext.newInstance(KobaltPluginXml::class.java)
val kotlinPlugin: KobaltPluginXml = jaxbContext.createUnmarshaller().unmarshal(ins) val kotlinPlugin: KobaltPluginXml = jaxbContext.createUnmarshaller().unmarshal(ins)
as KobaltPluginXml as KobaltPluginXml
log(2, "Parsed plugin-info.xml, found: " + kotlinPlugin.name) log(2, "Parsed plugin XML file, found: " + kotlinPlugin.name)
return PluginInfo(kotlinPlugin, classLoader) return PluginInfo(kotlinPlugin, classLoader)
} }