From 4747db861f61bdcb9640c7090d7e4bdbdb4749c3 Mon Sep 17 00:00:00 2001 From: Andrzej Ressel Date: Mon, 12 Aug 2024 00:26:37 +0200 Subject: [PATCH 1/3] Add cyclic-types output --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dcacc39c..260301fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,7 +107,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Ensure no files have changed - run: git diff --exit-code + run: git add -A && git diff --exit-code - uses: actions/upload-artifact@v4 with: From d768761aa0d9d8cd1c0cd1896470bca8b9ca6971 Mon Sep 17 00:00:00 2001 From: Andrzej Ressel Date: Mon, 12 Aug 2024 00:29:16 +0200 Subject: [PATCH 2/3] Add cyclic-types output --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 260301fb..23d0e543 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,7 +107,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Ensure no files have changed - run: git add -A && git diff --exit-code + run: git add . && git diff --quiet && git diff --cached --quiet - uses: actions/upload-artifact@v4 with: From 8b0ab4841f6f43918c59eedc21a9f376f65841a5 Mon Sep 17 00:00:00 2001 From: Andrzej Ressel Date: Mon, 12 Aug 2024 00:33:53 +0200 Subject: [PATCH 3/3] Add cyclic-types output --- .../tests/output/cyclic-types/Cargo.toml | 18 ++++++ .../tests/output/cyclic-types/lib/Cargo.toml | 13 +++++ .../tests/output/cyclic-types/lib/src/lib.rs | 11 ++++ .../output/cyclic-types/lib/src/resource.rs | 0 .../output/cyclic-types/lib/src/types.rs | 47 ++++++++++++++++ .../cyclic-types/lib/wit/deps/pulumi-wasm.wit | 43 +++++++++++++++ .../output/cyclic-types/lib/wit/world.wit | 9 +++ .../output/cyclic-types/provider/Cargo.toml | 23 ++++++++ .../output/cyclic-types/provider/src/lib.rs | 4 ++ .../provider/wit/deps/pulumi-wasm.wit | 43 +++++++++++++++ .../cyclic-types/provider/wit/world.wit | 9 +++ .../output/cyclic-types/rust-toolchain.toml | 3 + .../tests/output/cyclic-types/schema.yaml | 55 +++++++++++++++++++ .../tests/output/cyclic-types/src/lib.rs | 0 14 files changed, 278 insertions(+) create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/Cargo.toml create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/Cargo.toml create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/lib.rs create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/resource.rs create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/types.rs create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/wit/deps/pulumi-wasm.wit create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/wit/world.wit create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/Cargo.toml create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/src/lib.rs create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/wit/deps/pulumi-wasm.wit create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/wit/world.wit create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/rust-toolchain.toml create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/schema.yaml create mode 100644 pulumi_wasm_generator_lib/tests/output/cyclic-types/src/lib.rs diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/Cargo.toml b/pulumi_wasm_generator_lib/tests/output/cyclic-types/Cargo.toml new file mode 100644 index 00000000..fceab158 --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "main" +version = "0.0.1" +edition = "2021" + +[workspace] +members = [ + "provider", + "lib" +] + +[workspace.dependencies] +wit-bindgen-rt = "0.27.0" +wit-bindgen = "0.27.0" +automod = "1.0.14" +pulumi_wasm_common = { path = "../../../../pulumi_wasm_common" } +pulumi_wasm_rust = { path = "../../../../pulumi_wasm_rust" } +serde = "1.0.197" \ No newline at end of file diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/Cargo.toml b/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/Cargo.toml new file mode 100644 index 00000000..9d5e0ddd --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "pulumi_wasm_example" +version = "0.0.1-0.0.0-DEV" +edition = "2021" + +[dependencies] +wit-bindgen.workspace = true +pulumi_wasm_rust.workspace = true +serde.workspace = true +automod.workspace = true + +[package.metadata.pulumi] +related_crate = "pulumi_wasm_example_provider" diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/lib.rs b/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/lib.rs new file mode 100644 index 00000000..a6902757 --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/lib.rs @@ -0,0 +1,11 @@ +use pulumi_wasm_rust::Output; +pub mod resource; +pub mod types; + +mod bindings { + wit_bindgen::generate!({ + // the name of the world in the `*.wit` input file + world: "example-pulumi-client", + }); +} + diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/resource.rs b/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/resource.rs new file mode 100644 index 00000000..e69de29b diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/types.rs b/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/types.rs new file mode 100644 index 00000000..568c0882 --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/types.rs @@ -0,0 +1,47 @@ + +#[derive(serde::Serialize)] +pub struct AcyclicReferent { + #[serde(rename = "bar")] + pub r#bar: Box, + #[serde(rename = "baz")] + pub r#baz: Box, + #[serde(rename = "foo4")] + pub r#foo_4: Box, +} + + +#[derive(serde::Serialize)] +pub struct AcyclicS { + #[serde(rename = "foo5")] + pub r#foo_5: Box, +} + + +#[derive(serde::Serialize)] +pub struct AcyclicT { + #[serde(rename = "foo6")] + pub r#foo_6: Box, +} + + +#[derive(serde::Serialize)] +pub struct DirectCycle { + #[serde(rename = "foo")] + pub r#foo: Box, +} + + +#[derive(serde::Serialize)] +pub struct IndirectCycleS { + #[serde(rename = "foo2")] + pub r#foo_2: Box, +} + + +#[derive(serde::Serialize)] +pub struct IndirectCycleT { + #[serde(rename = "foo3")] + pub r#foo_3: Box, +} + + diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/wit/deps/pulumi-wasm.wit b/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/wit/deps/pulumi-wasm.wit new file mode 100644 index 00000000..9fad235d --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/wit/deps/pulumi-wasm.wit @@ -0,0 +1,43 @@ +package component:pulumi-wasm@0.0.0-DEV; + +interface output-interface { + + resource output { + constructor(value: string); + map: func(function-name: string) -> output; + duplicate: func() -> output; + } + combine: func(outputs: list) -> output; +} + + +interface register-interface { + use output-interface.{output}; + + record object-field { + name: string, + value: borrow + } + + record result-field { + name: string + } + + record register-resource-result-field { + name: string, + output: output + } + + record register-resource-request { + %type: string, + name: string, + object: list, + results: list + } + + record register-resource-result { + fields: list + } + + register: func(request: register-resource-request) -> register-resource-result; +} \ No newline at end of file diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/wit/world.wit new file mode 100644 index 00000000..626db78a --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/wit/world.wit @@ -0,0 +1,9 @@ +package pulumi:example@0.0.1-ZERO.ZERO.ZERO-DEV; + +world example-pulumi { + import component:pulumi-wasm/register-interface@0.0.0-DEV; +} + +world example-pulumi-client { +} + diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/Cargo.toml b/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/Cargo.toml new file mode 100644 index 00000000..a86da420 --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "pulumi_wasm_example_provider" +version = "0.0.1-0.0.0-DEV" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +crate-type = ["cdylib"] + +[dependencies] +wit-bindgen-rt.workspace = true +pulumi_wasm_common.workspace = true + +[package.metadata.component] +package = "pulumi:example" + +[package.metadata.component.target] +path = "wit" +world = "example-pulumi" + +[package.metadata.component.target.dependencies] +"component:pulumi-wasm" = { path = "wit/deps/pulumi-wasm.wit" } diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/src/lib.rs b/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/src/lib.rs new file mode 100644 index 00000000..ffdeafac --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/src/lib.rs @@ -0,0 +1,4 @@ + + +struct Component {} + diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/wit/deps/pulumi-wasm.wit b/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/wit/deps/pulumi-wasm.wit new file mode 100644 index 00000000..9fad235d --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/wit/deps/pulumi-wasm.wit @@ -0,0 +1,43 @@ +package component:pulumi-wasm@0.0.0-DEV; + +interface output-interface { + + resource output { + constructor(value: string); + map: func(function-name: string) -> output; + duplicate: func() -> output; + } + combine: func(outputs: list) -> output; +} + + +interface register-interface { + use output-interface.{output}; + + record object-field { + name: string, + value: borrow + } + + record result-field { + name: string + } + + record register-resource-result-field { + name: string, + output: output + } + + record register-resource-request { + %type: string, + name: string, + object: list, + results: list + } + + record register-resource-result { + fields: list + } + + register: func(request: register-resource-request) -> register-resource-result; +} \ No newline at end of file diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/wit/world.wit b/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/wit/world.wit new file mode 100644 index 00000000..626db78a --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/provider/wit/world.wit @@ -0,0 +1,9 @@ +package pulumi:example@0.0.1-ZERO.ZERO.ZERO-DEV; + +world example-pulumi { + import component:pulumi-wasm/register-interface@0.0.0-DEV; +} + +world example-pulumi-client { +} + diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/rust-toolchain.toml b/pulumi_wasm_generator_lib/tests/output/cyclic-types/rust-toolchain.toml new file mode 100644 index 00000000..349d2cec --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.80.1" +targets = ["wasm32-wasip1"] \ No newline at end of file diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/schema.yaml b/pulumi_wasm_generator_lib/tests/output/cyclic-types/schema.yaml new file mode 100644 index 00000000..6f5ca6b9 --- /dev/null +++ b/pulumi_wasm_generator_lib/tests/output/cyclic-types/schema.yaml @@ -0,0 +1,55 @@ +version: "0.0.1" +name: example +types: + example::DirectCycle: + type: object + properties: + foo: + $ref: "#/types/example::DirectCycle" + required: [ foo ] + example::IndirectCycleS: + type: object + properties: + foo2: + $ref: "#/types/example::IndirectCycleT" + required: [ foo2 ] + example::IndirectCycleT: + type: object + properties: + foo3: + $ref: "#/types/example::IndirectCycleS" + required: [ foo3 ] + example::AcyclicReferent: + type: object + properties: + foo4: + $ref: "#/types/example::DirectCycle" + bar: + $ref: "#/types/example::IndirectCycleS" + baz: + $ref: "#/types/example::IndirectCycleT" + required: [ foo4, bar, baz ] + example::AcyclicS: + type: object + properties: + foo5: + type: string + required: [ foo5 ] + example::AcyclicT: + type: object + properties: + foo6: + $ref: "#/types/example::AcyclicS" + required: [ foo6 ] +language: + go: + { + "importBasePath": "cyclic-types/example", + "generateExtraInputTypes": true, + } + nodejs: + { + "dependencies": { "@pulumi/pulumi": "^3.12" }, + "devDependencies": { "typescript": "^3.7.0" }, + } + python: {} diff --git a/pulumi_wasm_generator_lib/tests/output/cyclic-types/src/lib.rs b/pulumi_wasm_generator_lib/tests/output/cyclic-types/src/lib.rs new file mode 100644 index 00000000..e69de29b