mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Warnings.
This commit is contained in:
parent
b5d8e23d8e
commit
6853e1992c
1 changed files with 6 additions and 5 deletions
|
@ -12,6 +12,7 @@ import com.beust.kobalt.misc.KFiles
|
||||||
import com.beust.kobalt.misc.KobaltExecutors
|
import com.beust.kobalt.misc.KobaltExecutors
|
||||||
import com.beust.kobalt.misc.log
|
import com.beust.kobalt.misc.log
|
||||||
import com.beust.kobalt.plugin.DefaultPlugin
|
import com.beust.kobalt.plugin.DefaultPlugin
|
||||||
|
import com.beust.kobalt.plugin.android.AndroidPlugin
|
||||||
import com.beust.kobalt.plugin.java.JavaPlugin
|
import com.beust.kobalt.plugin.java.JavaPlugin
|
||||||
import com.beust.kobalt.plugin.kotlin.KotlinPlugin
|
import com.beust.kobalt.plugin.kotlin.KotlinPlugin
|
||||||
import com.beust.kobalt.plugin.packaging.PackagingPlugin
|
import com.beust.kobalt.plugin.packaging.PackagingPlugin
|
||||||
|
@ -82,7 +83,7 @@ public class Plugins @Inject constructor (val taskManagerProvider : Provider<Tas
|
||||||
|
|
||||||
val defaultPlugin : Plugin get() = findPlugin(DefaultPlugin.NAME)!!
|
val defaultPlugin : Plugin get() = findPlugin(DefaultPlugin.NAME)!!
|
||||||
|
|
||||||
public fun findPlugin(name: String) : Plugin? = pluginMap.get(name)
|
public fun findPlugin(name: String) : Plugin? = pluginMap[name]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun applyPlugins(context: KobaltContext, projects: List<Project>) {
|
fun applyPlugins(context: KobaltContext, projects: List<Project>) {
|
||||||
|
@ -173,11 +174,11 @@ public class Plugins @Inject constructor (val taskManagerProvider : Provider<Tas
|
||||||
|
|
||||||
public fun instantiateClassName(classLoader: ClassLoader, className : String) : Class<*> {
|
public fun instantiateClassName(classLoader: ClassLoader, className : String) : Class<*> {
|
||||||
try {
|
try {
|
||||||
log(2, "Instantiating ${className}")
|
log(2, "Instantiating $className")
|
||||||
return classLoader.loadClass(className)
|
return classLoader.loadClass(className)
|
||||||
} catch(ex: Exception) {
|
} catch(ex: Exception) {
|
||||||
val urls = Arrays.toString((classLoader as URLClassLoader).urLs)
|
val urls = Arrays.toString((classLoader as URLClassLoader).urLs)
|
||||||
val message = "Couldn't instantiate ${className}\n with classLoader $urls: ${ex}"
|
val message = "Couldn't instantiate $className\n with classLoader $urls: $ex"
|
||||||
println(message)
|
println(message)
|
||||||
throw KobaltException(message)
|
throw KobaltException(message)
|
||||||
}
|
}
|
||||||
|
@ -211,13 +212,13 @@ public class Plugins @Inject constructor (val taskManagerProvider : Provider<Tas
|
||||||
val manifest = jis.manifest
|
val manifest = jis.manifest
|
||||||
val mainClass = manifest.mainAttributes.getValue(Plugins.MANIFEST_PLUGIN_CLASS) ?:
|
val mainClass = manifest.mainAttributes.getValue(Plugins.MANIFEST_PLUGIN_CLASS) ?:
|
||||||
throw KobaltException("Couldn't find \"${Plugins.MANIFEST_PLUGIN_CLASS}\" in the " +
|
throw KobaltException("Couldn't find \"${Plugins.MANIFEST_PLUGIN_CLASS}\" in the " +
|
||||||
"manifest of ${it}")
|
"manifest of $it")
|
||||||
|
|
||||||
val pluginClassName = mainClass.removeSuffix(" ")
|
val pluginClassName = mainClass.removeSuffix(" ")
|
||||||
val c = instantiateClassName(classLoader, pluginClassName)
|
val c = instantiateClassName(classLoader, pluginClassName)
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
Plugins.addPlugin(c as Class<BasePlugin>)
|
Plugins.addPlugin(c as Class<BasePlugin>)
|
||||||
log(1, "Added plugin ${c}")
|
log(1, "Added plugin $c")
|
||||||
} finally {
|
} finally {
|
||||||
jis?.close()
|
jis?.close()
|
||||||
fis?.close()
|
fis?.close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue