-
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
Only configure publishing if it's applied externally #32351
Only configure publishing if it's applied externally #32351
Conversation
Pinging @elastic/es-core-infra |
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 couple questions.
.parse(project.tasks.generatePomFileForNebulaPublication.outputs.files.singleFile) | ||
pom.artifactId[0].value = project.name + "-client" | ||
jarFile.resolveSibling(clientPomFileName).toFile().text = XmlUtil.serialize(pom) | ||
// Groovy has an odd way of formatting the XML, fix it up |
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.
Is this new? It's unclear why this wasn't needed before.
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.
Probably the pom generation is Java and doesn't use this ?
We used to generate a new pom, now we copy and edit an existing one with this groovy code.
It shouldn't be necessary, as XML doesn't care about these, but I wanted to make sure it also looks as the previous one.
root.appendNode('description', project.pluginProperties.extension.description) | ||
root.appendNode('url', urlFromOrigin(project.scminfo.origin)) | ||
Node scmNode = root.appendNode('scm') | ||
scmNode.appendNode('url', project.scminfo.origin) |
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.
Are you sure this isn't needed anymore? IIRC I added it because the scm info didn't get into the pom correctly at the time, and caused validation to fail when publishing to maven central.
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 do remember doing diffs of before and after XMLs and didn't notice anything odd. Any edge cases or additional tests I should do ?
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 just checked this again to make sure:
[:~/work/elastic/elasticsearch/modules/reindex] fix-multi-jar-publishing-take-2+ ± diff ./build/distributions/reindex-client-7.0.0-alpha1-SNAPSHOT.pom ~/tmp/reindex-client-7.0.0-alpha1-SNAPSHOT.pom.master
2c2
< <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
---
> <project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
So the change produces no effect on the scm info in the pom.
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.
Have you run the build in a non git checkout?
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 not, but is that relevant for the poms we submit to maven or we just want to make sure it doesn't break ?
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.
@rjernst This does work with non git and just produces:
<scm>
<url/>
</scm>
This is consistent with master.
Node pom = new XmlParser() | ||
.parse(project.tasks.generatePomFileForNebulaPublication.outputs.files.singleFile) | ||
pom.artifactId[0].value = project.name + "-client" | ||
jarFile.resolveSibling(clientPomFileName).toFile().text = XmlUtil.serialize(pom) |
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.
please use setText(string, "UTF-8")
to be explicit about the encoding
@@ -211,35 +211,18 @@ public class PluginBuildPlugin extends BuildPlugin { | |||
|
|||
/** Adds nebula publishing task to generate a pom file for the plugin. */ | |||
protected static void addClientJarPomGeneration(Project 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.
Is this method still used? It looks like the one use was removed above.
jarFile.resolveSibling(clientPomFileName), | ||
StandardCopyOption.REPLACE_EXISTING | ||
) | ||
Node pom = new XmlParser() |
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.
Can you explain (and add a comment) why this is better than having a publishing block for the client pom? It's unclear to me what advantages this gains us.
@rjernst I updated this as we discussed, so that publishing and jar names are configured based on |
@elasticmachine test this please |
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.
Looks better. One last thing. If you agree, no further need for review.
@@ -16,6 +16,7 @@ | |||
* specific language governing permissions and limitations | |||
* under the License. | |||
*/ | |||
apply plugin: 'nebula.maven-scm' |
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 think this is confusing to have to apply this plugin specifically. Setting hasClientJar should do this for this build.
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 have a strong preference. The reason I changed it to this is so that's consistent with how we configure publishing without hasClientJar, where we only configure if the publishing plugin is applied.
0ecee7b
to
1f25694
Compare
Only configure publishing if it's applied externally, reconfigure for hasClientJar
* master: Generalize remote license checker (#32971) Trim translog when safe commit advanced (#32967) Fix an inaccuracy in the dynamic templates documentation. (#32890) Logging: Use settings when building daemon threads (#32751) All Translog inner closes should happen after tragedy exception is set (#32674) HLREST: AwaitsFix ML Test Pass DiscoveryNode to initiateChannel (#32958) Add mzn and dz to unsupported locales (#32957) Use settings from the context in BootstrapChecks (#32908) Update docs for node specifications (#30468) HLRC: Forbid all Elasticsearch logging infra (#32784) Only configure publishing if it's applied externally (#32351) Fixes libs:dissect when in eclipse Protect ScriptedMetricIT test cases against failures on 0-doc shards (#32959) (#32968) [Kerberos] Add documentation for Kerberos realm (#32662) Watcher: Properly find next valid date in cron expressions (#32734) Fix some small issues in the getting started docs (#30346) Set forbidden APIs target compatibility to compiler java version (#32935) Move connection listener to ConnectionManager (#32956)
…e-types * elastic/master: (89 commits) Fix assertion in AbstractSimpleTransportTestCase (elastic#32991) [DOC] Splits role mapping APIs into separate pages (elastic#32797) HLRC: ML Close Job (elastic#32943) Generalize remote license checker (elastic#32971) Trim translog when safe commit advanced (elastic#32967) Fix an inaccuracy in the dynamic templates documentation. (elastic#32890) Logging: Use settings when building daemon threads (elastic#32751) All Translog inner closes should happen after tragedy exception is set (elastic#32674) HLREST: AwaitsFix ML Test Pass DiscoveryNode to initiateChannel (elastic#32958) Add mzn and dz to unsupported locales (elastic#32957) Use settings from the context in BootstrapChecks (elastic#32908) Update docs for node specifications (elastic#30468) HLRC: Forbid all Elasticsearch logging infra (elastic#32784) Only configure publishing if it's applied externally (elastic#32351) Fixes libs:dissect when in eclipse Protect ScriptedMetricIT test cases against failures on 0-doc shards (elastic#32959) (elastic#32968) [Kerberos] Add documentation for Kerberos realm (elastic#32662) Watcher: Properly find next valid date in cron expressions (elastic#32734) Fix some small issues in the getting started docs (elastic#30346) ...
Only configure publishing if it's applied externally, reconfigure for hasClientJar
* commit '9088d811ce9cff922e6ef1befbeb0f1e0c27016a': (23 commits) Generalize remote license checker (elastic#32971) Trim translog when safe commit advanced (elastic#32967) Fix an inaccuracy in the dynamic templates documentation. (elastic#32890) HLREST: AwaitsFix ML Test Make Geo Context Mapping Parsing More Strict (elastic#32862) Add mzn and dz to unsupported locales (elastic#32957) Use settings from the context in BootstrapChecks (elastic#32908) Update docs for node specifications (elastic#30468) HLRC: Forbid all Elasticsearch logging infra (elastic#32784) Fix use of deprecated apis Only configure publishing if it's applied externally (elastic#32351) Protect ScriptedMetricIT test cases against failures on 0-doc shards (elastic#32959) (elastic#32968) Scripted metric aggregations: add deprecation warning and system (elastic#32944) Watcher: Properly find next valid date in cron expressions (elastic#32734) Fix some small issues in the getting started docs (elastic#30346) Set forbidden APIs target compatibility to compiler java version (elastic#32935) [TEST] Add "ne" as an unsupported SimpleKdc locale (elastic#32700) MINOR: Remove `IndexTemplateFilter` (elastic#32841) (elastic#32974) INGEST: Create Index Before Pipeline Execute (elastic#32786) (elastic#32975) NETWORKING: Make RemoteClusterConn. Lazy Resolve DNS (elastic#32764) (elastic#32976) ...
Alternate implementation for #32195. As discussed there, we should only configure publishing if already applied.