From 70b3fb34188d4a73a923197dc7b3d7f03dd86ae5 Mon Sep 17 00:00:00 2001 From: Thomas Meckel <14177833+tmeckel@users.noreply.github.com> Date: Wed, 12 Jun 2024 20:23:03 +0200 Subject: [PATCH] fix: add support for pluginDownloadURL from schema.json (#1365) # Description This PR will fix the issue described in #1109. updated `build.gradle` code with `info.metaClass.server` ![image](https://github.com/pulumi/pulumi-java/assets/14177833/f426a845-b078-45d9-b6d9-5a1866fb993a) generated `plugin.json`: ![image](https://github.com/pulumi/pulumi-java/assets/14177833/a6820aea-2fad-4156-b5c4-b549366f6fd0) Fixes #1109 ## Checklist - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the [CHANGELOG-PENDING](https://github.com/pulumi/pulumi/blob/master/CHANGELOG_PENDING.md) file with my change - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version --------- Co-authored-by: Thomas Meckel Co-authored-by: Anton Tayanovskyy --- CHANGELOG_PENDING.md | 2 ++ pkg/codegen/java/build.gradle.template | 5 ++++- pkg/codegen/java/templates_gradle.go | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 5ecddce9258..dfd3ce3ed2d 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -1,3 +1,5 @@ ### Improvements +- Codegen: pluginDownloadURL is now supported through the automatically generated build.gradle + ### Bug Fixes diff --git a/pkg/codegen/java/build.gradle.template b/pkg/codegen/java/build.gradle.template index fa1e2fa8b53..1f746c5208c 100644 --- a/pkg/codegen/java/build.gradle.template +++ b/pkg/codegen/java/build.gradle.template @@ -77,6 +77,9 @@ def genPulumiResources = tasks.register('genPulumiResources') { def info = new Object() info.metaClass.resource = true info.metaClass.name = "{{ .ArtifactID }}" + {{- if .PluginDownloadURL }} + info.metaClass.server = "{{ .PluginDownloadURL }}" + {{- end }} info.metaClass.version = resolvedVersion def infoJson = new groovy.json.JsonBuilder(info).toPrettyString() new File(outDir, "plugin.json").text = infoJson @@ -192,4 +195,4 @@ if (signingKey) { useInMemoryPgpKeys(signingKey, signingPassword) sign publishing.publications.mainPublication } -} \ No newline at end of file +} diff --git a/pkg/codegen/java/templates_gradle.go b/pkg/codegen/java/templates_gradle.go index 01d3c96b983..24b42bc3704 100644 --- a/pkg/codegen/java/templates_gradle.go +++ b/pkg/codegen/java/templates_gradle.go @@ -83,6 +83,7 @@ type gradleTemplateContext struct { GradleNexusPublishPluginEnabled bool GradleNexusPublishPluginVersion string GradleTestJUnitPlatformEnabled bool + PluginDownloadURL string } func newGradleTemplateContext( @@ -95,6 +96,7 @@ func newGradleTemplateContext( ProjectURL: pkg.Repository, ProjectGitURL: formatGitURL(pkg.Repository), GradleTestJUnitPlatformEnabled: packageInfo.GradleTest == "JUnitPlatform", + PluginDownloadURL: pkg.PluginDownloadURL, } if packageInfo.GradleNexusPublishPluginVersion != "" {