Skip to content

Conversation

@mark-vieira
Copy link
Contributor

The entitlement bridge jar is patched into java.base at runtime. At build time it is modular, so it contains a module-info.java. Yet at runtime this produces a warning from the jdk because the module info is ignored. We should remove the module info from the jar we put in the distribution to avoid the warning.

This is implemented as a Gradle artifact transform for a few reasons:

  1. Avoid having to manage multiple Jar tasks on the producer side which have to be kept in sync.
  2. Decouples this from the producer entirely. Only the consumer need care that these artifacts are filtered. This means we can do this kind of thing even for artifacts we don't produce.
  3. We can use this transform for other things, like eliminating the need for our custom patched log4j library (will be done in a follow up).

@mark-vieira mark-vieira added :Delivery/Build Build or test infrastructure auto-backport Automatically create backport pull requests when merged v8.18.1 v8.19.0 v9.0.1 :Core/Infra/Entitlements Entitlements infrastructure labels Mar 11, 2025
@mark-vieira mark-vieira requested a review from rjernst March 11, 2025 17:21
@mark-vieira mark-vieira requested a review from a team as a code owner March 11, 2025 17:21
@elasticsearchmachine elasticsearchmachine added Team:Core/Infra Meta label for core/infra team Team:Delivery Meta label for Delivery team v9.1.0 labels Mar 11, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

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

@mark-vieira mark-vieira enabled auto-merge (squash) March 11, 2025 18:42
Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

// Register artifact transform for filtering entitlements-bridge jar
FilteringJarTransform.registerTransform(dependencies) { spec ->
spec.exclude('module-info.class')
spec.exclude('META-INF/versions/**')
Copy link
Member

Choose a reason for hiding this comment

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

If you also add a second line for spec.exclude('META-INF/versions') will that remove the directory too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. I tried. It seems PathMatcher doesn't handle directories that way.

@mark-vieira mark-vieira merged commit 74ccd4d into elastic:main Mar 11, 2025
17 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.18 Commit could not be cherrypicked due to conflicts
8.x Commit could not be cherrypicked due to conflicts
9.0

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 124580

mark-vieira added a commit to mark-vieira/elasticsearch that referenced this pull request Mar 11, 2025
mark-vieira added a commit to mark-vieira/elasticsearch that referenced this pull request Mar 11, 2025
…elastic#124580)

(cherry picked from commit 74ccd4d)

# Conflicts:
#	distribution/build.gradle
@mark-vieira
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x
8.18

Questions ?

Please refer to the Backport tool documentation

mark-vieira added a commit to mark-vieira/elasticsearch that referenced this pull request Mar 11, 2025
…elastic#124580)

(cherry picked from commit 74ccd4d)

# Conflicts:
#	distribution/build.gradle
elasticsearchmachine pushed a commit that referenced this pull request Mar 11, 2025
…bution (#124580) (#124598)

* Filter module-info.class from entitlements-bridge jar in distribution (#124580)

(cherry picked from commit 74ccd4d)

# Conflicts:
#	distribution/build.gradle

* Remove import for renamed class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged :Core/Infra/Entitlements Entitlements infrastructure :Delivery/Build Build or test infrastructure >non-issue Team:Core/Infra Meta label for core/infra team Team:Delivery Meta label for Delivery team v8.18.1 v8.19.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants