pulumi / pulumi/pulumi-java

`pulumi package gen-sdk --language java` produces an invalid `gradle.build` with a multi-line package description

Open
#1,758 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/codegen area/sdks kind/bug
Dominant language
Java
Stars
85
Forks
26
Avg merge
11h 49m
Merged PRs (30d)
22

Description

What happened?

When working on pulumi-terraform, I saw that Java failed to build with this error message:

make -C ../../.. install_java_sdk test_integration TAGS=java
gmake: getcwd: No such file or directory
gmake: Entering directory '/Users/ianwahbe/go/src/github.com/pulumi/pulumi-terraform'
cd sdk/java && gradle --console=plain build

Welcome to Gradle 8.13!

Here are the highlights of this release:
 - Daemon JVM auto-provisioning
 - Enhancements for Scala plugin and JUnit testing
 - Improvements for build authors and plugin developers

For more details see https://docs.gradle.org/8.13/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

[Incubating] Problems report is available at: file:///Users/ianwahbe/go/src/github.com/pulumi/pulumi-terraform/sdk/java/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/ianwahbe/go/src/github.com/pulumi/pulumi-terraform/sdk/java/build.gradle' line: 97

* What went wrong:
Could not compile build file '/Users/ianwahbe/go/src/github.com/pulumi/pulumi-terraform/sdk/java/build.gradle'.
> startup failed:
  build file '/Users/ianwahbe/go/src/github.com/pulumi/pulumi-terraform/sdk/java/build.gradle': 97: Unexpected character: '"' @ line 97, column 31.
                     description = "The Terraform provider for Pulumi lets you consume the outputs
                                   ^
  
  1 error


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.13/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 3s
gmake: *** [Makefile:35: build_java] Error 1
gmake: Leaving directory '/Users/ianwahbe/go/src/github.com/pulumi/pulumi-terraform'

The generated build.gradle file contained this block:

publishing {
    publications {
        mainPublication(MavenPublication) {
            groupId = "com.pulumi"
            artifactId = "terraform"
            version = resolvedVersion
            from components.java
            artifact sourcesJar
            artifact javadocJar

            pom {
                inceptionYear = "2022"
                name = "pulumi-terraform"
                packaging = "jar"
                description = "The Terraform provider for Pulumi lets you consume the outputs
contained in Terraform state files from your Pulumi programs.

There is one function per kind of Terraform state backend to consume state from."

                url = "https://github.com/pulumi/pulumi-terraform"
Example

NA

Output of pulumi about

The pulumi about output isn't really relevant, but here is the version:

pulumi version
v3.159.0
Additional context

Multi-line descriptions have not been an issue in other languages, so I would expect this to work here.

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running pulumi package gen-sdk --language java with the multi-line package description and inspect the generated sdk/java/build.gradle, especially the publishing block and its description. Run gradle --console=plain build; done means the generated Gradle file accepts the description and the Java build completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.