Align default gson dependency version in generated provider SDKs with core SDK - #2284
Open
eon-pulumi-agent[bot] wants to merge 2 commits into
Open
Align default gson dependency version in generated provider SDKs with core SDK#2284eon-pulumi-agent[bot] wants to merge 2 commits into
eon-pulumi-agent[bot] wants to merge 2 commits into
Conversation
… core SDK Generated provider SDKs (build.gradle) declared a hardcoded default dependency on com.google.code.gson:gson:2.8.9, while the core Pulumi Java SDK (com.pulumi:pulumi) has since moved on to gson:2.10. Because these are declared at the same depth in a consumer's dependency graph, Maven resolves the version based on pom.xml declaration order (first declared wins on a tie), so a Maven user could get a different, non-deterministic gson version depending on the order in which they listed their provider and the pulumi dependency. This is the same class of bug reported in #812 (guava/grpc-netty version skew based on dependency order caused a program hang). The guava mismatch was fixed shortly after that issue was filed by dropping the default guava dependency from generated provider SDKs, but the gson defaults were never kept in sync with the core SDK's pinned version. Bump both the core SDK's pinned gson version and the codegen default to gson:2.10.1 (a real published, semver-parseable Gson release) so they match exactly and Maven resolves the same version regardless of pom.xml ordering.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Bumps the hardcoded default
com.google.code.gson:gsondependency version that the Java code generator injects into generated provider SDKs (build.gradle) from2.8.9to2.10.1, and bumps the core SDK's own pin insdk/java/pulumi/build.gradlefrom2.10to2.10.1so the two now match exactly.Why (relates to #812)
#812 reports a Maven program hanging depending on whether a provider (e.g.
azure-native) orcom.pulumi:pulumiis listed first inpom.xml. The root cause identified in that thread was that generated provider SDKs pulled in different transitive versions ofguava/gsonthan the core Pulumi Java SDK, and since these end up at the same depth in the dependency graph, Maven's dependency mediation breaks the tie using declaration order, so the resolved version (and thus runtime behavior) depended onpom.xmlordering.The
guavahalf of that problem was fixed shortly after the issue was filed (generated provider SDKs no longer declare a defaultguavadependency at all, so there's no more guava/grpc-netty classpath conflict — I verified this is no longer order-dependent with the current publishedcom.pulumi:azure-nativeandcom.pulumi:pulumiartifacts).However,
gsonwas never brought back in sync:pkg/codegen/java/package_info.gostill defaulted generated provider SDKs togson:2.8.9, while the core SDK'sbuild.gradlehas since moved togson:2.10. I reproduced this with the real, currently-published Maven Central artifacts — the resolvedgsonversion differed (2.8.9vs2.10) purely based on which dependency was listed first in a testpom.xml.gson:2.10isn't representable through thesemver.Versiontype used here (Gson dropped the patch component for that release), so this change moves both pins togson:2.10.1, a real, three-component, semver-parseable Gson release, so they line up exactly.Testing
cd sdk/java && gradle build— core SDK unit tests pass with the new gson pin.cd pkg/codegen/java && go test ./...(i.e.make codegen_tests) — full suite passes, including realgradle build/gradle testcompiles of ~80 generated SDK fixtures against the new default.PULUMI_ACCEPT=trueregenerated the 35 goldenbuild.gradlefixtures affected; each diff is exactly the one-line version bump.golangci-lint run— clean.gsonnow resolves identically either way.Note on the original "hang"
The exact hang described in #812 was almost certainly caused by the
guavamismatch, which is already fixed onmain. This PR closes out the remaining, more minorgsonskew so generated provider SDKs stay fully consistent with the core SDK going forward, and adds a comment toWithDefaultDependenciesexplaining why these versions must be kept in sync, referencing this issue.Created with Eon