[jps-to-bazel] Add exported dependencies for tests in DependencyKt#addDep (IJI-2835)

GitOrigin-RevId: 75c0313645624d17a58b5856b1ce18df67d73b3c
This commit is contained in:
Ilia Kirianovskii
2025-08-20 10:24:47 +00:00
committed by intellij-monorepo-bot
parent bfb668b494
commit a04ed1785d
@@ -286,16 +286,25 @@ private fun addDep(
when (scope) {
JpsJavaDependencyScope.COMPILE -> {
deps.add(dependencyLabel)
if (isExported) { // e.g. //debugger/intellij.java.debugger.rpc.tests:java-debugger-rpc-tests_test_lib
exports.add(dependencyLabel)
}
if (dependencyModuleDescriptor != null && !dependencyModuleDescriptor.testSources.isEmpty()) {
if (needsBackwardCompatibleTestDependency(dependencyModuleDescriptor.module.name, dependentModule)) {
deps.add(getLabelForTest(dependencyLabel))
if (isExported) { // e.g. //CIDR-appcode/appcode-coverage:appcode-coverage_test_lib
exports.add(getLabelForTest(dependencyLabel))
}
}
}
}
JpsJavaDependencyScope.TEST, JpsJavaDependencyScope.PROVIDED -> {
if (dependencyModuleDescriptor == null) {
deps.add(dependencyLabel)
if (isExported) { // e.g. //python/junit5Tests:junit5Tests_test_lib
exports.add(dependencyLabel)
}
}
else {
if (hasOnlyTestResources(dependencyModuleDescriptor)) {
@@ -314,9 +323,15 @@ private fun addDep(
if (!dependencyModuleDescriptor.sources.isEmpty() || !hasTestSource) {
deps.add(dependencyLabel)
if (isExported) { // e.g. @community//python/python-venv:community-impl-venv_test_lib
exports.add(dependencyLabel)
}
}
if (hasTestSource) {
deps.add(getLabelForTest(dependencyLabel))
if (isExported) { // e.g. //remote-dev/cwm-guest/plugins/java-frontend:java-frontend-split_test_lib
exports.add(getLabelForTest(dependencyLabel))
}
}
}
}