Skip to content

Commit

Permalink
fix: add support for pluginDownloadURL from schema.json (#1365)
Browse files Browse the repository at this point in the history
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# 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)


<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

Fixes #1109

## Checklist

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have updated the
[CHANGELOG-PENDING](https://github.com/pulumi/pulumi/blob/master/CHANGELOG_PENDING.md)
file with my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Service,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Service API version
<!-- @pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->

---------

Co-authored-by: Thomas Meckel <[email protected]>
Co-authored-by: Anton Tayanovskyy <[email protected]>
  • Loading branch information
3 people authored Jun 12, 2024
1 parent 3dfcde4 commit 70b3fb3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### Improvements

- Codegen: pluginDownloadURL is now supported through the automatically generated build.gradle

### Bug Fixes
5 changes: 4 additions & 1 deletion pkg/codegen/java/build.gradle.template
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -192,4 +195,4 @@ if (signingKey) {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mainPublication
}
}
}
2 changes: 2 additions & 0 deletions pkg/codegen/java/templates_gradle.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type gradleTemplateContext struct {
GradleNexusPublishPluginEnabled bool
GradleNexusPublishPluginVersion string
GradleTestJUnitPlatformEnabled bool
PluginDownloadURL string
}

func newGradleTemplateContext(
Expand All @@ -95,6 +96,7 @@ func newGradleTemplateContext(
ProjectURL: pkg.Repository,
ProjectGitURL: formatGitURL(pkg.Repository),
GradleTestJUnitPlatformEnabled: packageInfo.GradleTest == "JUnitPlatform",
PluginDownloadURL: pkg.PluginDownloadURL,
}

if packageInfo.GradleNexusPublishPluginVersion != "" {
Expand Down

0 comments on commit 70b3fb3

Please sign in to comment.