Skip to content

fix(core): stop splitting io.spiffe.workloadapi.internal across modules - #523

Open
cvas22 wants to merge 2 commits into
spiffe:mainfrom
cvas22:split-package-provider
Open

cvas22 wants to merge 2 commits into
spiffe:mainfrom
cvas22:split-package-provider

Conversation

@cvas22

@cvas22 cvas22 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #108

The grpc-netty-* modules each shipped their own GrpcManagedChannelFactory and ManagedChannelWrapper in io.spiffe.workloadapi.internal, the same package core uses, and core just got whichever copy came first on the classpath. That split package is what breaks consumers on the module path.

ManagedChannelWrapper now lives in core and takes a plain close hook instead of a Netty EventLoopGroup, since the Linux module uses shaded Netty and the macOS ones don't. Core has a small GrpcChannelProvider interface, each module implements it in its own package (internal.linux, internal.macos, internal.macos.aarch64) and registers it in META-INF/services, and GrpcManagedChannelFactory loads it with ServiceLoader. It picks the provider that supports the current OS and arch, and falls back to the first one found, so a TCP address still works with whatever module you have and a Unix socket on the wrong platform fails the same way it does today. If a provider can't be loaded and nothing else is found, that error is the cause of the "no provider" exception. DefaultWorkloadApiClient is unchanged, and core only needs a grpc-netty module at test time now.

Tests cover provider selection, the fallback, load errors and the close hook in core, plus a test per module that its provider is registered and builds a TCP channel. I ran the Build workflow on my fork, linux and macOS on 17, 21 and 25, all green.

Notes

Everything that moved is under internal, which japicmp already skips, so nothing public changes. The modules only compileOnly core, so their published POMs stay the same. Mixing a new core with an old grpc-netty-* jar won't work, but the README and the BOM already say those versions have to match.

…ules

The grpc-netty-* modules each shipped their own GrpcManagedChannelFactory
and ManagedChannelWrapper in io.spiffe.workloadapi.internal, the same
package core uses, and core picked whichever came first on the classpath.
That split package breaks consumers on the Java module path.

Move ManagedChannelWrapper into core with a plain close hook, add a
GrpcChannelProvider interface, and have each grpc-netty module register
its provider in its own package through META-INF/services. Core loads it
with ServiceLoader and picks the one supporting the current OS and arch,
falling back to the first one found so TCP addresses keep working.
Core no longer needs a grpc-netty module on its compile classpath.

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The java-spiffe modules contain split packages which break the Java Modules (JPMS)

1 participant