-
Notifications
You must be signed in to change notification settings - Fork 24.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
Move license checks back to BuildPlugin #56975
Conversation
Some standalone projects such as :distribution:archives:integ-test-zip have tests but are not intended to ever create a jar. Applying the new ElasticsearchJavaPlugin in favor over the elder "Standalone*Plugin" or BuildPlugin can result in these non-jar projects erroring due to the lack of the license or notice file. To avoid creating more permutations of ElasticsearchJavaPlugin (i.e. ElasticsearchJavaPluginWithoutJar), the conuming project should be able disable the jar task (e.g. `jar.enabled = false`) and the license checks should be skipped as well as the javadoc and sources jars. related: elastic#56841
Pinging @elastic/es-core-infra (:Core/Infra/Build) |
To me this seems like something that should go in the publish plugin, since that is where we need the jars to contain the license files. However, we don't apply the publish plugin to all projects that go into our distributions (eg under libs). I think there is an argument for another plugin, one for any project that will end up in the distribution but is not published. I can't think of what to call it right now though.. |
@rjernst I don't disagree, however would you mind if I logged a follow up issue to address that and proceed with this shorter term solution here ? The change here helps to unblock another PR. |
Actually we do since we apply the I'd move the jar license/notice check into |
@jakelandis discussed with @rjernst and we've agreed to just move this into |
thanks @rjernst @mark-vieira - I reverted the original commit(s) and moved the method call out of |
@@ -82,6 +82,7 @@ class BuildPlugin implements Plugin<Project> { | |||
) | |||
} | |||
project.pluginManager.apply('elasticsearch.java') | |||
ElasticsearchJavaPlugin.configureJars(project) |
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 shouldn't be calling these methods statically; that is what we are trying to move away from. Can you please move the notice/license configuration to a new method in BuildPlugin, and leave the other stuff intact?
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 can, however, aren't we also moving away from adding code to the Groovy parts of the build ? (I can move the code to Groovy and keep in the code in idiomatic Java, but isn't it still is going the wrong way ?)
We shouldn't be calling these methods statically
In that case, should these methods not be public static
?
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 will be finishing moving this code to java soon. I'll take care of re-javaizing 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.
OK ... I pulled the groovy version from git history and removed the Java version. 908ee17
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.
Sorry that isn't what I meant. Only the notice/license code should be moved. That is the problem you are running into right?
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.
pulled only the license and notice parts back to the groovy plugin
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.
Changes LGTM 👍
Some standalone projects such as :distribution:archives:integ-test-zip have Java codevia tests, but are not need license and notice files. Applying the new
ElasticsearchJavaPlugin
in favor over the elder
Standalone*Plugin
can result in these non-jarprojects test projects throwing an error due to the lack of the license or notice file.
This commit moves the license check out of the new
ElasticsearchJavaPlugin
and appliesonly via the elder
BuildPlugin
related: #56841
======
I'm not 100% this is the right direction, but seems pretty harmless to allow projects to opt out of the default jar creation.This PR is related to #56841 (comment) ...trying to move away from the conditional checks to that ensure specific plugins are applied.