KTIJ-33763 [kotlin] Collect test dependencies for production modules in case productionOnTest flag is enabled

We assume that `productionOnTest` flag
is only relevant for dependencies
with `COMPILE` or `PROVIDED` scope.

For `TEST` scope, setting this flag
should not be possible and should
not change anything.

^KTIJ-33763 Fixed

GitOrigin-RevId: 176b29e80f07ac9c4e861a988758ba0bf81b1427
This commit is contained in:
Roman Golyshev
2025-04-11 13:39:26 +02:00
committed by intellij-monorepo-bot
parent 7d24dca19c
commit c8462e7bdf
3 changed files with 11 additions and 2 deletions

View File

@@ -179,7 +179,13 @@ internal class KaSourceModuleDependenciesProvider(private val project: Project)
when (scope) {
DependencyScope.COMPILE, DependencyScope.PROVIDED -> {
to.addIfNotNull(module.toKaSourceModule(project, KaSourceModuleKind.PRODUCTION))
if (kind == KaSourceModuleKind.TEST) {
val dependsOnTest = when (kind) {
KaSourceModuleKind.PRODUCTION -> productionOnTest
KaSourceModuleKind.TEST -> true
}
if (dependsOnTest) {
to.addIfNotNull(module.toKaSourceModule(project, KaSourceModuleKind.TEST))
}
}

View File

@@ -14,6 +14,7 @@ graph TD
style KaSourceModule_5 fill:#608BC1
style KaSourceModule_6 fill:#31511E
KaSourceModule_1 --> KaSourceModule_3
KaSourceModule_1 --> KaSourceModule_4
KaSourceModule_2 --> KaSourceModule_1
KaSourceModule_2 --> KaSourceModule_3
KaSourceModule_2 --> KaSourceModule_4
@@ -32,6 +33,7 @@ graph TD
linkStyle 5 stroke:black
linkStyle 6 stroke:black
linkStyle 7 stroke:black
linkStyle 8 stroke:#E6C767
linkStyle 8 stroke:black
linkStyle 9 stroke:#E6C767
linkStyle 10 stroke:#E6C767
linkStyle 11 stroke:#E6C767

View File

@@ -18,6 +18,7 @@ KaSourceModule:
stableModuleName: <A>
regularDependencies:
KaSourceModule(B, production)
KaSourceModule(B, test)
friendDependencies:
<empty>
dependsOnDependencies: