Skip to content

Commit

Permalink
Restore restriction on PluginDefs only in PluginConfig.const, add `…
Browse files Browse the repository at this point in the history
…PluginConfig.constUnchecked` accepting ModuleDefs
  • Loading branch information
neko-kai committed Nov 1, 2023
1 parent 9d345f3 commit d8c7c16
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,23 @@ object PluginConfig extends PluginConfigStatic {
def packages(packagesEnabled: Seq[String]): PluginConfig = PluginConfig(packagesEnabled, Nil, cachePackages = false, debug = false, Nil, Nil)
def packagesThisPkg(implicit pkg: SourcePackageMaterializer): PluginConfig = packages(pkg.get.pkg)

/** Create a [[PluginConfig]] that simply contains the specified modules */
def const(plugins: Seq[ModuleBase]): PluginConfig = PluginConfig(Nil, Nil, cachePackages = false, debug = false, plugins, Nil)
/** Create a [[PluginConfig]] that simply contains the specified plugins */
def const(plugins: Seq[PluginBase]): PluginConfig = PluginConfig(Nil, Nil, cachePackages = false, debug = false, plugins, Nil)

/** Create a [[PluginConfig]] that simply contains the specified modules */
def const(plugin: ModuleBase): PluginConfig = const(Seq(plugin))
/** Create a [[PluginConfig]] that simply contains the specified plugin */
def const(plugin: PluginBase): PluginConfig = const(Seq(plugin))

/**
* Like [[const]], but accepts simple [[ModuleBase]].
* Unlike for inheritors of [[PluginDef]], changing a ModuleDef source code may not trigger recompilation of compile-time checks
*/
def constUnchecked(modules: Seq[ModuleBase]): PluginConfig = PluginConfig(Nil, Nil, cachePackages = false, debug = false, modules, Nil)

/**
* Like [[const]], but accepts simple [[ModuleBase]].
* Unlike for inheritors of [[PluginDef]], changing a ModuleDef source code may not trigger recompilation of compile-time checks
*/
def constUnchecked(module: ModuleBase): PluginConfig = constUnchecked(Seq(module))

/** A [[PluginConfig]] that returns no plugins */
lazy val empty: PluginConfig = const(Nil)
Expand Down

0 comments on commit d8c7c16

Please sign in to comment.