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

Allow lang-painless maven package to add compile dependencies #11356

Closed
wants to merge 2 commits into from

Conversation

prudhvigodithi
Copy link
Contributor

@prudhvigodithi prudhvigodithi commented Nov 28, 2023

Description

Allow lang-painless maven package to add compile dependencies

Tested with publishToMavenLocal

../../gradlew :modules:lang-painless:publishToMavenLocal

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- This module was also published with a richer model, Gradle metadata,  -->
  <!-- which should be used instead. Do not delete the following line which  -->
  <!-- is to indicate to Gradle or any Gradle module metadata file consumer  -->
  <!-- that they should prefer consuming it instead. -->
  <!-- do_not_remove: published-with-gradle-metadata -->
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.opensearch.plugin</groupId>
  <artifactId>lang-painless</artifactId>
  <version>3.0.0-SNAPSHOT</version>
  <name>lang-painless</name>
  <description>OpenSearch subproject :modules:lang-painless</description>
  <dependencies>
    <dependency>
      <groupId>org.antlr</groupId>
      <artifactId>antlr4-runtime</artifactId>
      <version>4.11.1</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm-util</artifactId>
      <version>9.6</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm-tree</artifactId>
      <version>9.6</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm-commons</artifactId>
      <version>9.6</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm-analysis</artifactId>
      <version>9.6</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm</artifactId>
      <version>9.6</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.opensearch.plugin</groupId>
      <artifactId>opensearch-scripting-painless-spi</artifactId>
      <version>3.0.0-SNAPSHOT</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
  <inceptionYear>2021</inceptionYear>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <developers>
    <developer>
      <name>OpenSearch</name>
      <url>https://github.com/opensearch-project/OpenSearch</url>
    </developer>
  </developers>
  <url>https://github.com/prudhvigodithi/OpenSearch</url>
  <scm>
    <url>git@github.com:prudhvigodithi/OpenSearch.git</url>
  </scm>
</project>

Related Issues

Resolves #11353
(Part of ~opensearch-project/opensearch-build#4161)

Check List

New functionality includes testing.
All tests pass
New functionality has been documented.
New functionality has javadoc added
Commit changes are listed out in CHANGELOG.md file (See: Changelog)

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Prudhvi Godithi <pgodithi@amazon.com>
Copy link
Contributor

❌ Gradle check result for d82b614: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Prudhvi Godithi <pgodithi@amazon.com>
Copy link
Contributor

github-actions bot commented Nov 28, 2023

Compatibility status:

Checks if related components are compatible with change b4fa136

Incompatible components

Skipped components

Compatible components

Compatible components: [https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/custom-codecs.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/sql.git]

Copy link
Contributor

❌ Gradle check result for e8d4d4a: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for b4fa136: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@@ -82,9 +82,16 @@ shadowJar {
}
}

tasks.validateNebulaPom.dependsOn tasks.generatePomFileForShadowPublication
// Allowing the task generatePomFileForNebulaPublication to generate the POM file with added compile dependencies.
gradle.taskGraph.whenReady {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@prudhvigodithi I don't think we are addressing the root of the problem here, there are multiple publications that conflict (apparently, for no reason):

> Task :modules:lang-painless:publishShadowPublicationToMavenLocal                                                                                                         

Multiple publications with coordinates 'org.opensearch.plugin:lang-painless:3.0.0-SNAPSHOT' are published to repository 'mavenLocal'. The publications 'nebula' in project ':modules:lang-painless' and 'shadow' in project ':modules:lang-painless' will overwrite each other!

I am looking why that happens, mind if I push some changes to your pull request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure @reta please do, I have just focused on the POM generation, which has the problem with the task generatePomFileForShadowPublication coming from the shadow plugin.

Copy link
Contributor Author

@prudhvigodithi prudhvigodithi Nov 28, 2023

Choose a reason for hiding this comment

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

I assume there is a some issue with shadow plugin with gradle version 8.4, as notice the POM file generated (via generatePomFileForShadowPublication) also is not in right structure where it has the XML ending value <dependencies/>, but not the starting.


<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>lang-painless</artifactId>
<version>2.10.0</version>
<name>lang-painless</name>
<description>An easy, safe and fast scripting language for OpenSearch</description>
<inceptionYear>2021</inceptionYear>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>OpenSearch</name>
<url>https://github.com/opensearch-project/OpenSearch</url>
</developer>
</developers>
<url>https://github.com/opensearch-project/OpenSearch.git</url>
<scm>
<url>https://github.com/opensearch-project/OpenSearch.git</url>
</scm>
<dependencies/>
</project>

Since generatePomFileForNebulaPublication already does the POM generation, I have disabled the generatePomFileForShadowPublication.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also @reta I see task publishShadowPublicationToMavenLocal works on my local.

../../gradlew :modules:lang-painless:publishShadowPublicationToMavenLocal
Picked up JAVA_TOOL_OPTIONS: -Dlog4j2.formatMsgNoLookups=true

> Configure project :
========================= WARNING =========================
         Backwards compatibility tests are disabled!
See https://github.com/opensearch-project/OpenSearch/issues/4173
===========================================================
=======================================
OpenSearch Build Hamster says Hello!
  Gradle Version        : 8.4
  OS Info               : Mac OS X 13.6 (aarch64)
  JDK Version           : 11 (Homebrew JDK)
  JAVA_HOME             : /opt/homebrew/Cellar/openjdk@11/11.0.16.1/libexec/openjdk.jdk/Contents/Home
  Random Testing Seed   : AD775C78920E6AF4
  In FIPS 140 mode      : false
=======================================

BUILD SUCCESSFUL in 5s
54 actionable tasks: 6 executed, 3 from cache, 45 up-to-date

Copy link
Collaborator

@reta reta Nov 28, 2023

Choose a reason for hiding this comment

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

@prudhvigodithi the issue is that Shadow publication does not generate the correct POM file anymore (the dependencies) and Nebula does not generate the POM we need either (dependencies are but not other elements), I think I found the place where is is happening.

@reta reta mentioned this pull request Nov 28, 2023
8 tasks
@prudhvigodithi
Copy link
Contributor Author

Closing this PR as @reta opened a new PR #11369 to completely remove the shadowjar for lang-painless. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] lang-painless missing compile dependencies
3 participants