Correctly classify external dependencies by checking Bazel path#49
Correctly classify external dependencies by checking Bazel path#49runchen0919 wants to merge 2 commits intoeclipseguru:mainfrom
Conversation
| } | ||
| targetLabel = Label.create(format("@_unknown_jar_//:%s", classJar.getRelativePath())); | ||
| } | ||
| targetLabel = Label.create(format("@_unknown_jar_//:%s", classJar.getRelativePath())); |
There was a problem hiding this comment.
The targetLabel is used to index the jar for resolution later. Indexing the jar using //3rdparty/java is wrong. It would not be located. How is the im4java jar being referenced in deps attributes in Bazel? This needs to be fixed.
FWIW, I think we should not care about this case. It seems to be invalid. When jars are consumed using rules_jvm_external they get processed and labels will be injected correctly (I believe).
There was a problem hiding this comment.
The im4java Maven dependency fails to resolve due to a manifest label mismatch:
The Problem Chain:
- Incorrect Manifest Label: The JAR's MANIFEST.MF contains
Target-Label: //3rdparty/java:im4java_lib-lib(a local wrapper label) - Physical vs Logical Mismatch: The JAR physically resides in
bazel-out/.../external/maven/...(external) but has a non-external label - False Positive Check: Original code finds local directory
<repoRoot>/3rdparty/java/exists, keeps the wrong label - Indexing Failure: JAR indexed as
//3rdparty/javabut code references//3rdparty:im4java→ lookup fails
Dependency Chain:
Project code: deps = ["//3rdparty:im4java"]
↓
Wrapper target: //3rdparty:im4java exports @maven//:org_im4java_im4java
↓
Actual JAR: bazel-out/.../external/maven/.../im4java-1.0.0.jar
↓
Manifest label: //3rdparty/java:im4java_lib-lib ← WRONG
↓
Result: Dependency resolution fails
Project Structure
<repoRoot>
├── 3rdparty/
│ ├── BUILD # Contains wrapper: java_library(name="im4java", exports=["@maven//:..."])
│ └── java/ # Local directory that collides with manifest label
└── src/java/com/projectName/image/
└── BUILD # Uses: deps = ["//3rdparty:im4java"]
...azel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/JavaAspectsInfo.java
Outdated
Show resolved
Hide resolved
guw
left a comment
There was a problem hiding this comment.
See comments in file.
The fix here seems to only fix the system, i.e. the error message. It does not seem to address the issue how to correctly identify & handle such jars in Bazel.
|
@guw updated. The logic of the toArtifactLocation method has been optimized, and logic for checking if the path contains /external/ has been added. |
Fixed: #48
cc: @guw