-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue #265 --list-config license enhancement #9964
Issue #265 --list-config license enhancement #9964
Conversation
import java.util.AbstractMap; | ||
import java.util.Map; | ||
|
||
public class AllOSSLicenses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have an issue with this file. Firstly it will need to be maintained, but more importantly it is from a generated list that says we need to see the sources to determine the licence for the list itself. I'm not sure we can check this in and say it is EPL/Apache2
I think we should just report the raw license info we find.... perhaps there is an option to lookup this info, but do so online without checking this is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this file either.
Please remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the "license" we find in Bundle-License
is a URL like https://www.eclipse.org/legal/epl-2.0
, so we can't really print the URL, hence this mapping file.
If we remove it, what do we report, the URLs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A Bundle-License can be any text. (even non-urls)
Reporting the URLs does make sense, if we have report all of the discovered License information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind, that with JEP-238, it is possible to have multiple META-INF/MANIFEST.MF files too.
And they could even not agree with each other (we've seen this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove it, what do we report, the URLs?
The URLs are mostly humanly readable. It is clear what https://www.eclipse.org/legal/epl-2.0
is.
But if there is need, an option can be provided to download the source json or XML and pretty print it from that. The data is in github, perhaps it is also in maven, in which case we can even cache it locally.
String nonSpecified = "(none specified)"; | ||
try (JarFile jar = new JarFile(file)) | ||
{ | ||
return findFirstNonNullLicenseOr( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to report all licenses, not just the first.
List.of( | ||
JarLicense::findFromManifest, | ||
JarLicense::findFromPOM, | ||
JarLicense::findFromLicenseFile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should also be a JarLicense::findFromSPDXIndicator
.
And it should report all of them, not just the first one it finds.
Now, you can present them in order though.
SPDX-License-Identifier
results- POM
- Manifest
- License Files (NOTICE., LICENSE.) - the output of these should indicate (via URI) where they came from.
If there is any order, it should be present
This pull request has been automatically marked as stale because it has been a |
Implemented in PR #11993 in branch |
This is a start of a logic that finds the licenses of module jar files
So far it only checks the META-INF/MANIFEST.MF file
Later on, I will add pom.xml and License.txt file checks
@sbordet could you give me the feedback , I wonder if you agree with my solution
Here is the example output that I got during the testing
All the licenses were taken from spdx