-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Config loader always loads configs for all the available roles (#2021)
This fixes issues with ConfigWriter and run-all meta-roles caused by axis defined in role-local configs
- Loading branch information
Showing
5 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
distage/distage-framework/.jvm/src/test/resources/testrole05-reference.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
activation { | ||
role05localaxis = rolelocal1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
.../distage-framework/.jvm/src/test/scala/izumi/distage/roles/test/fixtures/TestRole05.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package izumi.distage.roles.test.fixtures | ||
|
||
import distage.{Axis, ModuleDef} | ||
import izumi.distage.config.ConfigModuleDef | ||
import izumi.distage.model.definition.Lifecycle | ||
import izumi.distage.roles.model.{RoleDescriptor, RoleService} | ||
import izumi.distage.roles.model.definition.RoleModuleDef | ||
import izumi.distage.roles.test.fixtures.TestRole05.{TestRole05Dependency, TestRole05DependencyImpl1} | ||
import izumi.functional.quasi.QuasiIO | ||
import izumi.fundamentals.platform.cli.model.raw.RawEntrypointParams | ||
import izumi.reflect.TagK | ||
|
||
class TestRole05[F[_] : QuasiIO]( | ||
dependency: TestRole05Dependency | ||
) extends RoleService[F] { | ||
override def start(roleParameters: RawEntrypointParams, freeArgs: Vector[String]): Lifecycle[F, Unit] = Lifecycle.make(QuasiIO[F].maybeSuspend { | ||
assert(dependency.isInstanceOf[TestRole05DependencyImpl1]) | ||
}) { | ||
_ => | ||
QuasiIO[F].unit | ||
} | ||
} | ||
|
||
object TestRole05 extends RoleDescriptor { | ||
override final val id = "testrole05" | ||
|
||
trait TestRole05Dependency | ||
|
||
class TestRole05DependencyImpl1 extends TestRole05Dependency | ||
|
||
class TestRole05DependencyImpl2 extends TestRole05Dependency | ||
|
||
object Role05LocalAxis extends Axis { | ||
case object Rolelocal2 extends AxisChoiceDef | ||
|
||
case object Rolelocal1 extends AxisChoiceDef | ||
} | ||
|
||
class Role05Module[F[_] : TagK] extends ModuleDef with ConfigModuleDef with RoleModuleDef { | ||
makeRole[TestRole05[F]] | ||
make[TestRole05Dependency].from[TestRole05DependencyImpl1].tagged(Role05LocalAxis.Rolelocal1) | ||
make[TestRole05Dependency].from[TestRole05DependencyImpl2].tagged(Role05LocalAxis.Rolelocal2) | ||
} | ||
|
||
} |