Commit graph

30 commits

Author SHA1 Message Date
Pat Gavlin
d5e6d2206b
[codegen/go] Improve codegen performance. (#7546)
- Track which languages have been imported for a package. If a language
  has already been imported, do not re-run its importers.
- Track which package contexts have been loaded in the Go code
  generator, and do not reload a context that already exists.

These changes shave a profound amount of time off of codegen in
azure-native, speeding things up by a factor of 5.
2021-07-16 07:50:35 -07:00
Pat Gavlin
7b1d6ec1ac
Reify Input and Optional types in the schema type system. (#7059)
These changes support arbitrary combinations of input + plain types
within a schema. Handling plain types at the property level was not
sufficient to support such combinations. Reifying these types
required updating quite a bit of code. This is likely to have caused
some temporary complications, but should eventually lead to
substantial simplification in the SDK and program code generators.

With the new design, input and optional types are explicit in the schema
type system. Optionals will only appear at the outermost level of a type
(i.e. Input<Optional<>>, Array<Optional<>>, etc. will not occur). In
addition to explicit input types, each object type now has a "plain"
shape and an "input" shape. The former uses only plain types; the latter
uses input shapes wherever a plain type is not specified. Plain types
are indicated in the schema by setting the "plain" property of a type spec
to true.
2021-06-24 09:17:55 -07:00
James Nugent
3e3e4f2deb
Permit Go program gen to work with modules at v1 (#6855)
This commit adjusts the way that Go module versions are discovered from
packages when generating Go programs, to account for those on module
version 1. Previously, this function would panic when dereferencing a
nil instance of semver.Version.
2021-04-26 19:19:43 -07:00
pulumi-bot
73a66f48ea [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
Vivek Lakshmanan
6566b9058e Fix base import path handling in go programgen 2021-01-20 16:04:33 -08:00
Vivek Lakshmanan
6259bc0e8d Remove unnecessary local copy of stringSet 2021-01-12 14:28:50 -08:00
Vivek Lakshmanan
e49ba01f8f PR comments 2020-10-06 16:13:49 -07:00
Vivek Lakshmanan
739b664046 Add support for go config generation 2020-10-05 22:55:41 -07:00
Vivek Lakshmanan
a7680884eb Allow ImportBasePath to override presumed golang import path 2020-09-18 12:48:14 -07:00
Vivek Lakshmanan
2a23af6892 Fix panics when running invokes with modules containing slashes 2020-09-18 11:15:56 -07:00
Evan Boyle
0f98bac105
fix unchecked type assertion (#5194) 2020-08-19 13:58:13 -07:00
Pat Gavlin
e5f44a7b0c
Use a package map where appropriate (#5127)
* Use a package map where appropriate

* Fix imports

* handle NoneType for literal value expressions in go program gen

* add operator tests for c#, python, and node

Co-authored-by: evanboyle <evan@pulumi.com>
2020-08-06 19:09:18 -07:00
Pat Gavlin
63db7e0d46 Use the existing contexts map. 2020-08-05 16:11:12 -07:00
evanboyle
9425016521 add todos 2020-08-05 15:50:07 -07:00
evanboyle
2c350b08d8 lint 2020-08-05 15:31:12 -07:00
evanboyle
2f71fbbf2d traverse object and tuple cons expressions for imports 2020-08-05 15:23:36 -07:00
evanboyle
8af3be1e3f account for import aliases in program expressions 2020-08-05 12:44:46 -07:00
evanboyle
e2e6db47f7 use import aliases in Go program gen 2020-08-05 11:42:38 -07:00
Evan Boyle
395a68e0f6
[Go program gen]: namespaceless resources (#4915) 2020-06-29 18:10:34 -07:00
Pat Gavlin
69ba47cff2
[codegen/*] Add support for resource options. (#4925)
The PCL binder has supported resource options for some time, but these
options haven't been used or processed by the various code generators.
These options--particularly the parent and provider options0--are
critical for import codegen. These changes implement the basic set of
options, and add a note about fleshing out the rest as necessary.

One component of these changes is a new rewriter that rewrites property
references into property paths that are understood by the Pulumi engine.
This rewriter is used to preprocess the contents of the `ignoreChanges`
resource option.

These changes also hack around a weakness in the HCL2 type system:
In Go, references to resources should be typed as `hcl2.ResourceType`.
Unfortunately, this breaks the existing collection semantics associated
with resources. Because of this, the Go code generator does not have
enough information to know that it should generate a `[]pulumi.Resource`
for lists of resources. These changes hack around that limitation using
a Go-specific opaque type and some hardcoded comparisons in
`argumentTypeName`.

Fixes #4923.
2020-06-29 16:33:52 -07:00
Evan Boyle
31770c3300
go program gen: prompt array conversion, unused range vars, id handling (#4884) 2020-06-24 11:07:26 -07:00
Evan Boyle
b302dbcbca
go program gen: lift expressions where prompt optionals are required (#4875) 2020-06-23 10:59:26 -07:00
Evan Boyle
8b8170252b
[Go Program Gen] multiline strings, get/lookup disambiguation, webserver example (#4850) 2020-06-18 13:34:22 -07:00
Evan Boyle
9cdddd2566
[Go Program Gen] Support for EKS example (#4831) 2020-06-17 17:19:39 -07:00
Evan Boyle
2d61852e4f
Go program gen: resource range, readDir, template strings, etc (#4818) 2020-06-15 23:00:02 -07:00
Evan Boyle
94cd67b564
[Go Program Gen] Improved type handling and invokes (#4749) 2020-06-05 18:52:00 -07:00
Evan Boyle
9b2c6d726d
[Go Program Gen] binary, unary, and conditional expression support (#4716) 2020-05-28 13:47:49 -07:00
Evan Boyle
ea114b04ee
output generation for s3 logging example (#4681) 2020-05-26 07:07:54 -07:00
Evan Boyle
8dd329f57f
Go basic program gen (#4667) 2020-05-21 10:23:33 -07:00
Evan Boyle
0d257bb32d
go gen_program shell + test + sample (#4630) 2020-05-14 08:43:12 -07:00