Skip to content

Remove nebula publish plugin usage #69027

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

Merged
merged 3 commits into from
Feb 18, 2021

Conversation

breskeby
Copy link
Contributor

  • instead setup publication on our own.
  • replaces nebula with a elastic publication

@breskeby breskeby self-assigned this Feb 16, 2021
@breskeby breskeby added :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v7.12.0 v8.0.0 labels Feb 16, 2021
@breskeby breskeby marked this pull request as ready for review February 16, 2021 13:32
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

@breskeby breskeby requested a review from mark-vieira February 16, 2021 13:32
- instead setup publication on our own.
- replaces nebula with a elastic publication
@breskeby breskeby force-pushed the remove-nebula-publish-usage branch from c4d311c to 74b4d74 Compare February 16, 2021 15:45
Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

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

Couple of comments.

private static void configurePublishing(Project project, PluginPropertiesExtension extension) {
if (project.plugins.hasPlugin(MavenPublishPlugin)) {
project.publishing.publications.nebula(MavenPublication).artifactId(extension.name)
project.publishing.publications.elastic(MavenPublication).artifactId(extension.name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Yay! Now we don't have to explain wtf "nebula" means.

@@ -13,7 +13,7 @@ apply plugin: 'elasticsearch.internal-cluster-test'

publishing {
publications {
nebula {
elastic(MavenPublication) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it necessary to specify the type here? Isn't that only when creating a new container object? In this context we're configuring an existing publication, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. that was an oversight of an earlier implementation where I created the publication in an afterEvaluate. But I moved it to be done immediately to avoid exactly this. yeah we should only configure existing publications here.


@Override
public void apply(Project project) {
project.getPluginManager().apply(BasePlugin.class);
project.getPluginManager().apply("nebula.maven-nebula-publish");
project.getPlugins().apply(MavenPublishPlugin.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shoudl we use the PluginManager version consistently here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

extraProperties.set(MAVEN_JAR, Boolean.FALSE);

project.getPlugins().withType(JavaPlugin.class).configureEach(plugin -> extraProperties.set(MAVEN_JAR, Boolean.TRUE));
project.getPluginManager().withPlugin("com.github.johnrengelman.shadow", plugin -> extraProperties.set(MAVEN_JAR, Boolean.TRUE));
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we be mutating the MAVEN_SHADOW property here instead? And really, is tracking these things via properties necessary? Couldn't we simply do configureWithShadowPlugin here when the plugin is applied rather than setting a flag then reading it in afterEvalutate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed. The general problem we deal here with is applying an either or pattern. If just the java plugin is applied then do this. If shadow plugin is applied do that.
I looked a bit deeper into this and since how we handle the shadow plugin here we actually could simplify this without the need for the extra properties and the after evaluate hook. pushed a fix for this

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't the shadow plugin also apply the java plugin? If so can't we just order it such that it's safe to always do the "java" configuration and we just override those bits if necessary when the shadow plugin gets applied? I'm quite certain this was how it behaved before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it doesn't apply it. It only reacts on the java plugin being applied. But we're good here now I think

Simplify publication configuration
@breskeby breskeby requested a review from mark-vieira February 17, 2021 09:07
Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

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

One comment about some logic we've removed, otherwise LGTM.

@@ -116,25 +101,24 @@ private static void addNameAndDescriptiontoPom(Project project, NamedDomainObjec
}

private static void configureWithShadowPlugin(Project project, MavenPublication publication) {
project.getPluginManager().withPlugin("com.github.johnrengelman.shadow", plugin -> {
ShadowExtension shadow = project.getExtensions().getByType(ShadowExtension.class);
shadow.component(publication);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why were we doing this? Is this no longer necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we configure shadow jars to have the default naming. with having tis here we would basically add a 2nd artifact which causes gradle to declare the packaging to be a pom as we have already declared the java component as artifact in the withJava block.

@breskeby breskeby merged commit 146f7be into elastic:master Feb 18, 2021
breskeby added a commit to breskeby/elasticsearch that referenced this pull request Feb 18, 2021
- instead setup publication on our own.
- replaces nebula with a elastic publication
breskeby added a commit that referenced this pull request Apr 13, 2021
- instead setup publication on our own.
- replaces nebula with a elastic publication
@breskeby breskeby deleted the remove-nebula-publish-usage branch December 10, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v7.12.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants