From d8c7c16bd71ba5dbc06bfa4c9fac86b5c047c8bc Mon Sep 17 00:00:00 2001 From: Kai <450507+neko-kai@users.noreply.github.com> Date: Wed, 1 Nov 2023 18:23:21 +0000 Subject: [PATCH] Restore restriction on PluginDefs only in `PluginConfig.const`, add `PluginConfig.constUnchecked` accepting ModuleDefs --- .../izumi/distage/plugins/PluginConfig.scala | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/distage/distage-extension-plugins/src/main/scala/izumi/distage/plugins/PluginConfig.scala b/distage/distage-extension-plugins/src/main/scala/izumi/distage/plugins/PluginConfig.scala index 5ade906530..63be22fd3a 100644 --- a/distage/distage-extension-plugins/src/main/scala/izumi/distage/plugins/PluginConfig.scala +++ b/distage/distage-extension-plugins/src/main/scala/izumi/distage/plugins/PluginConfig.scala @@ -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)