rules_jvm: fix slow build initialization (MRI-3562)

GitOrigin-RevId: 03e6bf681b7a9093205fd2e8a1c4b5ab09791a9b
This commit is contained in:
Eugene Zhuravlev
2026-02-12 08:10:34 +00:00
committed by intellij-monorepo-bot
parent 24e415e812
commit 45a509f335
2 changed files with 25 additions and 10 deletions
@@ -1,8 +1,13 @@
package com.intellij.tools.build.bazel;
import com.intellij.tools.build.bazel.impl.BazelIncBuildTest;
import com.intellij.tools.build.bazel.impl.OutputConsumer;
import org.junit.Test;
import java.io.IOException;
import java.nio.file.Path;
import java.time.Duration;
// Migrated from JPS-based test engine
public class JavaTests extends BazelIncBuildTest {
@Test
@@ -1389,9 +1394,25 @@ public class JavaTests extends BazelIncBuildTest {
// changeName tests
private static final String JAVA_CHANGE_CASE_TEST_PATH = "java/changeName/changeCaseOfName";
@Test
public void testChangeCaseOfName() throws Exception {
performTest("java/changeName/changeCaseOfName").assertSuccessful();
performTest(JAVA_CHANGE_CASE_TEST_PATH).assertSuccessful();
}
@Override
protected void modify(Path testDataDir, Path testWorkDir, int stage) throws IOException {
if (stage == 0 && testDataDir.endsWith(JAVA_CHANGE_CASE_TEST_PATH)) {
// shutdown to ensure bazel re-reads paths with their original case
try {
runBazelCommand(OutputConsumer.allLinesConsumer(), Duration.ofMinutes(1), "shutdown").assertSuccessful();
}
catch (Exception e) {
throw new IOException(e);
}
}
super.modify(testDataDir, testWorkDir, stage);
}
@Test
@@ -20,7 +20,6 @@ import org.jetbrains.jps.util.Pair;
import java.io.File;
import java.io.IOException;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Base64;
@@ -121,14 +120,9 @@ public class BuildContextImpl implements BuildContext {
Map<NodeSource, String> sourcesMap = new HashMap<>();
for (String src : CLFlags.SRCS.getValue(flags)) {
try {
Path inputPath = baseDir.resolve(src).toRealPath(LinkOption.NOFOLLOW_LINKS); // ensure the input path names have exactly the same case as on the disk
assert isSourceDependency(inputPath);
sourcesMap.put(myPathMapper.toNodeSource(inputPath), getDigest.apply(src));
}
catch (IOException e) {
report(Message.create(null, Message.Kind.ERROR, "Unable to resolve relative path " + src, e));
}
Path inputPath = baseDir.resolve(src).normalize();
assert isSourceDependency(inputPath);
sourcesMap.put(myPathMapper.toNodeSource(inputPath), getDigest.apply(src));
}
mySources = new SourceSnapshotImpl(sourcesMap);