diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 5b3c879ac06..b8bac7ca06b 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -14,4 +14,6 @@ - Update `io.github.gradle-nexus.publish-plugin` to 2.0.0 from 1.1.0. -### Bug Fixes \ No newline at end of file +### Bug Fixes + +- Fix the language plugin to return a version diff --git a/Makefile b/Makefile index 0e3baa9ffa1..85ac6d64d12 100644 --- a/Makefile +++ b/Makefile @@ -17,11 +17,15 @@ test_go:: build_go submodule_update bin/pulumi-language-java: ${PKG_FILES} mkdir -p bin - cd pkg && go build -o ../bin github.com/pulumi/pulumi-java/pkg/cmd/pulumi-language-java + cd pkg && go build -o ../bin \ + -ldflags "-X github.com/pulumi/pulumi-java/pkg/version.Version=$(shell pulumictl get version --tag-pattern '^pkg')" \ + github.com/pulumi/pulumi-java/pkg/cmd/pulumi-language-java bin/pulumi-java-gen: ${PKG_FILES} mkdir -p bin - cd pkg && go build -o ../bin -ldflags "-X github.com/pulumi/pulumi-java/pkg/version.Version=$(shell pulumictl get version --tag-pattern '^pkg')" github.com/pulumi/pulumi-java/pkg/cmd/pulumi-java-gen + cd pkg && go build -o ../bin \ + -ldflags "-X github.com/pulumi/pulumi-java/pkg/version.Version=$(shell pulumictl get version --tag-pattern '^pkg')" \ + github.com/pulumi/pulumi-java/pkg/cmd/pulumi-java-gen # Java SDK is a gradle project rooted at `sdk/java` diff --git a/pkg/cmd/pulumi-language-java/main.go b/pkg/cmd/pulumi-language-java/main.go index 3af890ae6b4..98962710fa8 100644 --- a/pkg/cmd/pulumi-language-java/main.go +++ b/pkg/cmd/pulumi-language-java/main.go @@ -29,7 +29,6 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/common/util/fsutil" "github.com/pulumi/pulumi/sdk/v3/go/common/util/logging" "github.com/pulumi/pulumi/sdk/v3/go/common/util/rpcutil" - "github.com/pulumi/pulumi/sdk/v3/go/common/version" "github.com/pulumi/pulumi/sdk/v3/go/common/workspace" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" "golang.org/x/exp/maps" @@ -41,6 +40,7 @@ import ( "github.com/pulumi/pulumi-java/pkg/internal/executors" "github.com/pulumi/pulumi-java/pkg/internal/fsys" hclsyntax "github.com/pulumi/pulumi/pkg/v3/codegen/hcl2/syntax" + "github.com/pulumi/pulumi-java/pkg/version" ) // Launches the language host RPC endpoint, which in turn fires up an RPC server implementing the diff --git a/tests/integration/about/Pulumi.yaml b/tests/integration/about/Pulumi.yaml new file mode 100644 index 00000000000..c7798925071 --- /dev/null +++ b/tests/integration/about/Pulumi.yaml @@ -0,0 +1,3 @@ +name: about +description: An empty project +runtime: java diff --git a/tests/integration/about/pom.xml b/tests/integration/about/pom.xml new file mode 100644 index 00000000000..5a84f7e058d --- /dev/null +++ b/tests/integration/about/pom.xml @@ -0,0 +1,112 @@ + + + 4.0.0 + + com.pulumi.example + about + 1.0-SNAPSHOT + + + UTF-8 + 11 + 11 + 11 + ${project.groupId}.${project.artifactId}.App + + 0.0.1 + + + + + env-dependencies + + + env.PULUMI_JAVA_SDK_VERSION + + + + ${env.PULUMI_JAVA_SDK_VERSION} + + + + + + + com.pulumi + pulumi + ${pulumiSdkVersion} + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.pulumi + random + 4.8.1 + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.2 + + + + true + ${mainClass} + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.3.0 + + + + true + ${mainClass} + + + + jar-with-dependencies + + + + + make-my-jar-with-dependencies + package + + single + + + + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + ${mainClass} + ${mainArgs} + + + + org.apache.maven.plugins + maven-wrapper-plugin + 3.1.0 + + 3.8.5 + + + + + diff --git a/tests/integration/about/src/main/java/com/pulumi/example/about/App.java b/tests/integration/about/src/main/java/com/pulumi/example/about/App.java new file mode 100644 index 00000000000..d4a8308b04b --- /dev/null +++ b/tests/integration/about/src/main/java/com/pulumi/example/about/App.java @@ -0,0 +1,12 @@ +package com.pulumi.example.about; + +import com.pulumi.Pulumi; +import com.pulumi.core.Output; + +public class App { + public static void main(String[] args) { + Pulumi.run(ctx -> { + ctx.export("exampleOutput", Output.of("example")); + }); + } +} diff --git a/tests/integration/java_integration_test.go b/tests/integration/java_integration_test.go index 4f72c509843..c8a89c52c8f 100644 --- a/tests/integration/java_integration_test.go +++ b/tests/integration/java_integration_test.go @@ -12,10 +12,25 @@ import ( "github.com/pulumi/pulumi/pkg/v3/testing/integration" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + ptesting "github.com/pulumi/pulumi/sdk/v3/go/common/testing" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" ) func TestIntegrations(t *testing.T) { + t.Run("about", func(t *testing.T) { + t.Parallel() + + e := ptesting.NewEnvironment(t) + defer e.DeleteIfNotFailed() + + e.ImportDirectory(filepath.Join(getCwd(t), "about")) + + stdout, stderr := e.RunCommand("pulumi", "about") + // There should be no "unknown" plugin versions. + assert.NotContains(t, stdout, "unknown") + assert.NotContains(t, stderr, "unknown") + }) + t.Run("stack-reference", func(t *testing.T) { dir := filepath.Join(getCwd(t), "stack-reference") test := getJavaBase(t, integration.ProgramTestOptions{