IJPL-217708 owner should always be provided for ProjectLibraryData

GitOrigin-RevId: 97e6a76d2497a3e15b0771982e40be3e2c5d4fa8
This commit is contained in:
Nikolay Rykunov
2025-11-13 19:08:19 +00:00
committed by intellij-monorepo-bot
parent cd3a23c36d
commit f63fa1cbad
6 changed files with 22 additions and 15 deletions
@@ -8,6 +8,7 @@ import kotlinx.collections.immutable.persistentListOf
import org.jetbrains.intellij.build.dependencies.BuildDependenciesDownloader
import org.jetbrains.intellij.build.impl.BundledMavenDownloader
import org.jetbrains.intellij.build.impl.LibraryPackMode
import org.jetbrains.intellij.build.impl.ModuleItem
import org.jetbrains.intellij.build.impl.PluginLayout
import org.jetbrains.intellij.build.impl.PluginLayout.Companion.plugin
import org.jetbrains.intellij.build.impl.PluginLayout.Companion.pluginAuto
@@ -38,7 +39,7 @@ object CommunityRepositoryModules {
spec.withModule("intellij.ant.jps", "ant-jps.jar")
spec.withGeneratedResources { dir, buildContext ->
copyAnt(pluginDir = dir, context = buildContext)
copyAnt(mainModule = spec.mainModule, pluginDir = dir, context = buildContext)
}
},
plugin("intellij.laf.macos") { spec ->
@@ -662,11 +663,13 @@ object CommunityRepositoryModules {
}
}
private suspend fun copyAnt(pluginDir: Path, context: BuildContext): List<DistributionFileEntry> {
private suspend fun copyAnt(mainModule: String, pluginDir: Path, context: BuildContext): List<DistributionFileEntry> {
val antDir = pluginDir.resolve("dist")
return spanBuilder("copy Ant lib").setAttribute("antDir", antDir.toString()).use {
val sources = ArrayList<ZipSource>()
val libraryData = ProjectLibraryData(libraryName = "Ant", packMode = LibraryPackMode.STANDALONE_MERGED, reason = "ant")
val antTargetFile = antDir.resolve("ant.jar")
val antModuleItem = ModuleItem(mainModule, relativeOutputFile = antTargetFile.fileName.toString(), reason = "ant")
val libraryData = ProjectLibraryData(libraryName = "Ant", packMode = LibraryPackMode.STANDALONE_MERGED, reason = "ant", owner = antModuleItem)
copyDir(
sourceDir = context.paths.communityHomeDir.resolve("lib/ant"),
targetDir = antDir,
@@ -683,7 +686,6 @@ private suspend fun copyAnt(pluginDir: Path, context: BuildContext): List<Distri
)
sources.sort()
val antTargetFile = antDir.resolve("ant.jar")
checkForNoDiskSpace(context) {
buildJar(targetFile = antTargetFile, sources = sources)
}
@@ -144,7 +144,7 @@ sealed class BaseLayout {
}
fun withProjectLibrary(libraryName: String, jarName: String, reason: String? = null) {
includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, outPath = jarName, reason = reason))
includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, outPath = jarName, reason = reason, owner = null))
}
fun excludeFromModule(moduleName: String, excludedPattern: String) {
@@ -160,17 +160,17 @@ sealed class BaseLayout {
}
fun withProjectLibrary(libraryName: String) {
includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, reason = "withProjectLibrary"))
includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, reason = "withProjectLibrary", owner = null))
}
internal fun withProjectLibraries(libraryNames: Sequence<String>, outPath: String? = null) {
for (libraryName in libraryNames) {
includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, reason = "withProjectLibrary", outPath = outPath))
includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, reason = "withProjectLibrary", outPath = outPath, owner = null))
}
}
fun withProjectLibrary(libraryName: String, packMode: LibraryPackMode) {
includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, packMode = packMode, reason = "withProjectLibrary"))
includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, packMode = packMode, reason = "withProjectLibrary", owner = null))
}
/**
@@ -41,15 +41,18 @@ sealed class BaseLayoutSpec(private val layout: BaseLayout) {
}
fun withProjectLibrary(libraryName: String, outPath: String) {
layout.includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, outPath = outPath, reason = "withProjectLibrary"))
// TODO: owner shouldn't be null in case of PluginLayoutSpec?
layout.includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, outPath = outPath, reason = "withProjectLibrary", owner = null))
}
fun withProjectLibrary(libraryName: String, packMode: LibraryPackMode) {
layout.includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, packMode = packMode, reason = "withProjectLibrary"))
// TODO: owner shouldn't be null in case of PluginLayoutSpec?
layout.includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, packMode = packMode, reason = "withProjectLibrary", owner = null))
}
fun withProjectLibrary(libraryName: String, outPath: String, packMode: LibraryPackMode) {
layout.includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, packMode = packMode, outPath = outPath, reason = "withProjectLibrary"))
// TODO: owner shouldn't be null in case of PluginLayoutSpec?
layout.includedProjectLibraries.add(ProjectLibraryData(libraryName = libraryName, packMode = packMode, outPath = outPath, reason = "withProjectLibrary", owner = null))
}
/**
@@ -469,7 +469,7 @@ class JarPackager private constructor(
projectLibraryData = ProjectLibraryData(libraryName = libName, owner = item, reason = null)
}
else {
projectLibraryData = ProjectLibraryData(libraryName = libName, reason = "<- $moduleName")
projectLibraryData = ProjectLibraryData(libraryName = libName, reason = "<- $moduleName", owner = item)
}
}
else if (platformLayout != null && platformLayout.isLibraryAlwaysPackedIntoPlugin(libName)) {
@@ -481,7 +481,7 @@ class JarPackager private constructor(
continue
}
projectLibraryData = ProjectLibraryData(libraryName = libName, reason = "<- $moduleName (always packed into plugin)")
projectLibraryData = ProjectLibraryData(libraryName = libName, reason = "<- $moduleName (always packed into plugin)", owner = item)
}
else {
continue
@@ -320,6 +320,7 @@ internal suspend fun createPlatformLayout(projectLibrariesUsedByPlugins: SortedS
libraryName = libName,
packMode = PLATFORM_CUSTOM_PACK_MODE.getOrDefault(libName, LibraryPackMode.MERGED),
reason = "<- ${module.name}",
owner = null,
)
)
.dependentModules.computeIfAbsent("core") { mutableListOf() }.add(module.name)
@@ -424,7 +425,8 @@ internal fun computeProjectLibsUsedByPlugins(enabledPluginModules: Set<String>,
}
val packMode = PLATFORM_CUSTOM_PACK_MODE.getOrDefault(libName, LibraryPackMode.MERGED)
result.addOrGet(ProjectLibraryData(libraryName = libName, packMode = packMode, reason = "<- $moduleName"))
// TODO: owner is null in this case? Since it is loaded by platform
result.addOrGet(ProjectLibraryData(libraryName = libName, packMode = packMode, reason = "<- $moduleName", owner = null))
.dependentModules
.computeIfAbsent(plugin.directoryName) { mutableListOf() }
.add(moduleName)
@@ -18,7 +18,7 @@ class ProjectLibraryData(
@JvmField val libraryName: String,
@JvmField val packMode: LibraryPackMode = LibraryPackMode.STANDALONE_MERGED,
@JvmField val reason: String?,
@JvmField val owner: ModuleItem? = null,
@JvmField val owner: ModuleItem?,
@JvmField val outPath: String? = null,
) {
init {