diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsLoaderBase.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsLoaderBase.java index 64a3cd2bb39f..1598efc38465 100644 --- a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsLoaderBase.java +++ b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsLoaderBase.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.jps.model.serialization; import com.intellij.openapi.diagnostic.Logger; @@ -28,8 +28,7 @@ public abstract class JpsLoaderBase { /** * Returns null if file doesn't exist */ - @Nullable - protected Element loadRootElement(@NotNull Path file) { + protected @Nullable Element loadRootElement(@NotNull Path file) { return loadRootElement(file, myMacroExpander); } @@ -50,16 +49,14 @@ public abstract class JpsLoaderBase { timingLog.run(); } - @Nullable - protected Element loadComponentData(@NotNull JpsElementExtensionSerializerBase serializer, @NotNull Path configFile) { + protected @Nullable Element loadComponentData(@NotNull JpsElementExtensionSerializerBase serializer, @NotNull Path configFile) { return JDomSerializationUtil.findComponent(loadRootElement(configFile), serializer.getComponentName()); } /** * Returns null if file doesn't exist */ - @Nullable - protected static Element loadRootElement(@NotNull Path file, @NotNull JpsMacroExpander macroExpander) { + protected static @Nullable Element loadRootElement(@NotNull Path file, @NotNull JpsMacroExpander macroExpander) { final Element element = tryLoadRootElement(file); if (element != null) { macroExpander.substitute(element, SystemInfo.isFileSystemCaseSensitive); @@ -67,8 +64,7 @@ public abstract class JpsLoaderBase { return element; } - @Nullable - public static Element tryLoadRootElement(@NotNull Path file) { + public static @Nullable Element tryLoadRootElement(@NotNull Path file) { int i = 0; while (true) { try { @@ -91,7 +87,7 @@ public abstract class JpsLoaderBase { } } - //most likely configuration file is being written by IDE so we'll wait a little + // the most likely configuration file is being written by IDE, so we'll wait a little try { //noinspection BusyWait Thread.sleep(300); diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/CompilationContextImpl.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/CompilationContextImpl.kt index 0e4cbde6ab1a..91f40e5217d3 100644 --- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/CompilationContextImpl.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/CompilationContextImpl.kt @@ -41,10 +41,11 @@ import org.jetbrains.jps.model.library.sdk.JpsSdkReference import org.jetbrains.jps.model.module.JpsModule import org.jetbrains.jps.model.serialization.JpsModelSerializationDataService import org.jetbrains.jps.model.serialization.JpsPathMapper -import org.jetbrains.jps.model.serialization.JpsProjectLoader.loadProject +import org.jetbrains.jps.model.serialization.JpsProjectLoader import org.jetbrains.jps.util.JpsPathUtil import java.nio.file.Files import java.nio.file.Path +import kotlin.io.path.invariantSeparatorsPathString import kotlin.io.path.relativeToOrNull @Obsolete @@ -371,10 +372,10 @@ private suspend fun loadProject(projectHome: Path, kotlinBinaries: KotlinBinarie withContext(Dispatchers.IO) { spanBuilder("load project").useWithScope { span -> - pathVariablesConfiguration.addPathVariable("MAVEN_REPOSITORY", FileUtilRt.toSystemIndependentName( - Path.of(SystemProperties.getUserHome(), ".m2/repository").toString())) + pathVariablesConfiguration.addPathVariable("MAVEN_REPOSITORY", + Path.of(SystemProperties.getUserHome(), ".m2/repository").invariantSeparatorsPathString) val pathVariables = JpsModelSerializationDataService.computeAllPathVariables(model.global) - loadProject(model.project, pathVariables, JpsPathMapper.IDENTITY, projectHome, { launch { it.run() } }, false) + JpsProjectLoader.loadProject(model.project, pathVariables, JpsPathMapper.IDENTITY, projectHome, { launch { it.run() } }, false) span.setAllAttributes(Attributes.of( AttributeKey.stringKey("project"), projectHome.toString(), AttributeKey.longKey("moduleCount"), model.project.modules.size.toLong(),