From 2399761dbab4c35b80bcfda0b27cfa103bbe5b56 Mon Sep 17 00:00:00 2001 From: Ilia Kirianovskii Date: Sat, 3 Jan 2026 17:37:36 +0100 Subject: [PATCH] [jps-to-bazel] Use project library name if non-repository in DependencyKt#generateDeps (IJI-3419) GitOrigin-RevId: 6573561268bb246594fe0187f6e85073ff8c30c9 --- .../org/jetbrains/intellij/build/bazel/dependency.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/platform/build-scripts/bazel/src/org/jetbrains/intellij/build/bazel/dependency.kt b/platform/build-scripts/bazel/src/org/jetbrains/intellij/build/bazel/dependency.kt index 022f9f9415f9..94c59556a307 100644 --- a/platform/build-scripts/bazel/src/org/jetbrains/intellij/build/bazel/dependency.kt +++ b/platform/build-scripts/bazel/src/org/jetbrains/intellij/build/bazel/dependency.kt @@ -185,13 +185,21 @@ internal fun generateDeps( val isCommunityLib = firstFile.startsWith(context.communityRoot) val libraryContainer = context.getLibraryContainer(isCommunityLib) + val isModuleLibrary = element.libraryReference.parentReference is JpsModuleReference val targetName = if (underKotlinSnapshotLibRoot(firstFile, communityRoot = context.communityRoot)) { // name the same way as a maven library, so there will be minimal changes // migrating from kotlin from maven to kotlin from a snapshot escapeBazelLabel(jpsLibrary.name) } + else if (isModuleLibrary) { + val moduleRef = element.libraryReference.parentReference as JpsModuleReference + val name = jpsLibrary.name.takeIf { !it.startsWith("#") && it.isNotEmpty() } ?: firstFile.nameWithoutExtension + camelToSnakeCase(escapeBazelLabel("${moduleRef.moduleName.removePrefix("intellij.")}-${name}")) + } else { - camelToSnakeCase(escapeBazelLabel(firstFile.nameWithoutExtension)) + // name the same way as the project library, + // otherwise hibernate-3.6.10 and hibernate-4.1.3 will use the same identity dom4j-1-6-1 thus only one of them will be added to projectLibraries + camelToSnakeCase(escapeBazelLabel(jpsLibrary.name)) } val libraryTarget = LibraryTarget(