Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,742 changes: 2,742 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion aspect/intellij_info_impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ def divide_java_sources(ctx):
java_sources.append(f)
else:
gen_java_sources.append(f)
elif f.basename.endswith(".srcjar"):
elif f.basename.endswith(".srcjar") or f.basename.endswith("sources.jar"):
srcjars.append(f)

return java_sources, gen_java_sources, srcjars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ static final class PackageParserOptions {

@VisibleForTesting
static PackageParserOptions parseArgs(String[] args) {
args = parseParamFileIfUsed(args);
PackageParserOptions options = new PackageParserOptions();
options.sources =
OptionParser.parseSingleOption(args, "sources", ArtifactLocationParser::parseList);
Expand Down Expand Up @@ -115,7 +114,7 @@ private static void runPersistentWorker(PackageParser parser) throws IOException

public static void main(String[] args) throws Exception {
ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
PackageParserOptions options = parseArgs(args);
args = parseParamFileIfUsed(args);
PackageParser parser = new PackageParser(PackageParserIoProvider.INSTANCE, executorService);

try {
Expand All @@ -125,6 +124,7 @@ public static void main(String[] args) throws Exception {
// redirect log output away from stdout.
runPersistentWorker(parser);
} else {
PackageParserOptions options = parseArgs(args);
parsePackagesAndWriteManifest(parser, options);
}
} catch (Throwable e) {
Expand Down
3 changes: 3 additions & 0 deletions base/src/com/google/idea/blaze/base/command/BlazeFlags.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public final class BlazeFlags {
// It expands to: --test_arg=--wrapper_script_flag=--debug --test_output=streamed
// --test_strategy=exclusive --test_timeout=9999 --nocache_test_results
public static final String JAVA_TEST_DEBUG = "--java_debug";
// Debugging tests should only run locally, so make sure no remote executor is defined
// while debugging tests
public static final String RUN_LOCALLY = "--remote_executor=";
// Streams stdout/stderr output from each test in real-time.
// Implies --test_strategy=exclusive and --test_sharding_strategy=disabled
public static final String TEST_OUTPUT_STREAMED = "--test_output=streamed";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ public void commitWithGc(BlazeContext context) {
continue;
}
moduleModel.disposeModule(module);
File imlFile = new File(module.getModuleFilePath());
removeImlFile(imlFile);
VirtualFile imlFile = module.getModuleFile();
if (imlFile != null) {
removeImlFile(imlFile);
}
}
}

Expand All @@ -141,29 +143,38 @@ private File getImlDirectory(BlazeImportSettings importSettings) {
return new File(BlazeDataStorage.getProjectDataDir(importSettings), "modules");
}

private static void removeImlFile(final VirtualFile imlFile) {
if (imlFile.isDirectory()) {
return;
}

ApplicationManager.getApplication()
.runWriteAction(
new Runnable() {
@Override
public void run() {
try {
imlFile.delete(this);
} catch (IOException e) {
logger.warn(
String.format(
"Could not delete file: %s, will try to continue anyway.",
imlFile.getPath()),
e);
}
}
});
}


// Delete using the virtual file to ensure that IntelliJ properly updates its index.
// Otherwise, it is possible for IntelliJ to read the
// old IML file from its index and behave unpredictably
// (like failing to save the new IML files to disk).
private static void removeImlFile(final File imlFile) {
final VirtualFile imlVirtualFile = VfsUtil.findFileByIoFile(imlFile, true);
if (imlVirtualFile != null && imlVirtualFile.exists()) {
ApplicationManager.getApplication()
.runWriteAction(
new Runnable() {
@Override
public void run() {
try {
imlVirtualFile.delete(this);
} catch (IOException e) {
logger.warn(
String.format(
"Could not delete file: %s, will try to continue anyway.",
imlVirtualFile.getPath()),
e);
}
}
});
removeImlFile(imlVirtualFile);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ static BlazeCommand.Builder getBlazeCommandBuilder(
}
else {
command.addBlazeFlags(BlazeFlags.JAVA_TEST_DEBUG);
command.addBlazeFlags(BlazeFlags.RUN_LOCALLY);
command.addBlazeFlags(debugPortFlag(true, debugPort));
}
if (kotlinxCoroutinesJavaAgent != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ public void debugFlagShouldBeIncludedForJavaTest() {
"command",
BlazeFlags.getToolTagFlag(),
"--java_debug",
"--remote_executor=",
"--test_arg=--wrapper_script_flag=--debug=127.0.0.1:5005",
"--",
"//label:rule"));
Expand Down Expand Up @@ -263,6 +264,7 @@ public void debugFlagShouldBeIncludedForJavaTestSuite() {
"test",
BlazeFlags.getToolTagFlag(),
"--java_debug",
"--remote_executor=",
"--test_arg=--wrapper_script_flag=--debug=127.0.0.1:5005",
"--",
"//label:java_test_suite_rule"));
Expand Down
4 changes: 1 addition & 3 deletions scala/src/com/google/idea/blaze/scala/run/Specs2Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static ScInfixExpr getContainingTestScope(PsiElement element) {
@Nullable
private static ScInfixExpr getContainingInfixExpr(
PsiElement element, Predicate<PsiElement> predicate) {
while (element != null && !predicate.test(element)) {
if (element != null && !predicate.test(element)) {
element = PsiTreeUtil.getParentOfType(element, ScInfixExpr.class);
}
return (ScInfixExpr) element;
Expand Down Expand Up @@ -117,8 +117,6 @@ public static String getTestFilter(ScTypeDefinition testClass, PsiElement testCa
if (testName == null) {
return null;
}
// https://github.com/bazelbuild/intellij/issues/176
testName = testName.trim().replace('(', '[').replace(')', ']');
// https://github.com/bazelbuild/intellij/issues/169
testName = Pattern.quote(testName);
return testClass.qualifiedName() + '#' + testName + end;
Expand Down
Loading