-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling multiple ComponentArtifactIdentifier
with same ComponentIdentifier
currently causing "cannot merge duplicate" errors
#69
Comments
Oh compileClasspath does lower level things, like referencing classes files directly? I guess compileJava/compileKotlin doesn't force artifact archives to be built? Should the sbom be ignoring anything that's not a jar? We actually only use resolvedArtifacts when processing external maven references anyway. Perhaps we should filter on stuff that's only If you did something like: resolvedArtifacts.entrySet().stream()
+ .filter(e -> !(e.getKey() instanceof ProjectComponentIdentifier))
.collect( does that fix the problem in your build? |
I tries that, but still get |
Ah yeah, I had it wrong, it looks like this should work? resolvedArtifacts.entrySet().stream()
- .filter(e -> !(e.getKey() instanceof ProjectComponentIdentifier))
+ .filter(e -> !(e.getKey().getComponentIdentifier() instanceof ProjectComponentIdentifier))
.collect( |
That works, thank you for finding the issue. Updated our patched version in https://r8-review.googlesource.com/c/r8/+/85841. Let me know when version 0.4.0 with this change lands, and I will update our project to use that instead. |
Sure np, I'll ping you when we release. Should be sometime next week (or today if we're lucky). |
This is with patch suggested in spdx/spdx-gradle-plugin#69 (comment) Change-Id: If196acf43bf07608cf9925fe46f2a47176bed360 Bug: b/310179346
In the
SpdxDocumentBuilder
constructorComponentArtifactIdentifier
is mapped down toComponentIdentifier
, and if multipleComponentArtifactIdentifier
has the sameComponentIdentifier
but not the same file the plugin fails with a "cannot merge duplicate..." error.This is seen when integrating the spdx-gradle-plugin into the build of the D8/R8 compiler suite. It works fine except for one issue, where we get duplicate file references. There has already been some work in this area in the pull request Handle duplicate files references, but for the D8/R8 project that is not enough.
We have a setup where the plugin is passed both
compileClasspath
andruntimeClasspath
. We also haveimplementation
dependencies on other modules. And these things in combination leads to the following pairs of artifact files in the building ofresolvedArtifacts
:The
resourceshrinker
project has both java and kotlin code. Thekeepanno
project has only java code.I am by no means a Gradle expert, but I can see why classes generated for both Java and Kotlin are present, but why one
jar
fromlibs
is also there I am not sure. Does anybody have an idea of how should we handle this in the plugin? Is D8/R8 setup not supported/unexpected?Right now we are using a custom version of the plugin with the following patch (I am not suggesting landing this as is - this is only for the plugin to work for our project, and I might as well just have all duplicates, but wanted to see failures if new patterns started to appear):
The text was updated successfully, but these errors were encountered: