From b8dc8eb715995a27426286f51e142d0afe2036b7 Mon Sep 17 00:00:00 2001 From: Ilia Kirianovskii Date: Mon, 15 Sep 2025 12:38:44 +0200 Subject: [PATCH] [build-scripts] Use kotlinx-serialization (not gson library) in ArchivedCompilationContextUtil (IJI-3011) Also converts ArchivedCompilationContextUtil.java file to ArchivedCompilationContextUtil.kt file. GitOrigin-RevId: 2e08a242bda539415467d17ae86e01140e84ce9d --- .../tools/launch/ide/ClassPathBuilder.kt | 4 +- .../impl/BuildProcessClasspathManager.kt | 2 +- .../build/impl/ModuleStructureValidator.kt | 2 +- .../build/impl/compilation/CompiledClasses.kt | 2 +- .../ide/plugins/PluginDescriptorLoader.kt | 2 +- .../intellij/ide/plugins/PluginManagerCore.kt | 2 +- .../execution/eel/JavaMainClassExecutor.kt | 8 +- .../tests/MonorepoProjectStructure.kt | 6 +- platform/util/BUILD.bazel | 1 - platform/util/intellij.platform.util.iml | 1 - .../ArchivedCompilationContextUtil.java | 136 ------------------ .../ArchivedCompilationContextUtil.kt | 124 ++++++++++++++++ .../testSrc/LibrariesRequiredForWorkspace.kt | 2 +- .../jetbrains/idea/maven/utils/MavenUtil.kt | 4 +- 14 files changed, 141 insertions(+), 155 deletions(-) delete mode 100644 platform/util/src/com/intellij/openapi/application/ArchivedCompilationContextUtil.java create mode 100644 platform/util/src/com/intellij/openapi/application/ArchivedCompilationContextUtil.kt diff --git a/build/launch/src/com/intellij/tools/launch/ide/ClassPathBuilder.kt b/build/launch/src/com/intellij/tools/launch/ide/ClassPathBuilder.kt index a4ae79d06042..8dd49ececa87 100644 --- a/build/launch/src/com/intellij/tools/launch/ide/ClassPathBuilder.kt +++ b/build/launch/src/com/intellij/tools/launch/ide/ClassPathBuilder.kt @@ -66,7 +66,7 @@ class ClassPathBuilder(private val paths: PathsProvider, private val modulesToSc JpsProjectLoader.loadProject(model.project, pathVariables, paths.sourcesRootFolder.toPath()) val productionOutput = paths.outputRootFolder.resolve("production") - if (!productionOutput.isDirectory && ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() == null) { + if (!productionOutput.isDirectory && ArchivedCompilationContextUtil.archivedCompiledClassesMapping == null) { error("Production classes output directory is missing: $productionOutput") } @@ -113,7 +113,7 @@ class ClassPathBuilder(private val paths: PathsProvider, private val modulesToSc } private fun Collection.replaceWithArchivedIfNeeded(): Collection { - val mapping = ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() ?: return this + val mapping = ArchivedCompilationContextUtil.archivedCompiledClassesMapping ?: return this return flatMap { path -> if (Files.isRegularFile(path)) listOf(path) // path is absolute, mapping contains only the last two path elements diff --git a/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.kt b/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.kt index 82c7f8adad7c..d6ac0ebb875d 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.kt +++ b/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.kt @@ -159,7 +159,7 @@ private fun findClassesRoots(relativePath: String, plugin: IdeaPluginDescriptor, val fileName = FileUtilRt.getNameWithoutExtension(PathUtilRt.getFileName(relativePath)) //try restoring module name from JAR name automatically generated by BaseLayout.convertModuleNameToFileName val moduleName = if (relativePath.startsWith("modules/")) fileName else "intellij." + fileName.replace('-', '.') - val mapping = ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() + val mapping = ArchivedCompilationContextUtil.archivedCompiledClassesMapping if (mapping != null) { // baseFile is ".../idea-compile-parts-v2/production//" // We should take ".../idea-compile-parts-v2/production//.jar" diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/ModuleStructureValidator.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/ModuleStructureValidator.kt index 2da59ebc1e94..3efd107add11 100644 --- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/ModuleStructureValidator.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/ModuleStructureValidator.kt @@ -323,7 +323,7 @@ class ModuleStructureValidator(private val context: BuildContext, private val al * Works both when module output is located in a directory and when it's packed in a JAR. */ private fun JpsModule.processProductionOutput(processor: (outputRoots: List) -> T): T { - val archivedCompiledClassesMapping = ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() + val archivedCompiledClassesMapping = ArchivedCompilationContextUtil.archivedCompiledClassesMapping val outputJarPaths = archivedCompiledClassesMapping?.get("production/$name") if (outputJarPaths == null) { val outputDirectoryPath = JpsJavaExtensionService.getInstance().getOutputDirectoryPath(this, false) diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/compilation/CompiledClasses.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/compilation/CompiledClasses.kt index 61443e5e5d86..8cf089f6f945 100644 --- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/compilation/CompiledClasses.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/compilation/CompiledClasses.kt @@ -129,7 +129,7 @@ internal suspend fun reuseOrCompile(context: CompilationContext, moduleNames: Co val pathToCompiledClassArchiveMetadata = context.options.pathToCompiledClassesArchivesMetadata when { context.options.useCompiledClassesFromProjectOutput -> { - check(isBazelTestRun() || context.classesOutputDirectory.exists() || ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() != null || isRunningFromBazelOut()) { + check(isBazelTestRun() || context.classesOutputDirectory.exists() || ArchivedCompilationContextUtil.archivedCompiledClassesMapping != null || isRunningFromBazelOut()) { "${BuildOptions.USE_COMPILED_CLASSES_PROPERTY} is enabled but the classes output directory ${context.classesOutputDirectory} doesn't exist" } val production = context.classesOutputDirectory.resolve("production") diff --git a/platform/core-impl/src/com/intellij/ide/plugins/PluginDescriptorLoader.kt b/platform/core-impl/src/com/intellij/ide/plugins/PluginDescriptorLoader.kt index 832db8cb3425..985a5a96ac79 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/PluginDescriptorLoader.kt +++ b/platform/core-impl/src/com/intellij/ide/plugins/PluginDescriptorLoader.kt @@ -1244,7 +1244,7 @@ private fun loadDescriptorFromResource( closeable = resolver as? Closeable val loader = ImmutableZipFileDataLoader(resolver = resolver, zipPath = file) - val relevantJarsRoot = ArchivedCompilationContextUtil.getArchivedCompiledClassesLocation() + val relevantJarsRoot = ArchivedCompilationContextUtil.archivedCompiledClassesLocation if (pathResolver.isRunningFromSourcesWithoutDevBuild || (relevantJarsRoot != null && file.startsWith(relevantJarsRoot))) { // support for archived compile outputs (each module in a separate jar) basePath = file.parent diff --git a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.kt b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.kt index d20ea01cfb7e..12fcc295504c 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.kt +++ b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.kt @@ -1010,7 +1010,7 @@ fun getPluginDistDirByClass(aClass: Class<*>): Path? { val jarInsideLib = PathManager.getJarForClass(aClass) ?: error("Can't find plugin dist home for ${aClass.simpleName}") if (jarInsideLib.fileName.toString().endsWith("jar", ignoreCase = true)) { - ArchivedCompilationContextUtil.getArchivedCompiledClassesLocation()?.let { + ArchivedCompilationContextUtil.archivedCompiledClassesLocation?.let { if (jarInsideLib.startsWith(it)) return null } return jarInsideLib diff --git a/platform/platform-tests/testSrc/com/intellij/execution/eel/JavaMainClassExecutor.kt b/platform/platform-tests/testSrc/com/intellij/execution/eel/JavaMainClassExecutor.kt index f82f14342eea..2162e2c30069 100644 --- a/platform/platform-tests/testSrc/com/intellij/execution/eel/JavaMainClassExecutor.kt +++ b/platform/platform-tests/testSrc/com/intellij/execution/eel/JavaMainClassExecutor.kt @@ -80,7 +80,7 @@ internal class JavaMainClassExecutor(clazz: Class<*>, vararg args: String) { private fun getJpsModuleNameForClass(clazz: Class<*>): String { val jarPathForClass = PathUtil.getJarPathForClass(clazz) val path = Path.of(jarPathForClass) - val relevantJarsRoot = ArchivedCompilationContextUtil.getArchivedCompiledClassesLocation() + val relevantJarsRoot = ArchivedCompilationContextUtil.archivedCompiledClassesLocation if (Files.isDirectory(path)) { // plain compilation output @@ -88,7 +88,7 @@ internal class JavaMainClassExecutor(clazz: Class<*>, vararg args: String) { } else if (relevantJarsRoot != null && jarPathForClass.startsWith(relevantJarsRoot)) { // archived compilation output - val mapping = ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() + val mapping = ArchivedCompilationContextUtil.archivedCompiledClassesMapping checkNotNull(mapping) { "Mapping cannot be null at this point" } val key = mapping.entries.firstOrNull { (_, value) -> value.contains(jarPathForClass) }?.key if (key == null) { @@ -105,7 +105,7 @@ internal class JavaMainClassExecutor(clazz: Class<*>, vararg args: String) { private fun getJpsModulesOutput(clazz: Class<*>, moduleNames: List<@NlsSafe String>): List { val jarPathForClass = PathUtil.getJarPathForClass(clazz) val path = Path.of(jarPathForClass) - val relevantJarsRoot = ArchivedCompilationContextUtil.getArchivedCompiledClassesLocation() + val relevantJarsRoot = ArchivedCompilationContextUtil.archivedCompiledClassesLocation if (Files.isDirectory(path)) { // plain compilation output @@ -113,7 +113,7 @@ internal class JavaMainClassExecutor(clazz: Class<*>, vararg args: String) { } else if (relevantJarsRoot != null && jarPathForClass.startsWith(relevantJarsRoot)) { // archived compilation output, assume we need 'production' output - val mapping = ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() + val mapping = ArchivedCompilationContextUtil.archivedCompiledClassesMapping checkNotNull(mapping) { "Mapping cannot be null at this point" } return moduleNames.flatMap { val key = "production/$it" diff --git a/platform/testFramework/monorepo/tests/MonorepoProjectStructure.kt b/platform/testFramework/monorepo/tests/MonorepoProjectStructure.kt index b199ac889ef9..129878b2ec7e 100644 --- a/platform/testFramework/monorepo/tests/MonorepoProjectStructure.kt +++ b/platform/testFramework/monorepo/tests/MonorepoProjectStructure.kt @@ -37,7 +37,7 @@ fun JpsModule.hasProductionSources(): Boolean = getSourceRoots(JavaSourceRootTyp * Works both when module output is located in a directory and when it's packed in JARs. */ fun JpsModule.processProductionOutputs(processor: (outputRoots: List) -> T): T { - val archivedCompiledClassesMapping = ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() + val archivedCompiledClassesMapping = ArchivedCompilationContextUtil.archivedCompiledClassesMapping val outputJarPaths = archivedCompiledClassesMapping?.get("production/$name") if (outputJarPaths == null) { val outputDirectoryPath = JpsJavaExtensionService.getInstance().getOutputDirectoryPath(this, false) @@ -58,7 +58,7 @@ fun JpsModule.processProductionOutputs(processor: (outputRoots: List) val JpsModule.productionOutputPaths: List get() { - val archivedCompiledClassesMapping = ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() + val archivedCompiledClassesMapping = ArchivedCompilationContextUtil.archivedCompiledClassesMapping val outputJarPath = archivedCompiledClassesMapping?.get("production/$name") return outputJarPath?.map(Path::of) ?: listOf(JpsJavaExtensionService.getInstance().getOutputDirectoryPath(this, false) ?: error("Output directory is not specified for '$name'")) @@ -66,7 +66,7 @@ val JpsModule.productionOutputPaths: List val JpsModule.testOutputPaths: List get() { - val archivedCompiledClassesMapping = ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() + val archivedCompiledClassesMapping = ArchivedCompilationContextUtil.archivedCompiledClassesMapping val outputJarPath = archivedCompiledClassesMapping?.get("test/$name") return outputJarPath?.map(Path::of) ?: listOf(JpsJavaExtensionService.getInstance().getOutputDirectoryPath(this, true) ?: error("Test output directory is not specified for '$name'")) diff --git a/platform/util/BUILD.bazel b/platform/util/BUILD.bazel index b93ae4718e87..4f2d01519c51 100644 --- a/platform/util/BUILD.bazel +++ b/platform/util/BUILD.bazel @@ -38,7 +38,6 @@ jvm_library( "@lib//:kotlinx-serialization-json", "//platform/util/coroutines", "//platform/util/multiplatform", - "@lib//:gson", ":platform_util_troveCompileOnly_provided", ], exports = [ diff --git a/platform/util/intellij.platform.util.iml b/platform/util/intellij.platform.util.iml index cf985f6b5818..85fd8eceaa2d 100644 --- a/platform/util/intellij.platform.util.iml +++ b/platform/util/intellij.platform.util.iml @@ -47,7 +47,6 @@ - diff --git a/platform/util/src/com/intellij/openapi/application/ArchivedCompilationContextUtil.java b/platform/util/src/com/intellij/openapi/application/ArchivedCompilationContextUtil.java deleted file mode 100644 index 779b840c84a3..000000000000 --- a/platform/util/src/com/intellij/openapi/application/ArchivedCompilationContextUtil.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.intellij.openapi.application; - -import com.google.gson.Gson; -import com.intellij.openapi.util.text.StringUtilRt; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.UnmodifiableView; - -import java.io.BufferedReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@ApiStatus.Internal -public class ArchivedCompilationContextUtil { - private static Map> ourArchivedCompiledClassesMapping; - - /** - * NB: actual jars might be in subdirectories - */ - public static @Nullable String getArchivedCompiledClassesLocation() { - String relevantJarsRoot = System.getProperty("intellij.test.jars.location"); - if (relevantJarsRoot != null) { - return relevantJarsRoot; - } - - relevantJarsRoot = getArchivedCompiledClassesLocationIfIsRunningFromBazelOut(); - boolean isRunningFromBazelOut = relevantJarsRoot != null; - if (isRunningFromBazelOut) { - return relevantJarsRoot; - } - - return null; - } - - private static @Nullable String getArchivedCompiledClassesLocationIfIsRunningFromBazelOut() { - String utilJar = PathManager.getJarPathForClass(PathManager.class); - String bazelOutPattern = Paths.get("bazel-out", "jvm-fastbuild").toString(); - int index = utilJar != null ? utilJar.indexOf(bazelOutPattern) : -1; - boolean isRunningFromBazelOut = index != -1 && utilJar.endsWith(".jar"); - return isRunningFromBazelOut ? utilJar.substring(0, index + bazelOutPattern.length()) : null; - } - - /** - * Returns a map of IntelliJ modules to .jar absolute paths, e.g.: - * "production/intellij.platform.util" => ".../production/intellij.platform.util/$hash.jar" - */ - public static @Nullable Map> getArchivedCompiledClassesMapping() { - if (ourArchivedCompiledClassesMapping == null) { - ourArchivedCompiledClassesMapping = computeArchivedCompiledClassesMapping(); - } - return ourArchivedCompiledClassesMapping; - } - - private static @Nullable Map> computeArchivedCompiledClassesMapping() { - final String filePath = System.getProperty("intellij.test.jars.mapping.file"); - if (StringUtilRt.isEmptyOrSpaces(filePath)) { - if (getArchivedCompiledClassesLocationIfIsRunningFromBazelOut() != null) { - return computeArchivedCompiledClassesMappingIfIsRunningFromBazelOut(); - } - return null; - } - final List lines; - try { - lines = Files.readAllLines(Paths.get(filePath)); - } - catch (Exception e) { - log("Failed to load jars mappings from " + filePath); - return null; - } - final Map> mapping = new HashMap<>(lines.size()); - for (String line : lines) { - String[] split = line.split("=", 2); - if (split.length < 2) { - log("Ignored jars mapping line: " + line); - continue; - } - mapping.put(split[0], Collections.singletonList(split[1])); - } - return Collections.unmodifiableMap(mapping); - } - - private static @Nullable @UnmodifiableView Map> computeArchivedCompiledClassesMappingIfIsRunningFromBazelOut() { - final BazelTargetsInfo.TargetsFile targetsFile; - try { - targetsFile = BazelTargetsInfo.loadTargetsFileFromBazelTargetsJson(PathManager.getHomeDir()); - } - catch (IOException e) { - log("Failed to load targets info from bazel-targets.json"); - return null; - } - - final Map> result = new HashMap<>(); - targetsFile.modules.forEach((moduleName, desc) -> { - if (!desc.productionJars.isEmpty()) { - result.put("production/" + moduleName, ContainerUtil.map(desc.productionJars, s -> PathManager.getHomeDir().resolve(s).toString())); - } - if (!desc.testJars.isEmpty()) { - result.put("test/" + moduleName, ContainerUtil.map(desc.testJars, s -> PathManager.getHomeDir().resolve(s).toString())); - } - }); - - return Collections.unmodifiableMap(result); - } - - @SuppressWarnings("UseOfSystemOutOrSystemErr") - private static void log(String x) { - System.err.println(x); - } - - private static final class BazelTargetsInfo { - public static TargetsFile loadTargetsFileFromBazelTargetsJson(@NotNull Path projectRoot) throws IOException { - final Path bazelTargetsJsonFile = projectRoot.resolve("build").resolve("bazel-targets.json"); - try (BufferedReader bufferedReader = Files.newBufferedReader(bazelTargetsJsonFile)) { - return new Gson().fromJson(bufferedReader, TargetsFile.class); - } - } - - public static final class TargetsFileModuleDescription { - public List productionJars; - public List testJars; - } - - public static final class TargetsFile { - public Map modules; - } - } -} diff --git a/platform/util/src/com/intellij/openapi/application/ArchivedCompilationContextUtil.kt b/platform/util/src/com/intellij/openapi/application/ArchivedCompilationContextUtil.kt new file mode 100644 index 000000000000..c6f0bf281cb6 --- /dev/null +++ b/platform/util/src/com/intellij/openapi/application/ArchivedCompilationContextUtil.kt @@ -0,0 +1,124 @@ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.openapi.application + +import kotlinx.serialization.ExperimentalSerializationApi +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.Json +import kotlinx.serialization.json.decodeFromStream +import org.jetbrains.annotations.ApiStatus +import java.nio.file.Path +import java.nio.file.Paths +import kotlin.io.path.inputStream +import kotlin.io.path.readLines + +@ApiStatus.Internal +object ArchivedCompilationContextUtil { + @JvmStatic + val archivedCompiledClassesLocation: String? by lazy(LazyThreadSafetyMode.PUBLICATION) { + /** + * NB: actual jars might be in subdirectories + */ + var relevantJarsRoot = System.getProperty("intellij.test.jars.location") + if (relevantJarsRoot != null) { + return@lazy relevantJarsRoot + } + + relevantJarsRoot = getArchivedCompiledClassesLocationIfIsRunningFromBazelOut() + val isRunningFromBazelOut = relevantJarsRoot != null + if (isRunningFromBazelOut) { + return@lazy relevantJarsRoot + } + + return@lazy null + } + + private fun getArchivedCompiledClassesLocationIfIsRunningFromBazelOut(): String? { + val utilJar = PathManager.getJarPathForClass(PathManager::class.java) + val bazelOutPattern = Paths.get("bazel-out", "jvm-fastbuild").toString() + val index = utilJar?.indexOf(bazelOutPattern) ?: -1 + val isRunningFromBazelOut = index != -1 && utilJar!!.endsWith(".jar") + return if (isRunningFromBazelOut) utilJar.take(index + bazelOutPattern.length) else null + } + + @JvmStatic + val archivedCompiledClassesMapping: Map>? by lazy(LazyThreadSafetyMode.PUBLICATION) { + /** + * Returns a map of IntelliJ modules to .jar absolute paths, e.g.: + * "production/intellij.platform.util" => ".../production/intellij.platform.util/$hash.jar" + */ + computeArchivedCompiledClassesMapping() + } + + private fun computeArchivedCompiledClassesMapping(): Map>? { + val filePath = System.getProperty("intellij.test.jars.mapping.file") + if (filePath.isNullOrBlank()) { + if (getArchivedCompiledClassesLocationIfIsRunningFromBazelOut() != null) { + return computeArchivedCompiledClassesMappingIfIsRunningFromBazelOut() + } + return null + } + val lines: List + try { + lines = Paths.get(filePath).readLines() + } + catch (_: Exception) { + log("Failed to load jars mappings from $filePath") + return null + } + val mapping: MutableMap> = mutableMapOf() + for (line in lines) { + val split = line.split("=", limit = 2) + if (split.size < 2) { + log("Ignored jars mapping line: $line") + continue + } + mapping[split[0]] = listOf(split[1]) + } + return mapping + } + + private fun computeArchivedCompiledClassesMappingIfIsRunningFromBazelOut(): Map>? { + val targetsFile: BazelTargetsInfo.TargetsFile + try { + targetsFile = BazelTargetsInfo.loadTargetsFileFromBazelTargetsJson(PathManager.getHomeDir()) + } + catch (_: Exception) { + log("Failed to load targets info from bazel-targets.json") + return null + } + + val mapping: MutableMap> = mutableMapOf() + targetsFile.modules.forEach { (moduleName, targetsFileModuleDescription) -> + if (targetsFileModuleDescription.productionJars.isNotEmpty()) { + mapping["production/$moduleName"] = targetsFileModuleDescription.productionJars.map { PathManager.getHomeDir().resolve(it).toString() } + } + if (targetsFileModuleDescription.testJars.isNotEmpty()) { + mapping["test/$moduleName"] = targetsFileModuleDescription.testJars.map { PathManager.getHomeDir().resolve(it).toString() } + } + } + return mapping + } + + private fun log(x: String) { + System.err.println(x) + } + + private object BazelTargetsInfo { + @OptIn(ExperimentalSerializationApi::class) + fun loadTargetsFileFromBazelTargetsJson(projectRoot: Path): TargetsFile { + val bazelTargetsJsonFile = projectRoot.resolve("build").resolve("bazel-targets.json") + return bazelTargetsJsonFile.inputStream().use { Json { ignoreUnknownKeys = true }.decodeFromStream(it) } + } + + @Serializable + data class TargetsFileModuleDescription( + val productionJars: List, + val testJars: List, + ) + + @Serializable + data class TargetsFile( + val modules: Map, + ) + } +} diff --git a/plugins/devkit/intellij.devkit.workspaceModel/tests/testSrc/LibrariesRequiredForWorkspace.kt b/plugins/devkit/intellij.devkit.workspaceModel/tests/testSrc/LibrariesRequiredForWorkspace.kt index f7a6ffa3f5d6..d632fb9ce13c 100644 --- a/plugins/devkit/intellij.devkit.workspaceModel/tests/testSrc/LibrariesRequiredForWorkspace.kt +++ b/plugins/devkit/intellij.devkit.workspaceModel/tests/testSrc/LibrariesRequiredForWorkspace.kt @@ -126,7 +126,7 @@ private fun addDependencyFromCompilationOutput(model: ModifiableRootModel, libra val classpathRootVirtualFiles = mutableListOf() - val mapping = ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() + val mapping = ArchivedCompilationContextUtil.archivedCompiledClassesMapping if (mapping != null) { (mapping["production/$classpathFolder"] ?: error("No jars found for $classpathFolder production classes")).mapTo(classpathRootVirtualFiles) { jar -> val classpathRootVirtualFile = VirtualFileManager.getInstance().refreshAndFindFileByUrl(VfsUtil.pathToUrl(jar)) diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenUtil.kt b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenUtil.kt index 9b53659dd4bc..63ce083d4c50 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenUtil.kt +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenUtil.kt @@ -1955,8 +1955,8 @@ object MavenUtil { /** * Static state to calculate module output when running IDEA from sources */ - private val archivedClassesLocation = ArchivedCompilationContextUtil.getArchivedCompiledClassesLocation() - private val mapping = ArchivedCompilationContextUtil.getArchivedCompiledClassesMapping() + private val archivedClassesLocation = ArchivedCompilationContextUtil.archivedCompiledClassesLocation + private val mapping = ArchivedCompilationContextUtil.archivedCompiledClassesMapping private val path = PathManager.getJarForClass(MavenServerManager::class.java)?.parent /**