Hello. Me and my team are trying to contribute to ...
# contribute
n
Hello. Me and my team are trying to contribute to Pulumi by adding JVM support. I have question - how the language specific classes are being generated in 
sdk/
  folder? I wrote minimal Java code generator (
gen.go
) which generates 
Config.java
 file. Also, I discovered that 
GeneratePackage()
 function is executed only in tests and I guess this is “main entrypoint” for generating files, right? But I found out that code is being generated inside the internal testdata folder. Could you give us some information, how Pulumi team generates language files in 
sdk/
 folder?
b
cc @white-balloon-205
w
Awesome! As I'm sure you are already aware - JVM support for Pulumi is a highly-upvoted request from many members of the broader Pulumi community: https://github.com/pulumi/pulumi/issues/1539. The steps required to bring up support for a new language in Pulumi are outlined at https://github.com/pulumi/pulumi/wiki/New-Language-Bring-Up. The core Pulumi SDK (bullet 2 in the list above) is hand written for each language. All other SDKs (for packages) are auto-generated using the generators in https://github.com/pulumi/pulumi/tree/master/pkg/codegen. The
GeneratePackage
functions for each language are called from the various package generators - including: • https://github.com/pulumi/pulumi-terraform-bridge/blob/30ae8ae5cc2d2f5987854984243c74ace4ccc952/pkg/tfgen/generate.go (for all Terraform Bridged providers) • https://github.com/pulumi/pulumi-azure-native/blob/master/provider/cmd/pulumi-gen-azure-native/main.go (for the Azure Native Provider) • Etc.
👍 1
n
Thank you for very much info! That's all we need right now to continue work 🙂. We'll notify you if we'll have something to show 🙂
b
thank you @white-balloon-205, just to clarify: • content of this directory was hand written or auto generated? https://github.com/pulumi/pulumi/tree/master/sdk/dotnet • if not generated, then what config is generated here if note the one in core: https://github.com/VirtusLab/pulumi/blob/master/pkg/codegen/dotnet/gen.go#L1431 wouldn't want to write a ton of Java by hand just to realize it should be generated ;) also, we've started some basic scaffolding and gRPC generator, here: https://github.com/VirtusLab/pulumi/tree/jvm-lang please advice when is a good time to do a WIP PR :)
b
@brave-dawn-64711 the Core SDKs that are in the first repo you linked are hand written. I believe the SDKs that are auto generated are the ones for the providers. Such as: https://github.com/pulumi/pulumi-aws/tree/master/sdk
👍 1
Note the Config generation you linked is defining a static Config class in the new namespace but is then defining a static readonly Pulumi.Config property, thus assuming that Pulumi.Config is already defined elsewhere.
👍 1
b
thanks, all clear 🙂
when should we start thinking about a PR? (what kind of maturity metric/lvl)
b
@brave-dawn-64711 i think the best time for a PR is when there's a working prototype with some tests @bored-oyster-3147 did a great job with the C# Automation API implementation: https://github.com/pulumi/pulumi/pull/5761
partypus 8bit 1
👍 2
w
It would be good to capture this discussion in https://github.com/pulumi/pulumi/discussions ...
w
Related to @worried-city-86458’s suggestion - @numerous-piano-36614 @brave-dawn-64711 definitely interested to hear if you've made any more progress here. If you'd like to find time for a quick call to discuss plans here - happy to find some time.
👍 1
b
sorry for late response, I was on a small vacation
there is a slow but steady progress to figure out what the c# implementation is doing and how to express it in Java
with an occasional look at other implemeentations
not sure if this is too early for a call, since the implementation does not even compile since it is very incomplete right now
btw. a Slack Connect channel for jvm related discussions, could be an idea, wdyt?
@white-balloon-205 progress report: https://github.com/VirtusLab/pulumi/commits/jvm-lang
Copy code
- 1-to-1-ish port of C# SDK implementation to Java
- mostly complete implementation - Automation API is missing
- it compiles, unit tests run

Current Limitations:
- changes in usage and implementation due to lack of generic types reification in Java
- lack of AsyncLocal
- lack of AsyncIterator
There are a lot of TODOs, also needs rebasing, but there is already a lot of code written and it took a lot longer than I anticipated, so just to be sure no one is duplicating this effort 🙂 Next we'll finish an initial implementation for the code generation and try to generate some providers.
😍 4
b
This is fantastic @brave-dawn-64711 - thank you for this! Can we get you set up for a call with the team to discuss this?
b
Hey! You guys might want to include @limited-rainbow-51650 I know he was working on or planning on working on a barebones Automation API implementation in Java. So that might be your missing piece
To be clear he was going to do Automation API without inline program support (without the core SDK) so he would have minimal to no overlap with your work, but might be worth seeing if there are touchpoints
👍 1
b
@broad-dog-22463 that would be great, we just need to figure out a date, I'm guessing your morning and my evening should work (I'm in UTC +2)
b
Hi @brave-dawn-64711 I personally am working in your timezone for the next 3 weeks but I will need to get someone else in the Pulumi team to come along!
👍 1
w
This is great to see @brave-dawn-64711! I'd love to join as well if we can find a time that works. Perhaps 3PM UTC sometime later this week? Cc also @tall-librarian-49374 who did a lot of work on the .NET SDK and may be interested in joining as well.
👍 1
t
I’m in UTC+2 too
b
works for me
@white-balloon-205 I'm back from holidays, so maybe we could try again with the meeting? :)
w
Yes - let's do it! Any time next week 8am PT work for you? I expect we can pull together the interested folks. Perhaps the 13th?
l
@white-balloon-205 as a community member, I'm interested in a Java version of the Automation API at least. Interested in joining this meeting and I'm able to join at 8AM PT/17h CET on Tuesday. But if doesn't work for others, no problem. I'll follow up via GH issues then. 😉
b
@white-balloon-205 this contribution is my priority right now so I'll make myself available when needed (within reason ofc, and apart from any emergencies); 13th works for me, I'm not superstitious 😉 8 PT / 17 CEST also works fine
w
Great! I've got a Zoom scheduled to talk about this workstream for Oct 13th at 8AM PDT at https://pulumi.zoom.us/j/82164570601?pwd=NW1QSXhLaVM1M2lkT2Z4RnJsQW8yZz09. @brave-dawn-64711 and @numerous-piano-36614 if you DM me your email addresses I'll add you to the invite directly.
1
b
@white-balloon-205 Hand-written Kubernetes provider API for Java prototype, as requested: https://gist.github.com/pawelprazak/61dc14021206aeaee2eb323b1996fba0
🔥 5
lack of reified types required some kind of solution, and those annotations are the cleanest thing I came up with without implementing my own reification
it works with an actual kubernetes 🙂
🎉 1
b
nice work @brave-dawn-64711 🙂
👍 1