Skip to content
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

Generate license report on jar build #409

Merged
merged 5 commits into from
Oct 4, 2024

Conversation

JonasKunz
Copy link
Contributor

Closes #386.

Instead of checking licenses into git, the license report is instead generated when the JAR-artifacts are built.
I manually compared the results of the new build with the contents prior to this PR. Prior to this PR the license report also included compile-only dependencies, which are now left out because to my knowledge they are not required: We only need to have the licenses of the dependencies we actually ship.

To manage license approval, I've included the checkLicense task: This way the build will fail if licenses are detected, which have not been approved explicitly via the buildscripts/allowed-licenses.json file.

@JonasKunz JonasKunz requested a review from a team September 19, 2024 08:03
// include licenses and notices in jar
from(rootDir) {
dependsOn(fullLicenseReport)
from(fullLicenseReport.get().outputs.files.singleFile) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually passing a task as input for another task is enough for gradle to create an implicit dependency between them and also to know what outputs to consume. Some cases might need things to be done explicitly though, maybe this is one of them, but if it's not, I think it'd be enough to replace lines 44 and 45 with from(fullLicenseReport).

Copy link

@LikeTheSalad LikeTheSalad Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it seems like this config is applied the same way in the agentextension build file, if the same steps are needed for all cases then it'd probably be nice to do this work in the conventions file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be enough to replace lines 44 and 45 with from(fullLicenseReport)

Good point, i wasn't aware that from() accepts tasks as input, thanks!

Also, it seems like this config is applied the same way in the agentextension build file, if the same steps are needed for all cases then it'd probably be nice to do this work in the conventions file.

I left that intentionally in the individual sub-projects: In my opinion it is easier to follow when the content-packaging of the JAR is less spread over multiple files, especially in this case because it is now only two duplicated lines across the two files.

agent/build.gradle.kts Show resolved Hide resolved
licenses/LICENSE_asm_bsd-3-clause Show resolved Hide resolved
licenses/LICENSE_mpl-2 Show resolved Hide resolved
agent/build.gradle.kts Show resolved Hide resolved
@JonasKunz JonasKunz merged commit 2dbdfff into elastic:main Oct 4, 2024
15 checks passed
@JonasKunz JonasKunz deleted the license-reporting branch October 4, 2024 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automate licenses update
3 participants