Skip to content

Commit 94bf2bb

Browse files
committed
Bazel Eclipse doesn't recognize filegroup
1 parent 9f8988a commit 94bf2bb

File tree

1 file changed

+21
-0
lines changed
  • bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/projects

1 file changed

+21
-0
lines changed

bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/projects/JavaProjectInfo.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.salesforce.bazel.eclipse.core.model.discovery.projects;
22

3+
import static com.salesforce.bazel.sdk.command.querylight.BazelRuleAttribute.SRCS;
34
import static java.nio.file.Files.isRegularFile;
45
import static java.util.Objects.requireNonNull;
56
import static java.util.stream.Collectors.toList;
@@ -403,6 +404,16 @@ private Entry toJavaSourceFileOrLabelEntry(String srcFileOrLabel) throws CoreExc
403404

404405
// treat as label if it looks like one
405406
if (shouldTreatAsLabel(srcFileOrLabel)) {
407+
var target = bazelPackage.getBazelTarget(srcFileOrLabel);
408+
if ((target != null) && "filegroup".equals(target.getRuleClass())) {
409+
var attributes = target.getRuleAttributes();
410+
var srcs = attributes.getStringList(SRCS);
411+
if (srcs != null) {
412+
for (String src : srcs) {
413+
return toJavaSourceFileOrLabelEntry(src);
414+
}
415+
}
416+
}
406417
return newLabelEntry(srcFileOrLabel);
407418
}
408419

@@ -415,6 +426,16 @@ private Entry toResourceFileOrLabelEntry(String srcFileOrLabel, String resourceS
415426

416427
// treat as label if it looks like one
417428
if (shouldTreatAsLabel(srcFileOrLabel)) {
429+
var target = bazelPackage.getBazelTarget(srcFileOrLabel);
430+
if ((target != null) && "filegroup".equals(target.getRuleClass())) {
431+
var attributes = target.getRuleAttributes();
432+
var srcs = attributes.getStringList(SRCS);
433+
if (srcs != null) {
434+
for (String src : srcs) {
435+
return toResourceFileOrLabelEntry(src, resourceStripPrefix);
436+
}
437+
}
438+
}
418439
return newLabelEntry(srcFileOrLabel);
419440
}
420441

0 commit comments

Comments
 (0)