pulumi/pkg/cmd/pulumi
Will Jones 34eac65c20
Only use gRPC to communicate with the Java host (#18138)
Language hosts are an important part of the Pulumi ecosystem,
encapsulating language-specific concerns such as program execution,
plugin hosting, and code generation, and exposing these as a gRPC
service.

Presently, we abuse the fact that the Java language host (along with all
other Pulumi-maintained language hosts) is written in Go to invoke some
of its functionality _directly_---that is, as linked in-memory function
calls---by having `pulumi/pulumi` depend on `pulumi/pulumi-java` in its
`go.mod`. This is undesirable for several reasons -- it creates
unnecessary coupling (indeed, a very annoying cyclic dependency),
requires special-casing in various parts of the CLI, and is hard to
test. In this change, therefore, we switch out these in-memory calls for
"proper" gRPC ones. Specifically:

* `pulumi convert` and `pulumi import` will now call `GenerateProject`
and `GenerateProgram` (Programgen) over a gRPC wire.
* `pulumi package gen-sdk` will now call `GeneratePackage` (SDKgen) over
a gRPC wire.
* `pulumi-java` is removed as a dependency from `go.mod`(s).
`pulumi-java`'s version is now explicitly tracked in the
`scripts/get-language-providers.sh` script (which also becomes simpler
now we have no `go.mod`-dependency-hosts any more).

Aside from the fact that calls are now being made over a network
connection, behaviour should be identical:

* The gRPC implementations of `GenerateProgram` and `GenerateProject`
(found in `pkg/cmd/pulumi-language-java/main.go` in `pulumi-java`) call
the currently used in-memory function as-is, with no surrounding code
except for deserialization of inputs and binding of PCL.
* The gRPC implementation of `GeneratePackage` performs a single
operation aside from deserialization and binding -- name deduplication.
This is the same function as that performed by the `pulumi-java-gen`
binary that is currently used to generate Java SDKs (until now,
`gen-sdk` has not been used _at all_---in-memory or otherwise---due to
this and other issues; see
https://github.com/pulumi/pulumi-java/issues/1508). As a result, this
should now be a suitable replacement for `pulumi-java-gen` and the
correct implementation for `gen-sdk`.

With this, we can remove the cyclic dependency, get rid of
`pulumi-java-gen` and clean up several bits of bespoke code. Rock on,
Java!

> [!NOTE]
> Aside from Java conformance tests giving us confidence, `pulumi
package gen-sdk` has been manually tested with `pulumi-azure-native`,
which is referenced in
https://github.com/pulumi/pulumi-java/issues/1508.

Fixes https://github.com/pulumi/pulumi-java/issues/1508
2025-01-03 16:48:13 +00:00
..
about Check language plugins in about tests (#18007) 2024-12-11 17:45:19 +00:00
ai Break out `pulumi ai` (#17942) 2024-12-06 14:35:46 +00:00
auth Break out the `login` and `logout` commands (#17975) 2024-12-12 10:45:16 +00:00
backend Break out `cmd`-level backend code (#17926) 2024-12-05 13:43:53 +00:00
cancel Break out the `cancel` command (#17983) 2024-12-16 18:02:52 +00:00
cmd Check language plugins in about tests (#18007) 2024-12-11 17:45:19 +00:00
completion Break out remaining commands (#17989) 2024-12-18 14:32:47 +00:00
config Break out `config ...` commands into their own package (#17952) 2024-12-10 10:05:04 +00:00
console Break out the `console` command (#17981) 2024-12-16 13:22:46 +00:00
convert Only use gRPC to communicate with the Java host (#18138) 2025-01-03 16:48:13 +00:00
deployment Break out the `deployment ...` command hierarchy (#17968) 2024-12-11 11:14:05 +00:00
diag Break out diagnostic printing functions in `pkg/cmd` (#17966) 2024-12-10 15:29:37 +00:00
env Break out the `env` command (#17988) 2024-12-18 12:22:41 +00:00
events Break out the `replay-events` command (#17985) 2024-12-17 13:22:58 +00:00
install Break out the `install` command (#17984) 2024-12-17 11:01:32 +00:00
logs Break out the `logs` command (#17976) 2024-12-12 12:55:42 +00:00
markdown Break out remaining commands (#17989) 2024-12-18 14:32:47 +00:00
metadata Check language plugins in about tests (#18007) 2024-12-11 17:45:19 +00:00
newcmd return a more meaningful message for new --language (#18092) 2024-12-23 09:18:29 +00:00
operations Only use gRPC to communicate with the Java host (#18138) 2025-01-03 16:48:13 +00:00
org Break out the `org ...` command hierarchy (#17954) 2024-12-10 13:36:39 +00:00
packagecmd Only use gRPC to communicate with the Java host (#18138) 2025-01-03 16:48:13 +00:00
plan Break out plan I/O from `pkg/cmd/pulumi/util` (#17912) 2024-12-04 12:46:21 +00:00
plugin add NewPluginSpec helper function (#17798) 2025-01-02 11:38:44 +00:00
policy Break out the `policy ...` command hierarchy (#17978) 2024-12-13 15:43:58 +00:00
query Break out the `query` command (#17987) 2024-12-18 10:04:56 +00:00
schema Break out the `schema ...` hierarchy (#17986) 2024-12-17 14:50:05 +00:00
stack Check language plugins in about tests (#18007) 2024-12-11 17:45:19 +00:00
state Check language plugins in about tests (#18007) 2024-12-11 17:45:19 +00:00
testdata/fuzz/FuzzPowershellStackOutputWriter Break out the `policy ...` command hierarchy (#17978) 2024-12-13 15:43:58 +00:00
trace Break out `*-trace` commands (#17974) 2024-12-11 16:18:56 +00:00
ui Break out the `stack ...` command hierarchy (#17951) 2024-12-09 18:58:26 +00:00
version Break out the `version` command (#17980) 2024-12-16 12:01:54 +00:00
whoami Break out the `whoami ...` command hierarchy (#17969) 2024-12-11 12:37:55 +00:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
main.go Check language plugins in about tests (#18007) 2024-12-11 17:45:19 +00:00
pulumi.go Break out remaining commands (#17989) 2024-12-18 14:32:47 +00:00
pulumi_test.go Check language plugins in about tests (#18007) 2024-12-11 17:45:19 +00:00