Skip to content

Commit

Permalink
Rewriting final component generation (#331)
Browse files Browse the repository at this point in the history
Closes #260
Closes #327
  • Loading branch information
andrzejressel authored Aug 18, 2024
1 parent d1ce7a2 commit 9c867c2
Show file tree
Hide file tree
Showing 30 changed files with 2,555 additions and 1,781 deletions.
306 changes: 175 additions & 131 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ members = [
"pulumi_wasm_generator_lib",
"pulumi_wasm_proto",
"pulumi_wasm_runner",
"pulumi_wasm_runner_component_creator",
"pulumi_wasm_rust",
"pulumi_wasm_rust_macro",
"pulumi_wasm_wit",
Expand All @@ -48,6 +49,7 @@ pulumi_wasm_rust_macro = { version = "=0.0.0-DEV", path = "pulumi_wasm_rust_macr
pulumi_wasm_common = { version = "=0.0.0-DEV", path = "pulumi_wasm_common", registry = "cloudsmith" }
pulumi_wasm_proto = { version = "=0.0.0-DEV", path = "pulumi_wasm_proto", registry = "cloudsmith" }
pulumi_wasm_wit = { version = "=0.0.0-DEV", path = "pulumi_wasm_wit", registry = "cloudsmith" }
pulumi_wasm_runner_component_creator = { version = "=0.0.0-DEV", path = "pulumi_wasm_runner_component_creator", registry = "cloudsmith" }

anyhow = "1.0.82"
prost = "0.13.1"
Expand Down Expand Up @@ -92,4 +94,7 @@ wac-graph = "0.5.0"
serde_yaml = "0.9.33"
prettyplease = "0.2.20"
directories = "5.0"
reqwest = "0.12.5"
reqwest = "0.12.5"
wit-component = "0.215.0"
wit-parser = "0.215.0"
wasmprinter = "0.215.0"
1 change: 1 addition & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ publish:
cargo publish -p pulumi_wasm_generator_lib --allow-dirty --all-features
cargo publish -p pulumi_wasm_generator --allow-dirty --all-features
cargo publish -p pulumi_wasm_core --allow-dirty --all-features
cargo publish -p pulumi_wasm_runner_component_creator --allow-dirty --all-features
cargo publish -p pulumi_wasm_runner --allow-dirty --all-features
just publish-providers

Expand Down
2,380 changes: 1,196 additions & 1,184 deletions providers/pulumi_wasm_provider_cloudflare/src/bindings.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion providers/pulumi_wasm_provider_cloudflare/wit/world.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pulumi:cloudflare@5.24.1-ZERO.ZERO.ZERO-DEV;
package pulumi:cloudflare@5.24.1-DIVIDER-ZERO.ZERO.ZERO-DEV;

world cloudflare-pulumi {
import component:pulumi-wasm/register-interface@0.0.0-DEV;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pulumi:cloudflare@5.24.1-ZERO.ZERO.ZERO-DEV;
package pulumi:cloudflare@5.24.1-DIVIDER-ZERO.ZERO.ZERO-DEV;

world cloudflare-pulumi {
import component:pulumi-wasm/register-interface@0.0.0-DEV;
Expand Down
215 changes: 108 additions & 107 deletions providers/pulumi_wasm_provider_docker/src/bindings.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion providers/pulumi_wasm_provider_docker/wit/world.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pulumi:docker@4.5.3-ZERO.ZERO.ZERO-DEV;
package pulumi:docker@4.5.3-DIVIDER-ZERO.ZERO.ZERO-DEV;

world docker-pulumi {
import component:pulumi-wasm/register-interface@0.0.0-DEV;
Expand Down
2 changes: 1 addition & 1 deletion providers/pulumi_wasm_provider_docker_rust/wit/world.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pulumi:docker@4.5.3-ZERO.ZERO.ZERO-DEV;
package pulumi:docker@4.5.3-DIVIDER-ZERO.ZERO.ZERO-DEV;

world docker-pulumi {
import component:pulumi-wasm/register-interface@0.0.0-DEV;
Expand Down
153 changes: 77 additions & 76 deletions providers/pulumi_wasm_provider_random/src/bindings.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion providers/pulumi_wasm_provider_random/wit/world.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pulumi:random@4.15.0-ZERO.ZERO.ZERO-DEV;
package pulumi:random@4.15.0-DIVIDER-ZERO.ZERO.ZERO-DEV;

world random-pulumi {
import component:pulumi-wasm/register-interface@0.0.0-DEV;
Expand Down
2 changes: 1 addition & 1 deletion providers/pulumi_wasm_provider_random_rust/wit/world.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pulumi:random@4.15.0-ZERO.ZERO.ZERO-DEV;
package pulumi:random@4.15.0-DIVIDER-ZERO.ZERO.ZERO-DEV;

world random-pulumi {
import component:pulumi-wasm/register-interface@0.0.0-DEV;
Expand Down
3 changes: 3 additions & 0 deletions pulumi_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ anyhow.workspace = true
[package.metadata.component]
package = "component:pulumi-wasm"

[package.metadata.component.target.dependencies]
"component:pulumi-wasm-external" = { path = "../pulumi_wasm_wit/wit/deps/pulumi-wasm-external.wit" }

[package.metadata.component.target]
path = "../pulumi_wasm_wit/wit/world.wit"
world = "pulumi-wasm"
72 changes: 42 additions & 30 deletions pulumi_wasm/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ pub mod component {
}
}
}

}
#[allow(dead_code)]
pub mod pulumi_wasm_external {
#[allow(dead_code, clippy::all)]
pub mod external_world {
#[used]
Expand Down Expand Up @@ -254,7 +256,9 @@ pub mod component {
pub fn is_in_preview() -> bool {
unsafe {
#[cfg(target_arch = "wasm32")]
#[link(wasm_import_module = "component:pulumi-wasm/[email protected]")]
#[link(
wasm_import_module = "component:pulumi-wasm-external/[email protected]"
)]
extern "C" {
#[link_name = "is-in-preview"]
fn wit_import() -> i32;
Expand All @@ -276,7 +280,9 @@ pub mod component {
let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
#[cfg(target_arch = "wasm32")]
#[link(wasm_import_module = "component:pulumi-wasm/[email protected]")]
#[link(
wasm_import_module = "component:pulumi-wasm-external/[email protected]"
)]
extern "C" {
#[link_name = "get-root-resource"]
fn wit_import(_: *mut u8);
Expand Down Expand Up @@ -305,7 +311,9 @@ pub mod component {
let len0 = vec0.len();
let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
#[cfg(target_arch = "wasm32")]
#[link(wasm_import_module = "component:pulumi-wasm/[email protected]")]
#[link(
wasm_import_module = "component:pulumi-wasm-external/[email protected]"
)]
extern "C" {
#[link_name = "register-resource-outputs"]
fn wit_import(_: *mut u8, _: usize, _: *mut u8);
Expand Down Expand Up @@ -337,7 +345,9 @@ pub mod component {
let len2 = vec2.len();

#[cfg(target_arch = "wasm32")]
#[link(wasm_import_module = "component:pulumi-wasm/[email protected]")]
#[link(
wasm_import_module = "component:pulumi-wasm-external/[email protected]"
)]
extern "C" {
#[link_name = "register-resource"]
fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize);
Expand All @@ -358,7 +368,9 @@ pub mod component {
let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]);
let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
#[cfg(target_arch = "wasm32")]
#[link(wasm_import_module = "component:pulumi-wasm/[email protected]")]
#[link(
wasm_import_module = "component:pulumi-wasm-external/[email protected]"
)]
extern "C" {
#[link_name = "wait-for-registered-resources"]
fn wit_import(_: *mut u8);
Expand Down Expand Up @@ -1336,8 +1348,8 @@ pub(crate) use __export_pulumi_wasm_impl as export;
#[cfg(target_arch = "wasm32")]
#[link_section = "component-type:wit-bindgen:0.25.0:pulumi-wasm:encoded world"]
#[doc(hidden)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1527] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xf5\x0a\x01A\x02\x01\
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1543] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x85\x0b\x01A\x02\x01\
A\x0b\x01B\x0a\x01m\x05\x05TRACE\x05DEBUG\x04INFO\x04WARN\x05ERROR\x04\0\x05leve\
l\x03\0\0\x01ks\x01ky\x01o\x02ss\x01p\x04\x01r\x07\x05level\x01\x06targets\x04ar\
gss\x0bmodule-path\x02\x04file\x02\x04line\x03\x0akey-values\x05\x04\0\x07conten\
Expand All @@ -1348,28 +1360,28 @@ t\x03\0\x06\x01@\x01\x07content\x07\x01\0\x04\0\x03log\x01\x08\x03\x01#component
@\0\0s\x04\0\x11get-root-resource\x01\x06\x01@\x01\x07request\0\0\0\x04\0\x19reg\
ister-resource-outputs\x01\x07\x01@\x01\x07request\x02\x01\0\x04\0\x11register-r\
esource\x01\x08\x01p\x04\x01@\0\0\x09\x04\0\x1dwait-for-registered-resources\x01\
\x0a\x03\x01.component:pulumi-wasm/[email protected]\x05\x01\x01B\x0c\x04\
\0\x06output\x03\x01\x01i\0\x01@\x01\x05values\0\x01\x04\0\x13[constructor]outpu\
t\x01\x02\x01h\0\x01@\x02\x04self\x03\x0dfunction-names\0\x01\x04\0\x12[method]o\
utput.map\x01\x04\x01@\x01\x04self\x03\0\x01\x04\0\x18[method]output.duplicate\x01\
\x05\x01p\x01\x01@\x01\x07outputs\x06\0\x01\x04\0\x07combine\x01\x07\x04\x010com\
ponent:pulumi-wasm/[email protected]\x05\x02\x02\x03\0\x02\x06output\x01\
B\x13\x02\x03\x02\x01\x03\x04\0\x06output\x03\0\0\x01h\x01\x01r\x02\x04names\x05\
value\x02\x04\0\x0cobject-field\x03\0\x03\x01r\x01\x04names\x04\0\x0cresult-fiel\
d\x03\0\x05\x01i\x01\x01r\x02\x04names\x06output\x07\x04\0\x1eregister-resource-\
result-field\x03\0\x08\x01p\x04\x01p\x06\x01r\x04\x04types\x04names\x06object\x0a\
\x07results\x0b\x04\0\x19register-resource-request\x03\0\x0c\x01p\x09\x01r\x01\x06\
fields\x0e\x04\0\x18register-resource-result\x03\0\x0f\x01@\x01\x07request\x0d\0\
\x10\x04\0\x08register\x01\x11\x04\x012component:pulumi-wasm/register-interface@\
0.0.0-DEV\x05\x04\x01B\x0e\x02\x03\x02\x01\x03\x04\0\x06output\x03\0\0\x01i\x01\x01\
r\x03\x02id\x02\x0bfunction-ids\x05values\x04\0\x1bfunction-invocation-request\x03\
\0\x03\x01h\x01\x01r\x02\x02id\x05\x05values\x04\0\x1afunction-invocation-result\
\x03\0\x06\x01@\x02\x04names\x05value\x05\x01\0\x04\0\x0aadd-export\x01\x08\x01p\
\x07\x01p\x04\x01@\x01\x09functions\x09\0\x0a\x04\0\x06finish\x01\x0b\x04\x01/co\
mponent:pulumi-wasm/[email protected]\x05\x05\x04\x01+component:pulumi-w\
asm/[email protected]\x04\0\x0b\x11\x01\0\x0bpulumi-wasm\x03\0\0\0G\x09produ\
cers\x01\x0cprocessed-by\x02\x0dwit-component\x070.208.1\x10wit-bindgen-rust\x06\
0.25.0";
\x0a\x03\x01>component:pulumi-wasm-external/[email protected]STABLE-DEV\x05\x01\
\x01B\x0c\x04\0\x06output\x03\x01\x01i\0\x01@\x01\x05values\0\x01\x04\0\x13[cons\
tructor]output\x01\x02\x01h\0\x01@\x02\x04self\x03\x0dfunction-names\0\x01\x04\0\
\x12[method]output.map\x01\x04\x01@\x01\x04self\x03\0\x01\x04\0\x18[method]outpu\
t.duplicate\x01\x05\x01p\x01\x01@\x01\x07outputs\x06\0\x01\x04\0\x07combine\x01\x07\
\x04\x010component:pulumi-wasm/[email protected]\x05\x02\x02\x03\0\x02\x06\
output\x01B\x13\x02\x03\x02\x01\x03\x04\0\x06output\x03\0\0\x01h\x01\x01r\x02\x04\
names\x05value\x02\x04\0\x0cobject-field\x03\0\x03\x01r\x01\x04names\x04\0\x0cre\
sult-field\x03\0\x05\x01i\x01\x01r\x02\x04names\x06output\x07\x04\0\x1eregister-\
resource-result-field\x03\0\x08\x01p\x04\x01p\x06\x01r\x04\x04types\x04names\x06\
object\x0a\x07results\x0b\x04\0\x19register-resource-request\x03\0\x0c\x01p\x09\x01\
r\x01\x06fields\x0e\x04\0\x18register-resource-result\x03\0\x0f\x01@\x01\x07requ\
est\x0d\0\x10\x04\0\x08register\x01\x11\x04\x012component:pulumi-wasm/register-i\
nterface@0.0.0-DEV\x05\x04\x01B\x0e\x02\x03\x02\x01\x03\x04\0\x06output\x03\0\0\x01\
i\x01\x01r\x03\x02id\x02\x0bfunction-ids\x05values\x04\0\x1bfunction-invocation-\
request\x03\0\x03\x01h\x01\x01r\x02\x02id\x05\x05values\x04\0\x1afunction-invoca\
tion-result\x03\0\x06\x01@\x02\x04names\x05value\x05\x01\0\x04\0\x0aadd-export\x01\
\x08\x01p\x07\x01p\x04\x01@\x01\x09functions\x09\0\x0a\x04\0\x06finish\x01\x0b\x04\
\x01/component:pulumi-wasm/[email protected]\x05\x05\x04\x01+component:p\
ulumi-wasm/[email protected]\x04\0\x0b\x11\x01\0\x0bpulumi-wasm\x03\0\0\0G\x09\
producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.208.1\x10wit-bindgen-rus\
t\x060.25.0";

#[inline(never)]
#[doc(hidden)]
Expand Down
4 changes: 2 additions & 2 deletions pulumi_wasm/src/pulumi_connector_impl.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::bindings::component::pulumi_wasm::external_world;
use crate::bindings::component::pulumi_wasm::external_world::RegisterResourceRequest;
use crate::bindings::component::pulumi_wasm_external::external_world;
use crate::bindings::component::pulumi_wasm_external::external_world::RegisterResourceRequest;
use pulumi_wasm_core::PulumiConnector;

pub(crate) struct PulumiConnectorImpl {}
Expand Down
2 changes: 1 addition & 1 deletion pulumi_wasm_generator_lib/src/output/wit/wit.handlebars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pulumi:{{package.name}}@{{package.version}}-{{package.pulumi_wasm_version_stringify}};
package pulumi:{{package.name}}@{{package.version}}-DIVIDER-{{package.pulumi_wasm_version_stringify}};

world {{package.name}}-pulumi {
import component:pulumi-wasm/register-interface@{{package.pulumi_wasm_version}};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pulumi:example@0.0.1-ZERO.ZERO.ZERO-DEV;
package pulumi:example@0.0.1-DIVIDER-ZERO.ZERO.ZERO-DEV;

world example-pulumi {
import component:pulumi-wasm/register-interface@0.0.0-DEV;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pulumi:example@0.0.1-ZERO.ZERO.ZERO-DEV;
package pulumi:example@0.0.1-DIVIDER-ZERO.ZERO.ZERO-DEV;

world example-pulumi {
import component:pulumi-wasm/register-interface@0.0.0-DEV;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pulumi:aws-native@0.0.1-ZERO.ZERO.ZERO-DEV;
package pulumi:aws-native@0.0.1-DIVIDER-ZERO.ZERO.ZERO-DEV;

world aws-native-pulumi {
import component:pulumi-wasm/register-interface@0.0.0-DEV;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pulumi:aws-native@0.0.1-ZERO.ZERO.ZERO-DEV;
package pulumi:aws-native@0.0.1-DIVIDER-ZERO.ZERO.ZERO-DEV;

world aws-native-pulumi {
import component:pulumi-wasm/register-interface@0.0.0-DEV;
Expand Down
3 changes: 2 additions & 1 deletion pulumi_wasm_runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ wac-graph.workspace = true
pulumi_wasm_proto = { workspace = true, features = ["connectivity"] }
pulumi_wasm_wit = { workspace = true, features = ["runner"] }
directories.workspace = true
reqwest.workspace = true
reqwest.workspace = true
pulumi_wasm_runner_component_creator.workspace = true
Loading

0 comments on commit 9c867c2

Please sign in to comment.