Repository navigation
fix(core): stop splitting io.spiffe.workloadapi.internal across modules - #523
Conversation
maxlambrecht
left a comment
There was a problem hiding this comment.
Thanks for putting this together! The package split and close hook look right, and the helper SPIRE job already exercises service loading through the shaded helper JAR on Linux.
Looking at selection, the built-in providers have mutually exclusive platform checks, so choosing the first supported provider works for the current implementations.
Before merging, could you add a regression test that compiles and runs a small named-module consumer against core, one transport, and their runtime dependencies on the module path, including channel creation and close? That would cover the original split-package failure and service discovery.
It would also help to note in the changelog that core and the transport artifact need to be upgraded together, since an old transport JAR still contains the original shared package.
91acd12 to
9d8671d
Compare
|
thx for the review. I added ModulePathTest to the Linux transport module, it puts core, the transport and their runtime deps on the module path in their own layer and creates and closes a channel through core. It fails if I put a class back into the shared package. The changelog now says to upgrade core and the transport artifact together. It only covers the Linux transport, I haven't added a macOS equivalent. |
fd3e1e4 to
f958b5a
Compare
maxlambrecht
left a comment
There was a problem hiding this comment.
Thanks for adding the regression test and changelog note. I found two issues in the test setup:
- ModulePathTest skips on JDK 22 even though jdk.crypto.ec exists, because it isn’t resolved in the boot layer. Reintroducing the split package still leaves the build green with the test skipped. Using ModuleFinder.ofSystem() as the resolution fallback makes it run. Please include system modules in resolution and only skip when the module is actually absent.
- Accessing configurations.modulePath inside doFirst fails when Gradle’s configuration cache is enabled. Moving the system-property assignment into task configuration, while keeping the tracked inputs, fixes it.
The runtime changes still look good. These are the remaining issues I found before approval.
…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>
Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
f958b5a to
ed51651
Compare
|
thx, both fixed in e70e425. Resolution now falls back to the system modules and only skips when jdk.crypto.ec is really missing, and the module path property is set at configuration time. It runs here with the configuration cache on. |
…ration time Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
maxlambrecht
left a comment
There was a problem hiding this comment.
Thanks for addressing both points.
LGTM!
Fixes #108
The
grpc-netty-*modules each shipped their ownGrpcManagedChannelFactoryandManagedChannelWrapperinio.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.ManagedChannelWrappernow lives in core and takes a plain close hook instead of a NettyEventLoopGroup, since the Linux module uses shaded Netty and the macOS ones don't. Core has a smallGrpcChannelProviderinterface, each module implements it in its own package (internal.linux,internal.macos,internal.macos.aarch64) and registers it inMETA-INF/services, andGrpcManagedChannelFactoryloads it withServiceLoader. 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.DefaultWorkloadApiClientis unchanged, and core only needs agrpc-nettymodule 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 onlycompileOnlycore, so their published POMs stay the same. Mixing a new core with an oldgrpc-netty-*jar won't work, but the README and the BOM already say those versions have to match.