Skip to content

Commit

Permalink
Renaming packages (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejressel authored Mar 10, 2024
1 parent b8f2c09 commit 7030fc4
Show file tree
Hide file tree
Showing 50 changed files with 99 additions and 118 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ jobs:
- name: Build WASM support
run: |
cargo install cargo-component@0.9.0 --locked || cargo-component --version
cargo build --verbose
cargo component build -p pulumi_wasm --verbose
cargo component build -p pulumi_wasm_random --verbose
cargo component build -p pulumi_rust_wasm --verbose
cargo component build -p pulumi_wasm_main --verbose
cargo install wasm-tools@1.0.57 --locked || wasm-tools --version
./build.sh
- name: Run tests
run: cargo test --all --verbose
65 changes: 29 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 5 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,15 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
pulumi_rust = { path = "pulumi_rust" }
tokio.workspace = true
log.workspace = true
anyhow.workspace = true
tonic = { workspace = true, default-features = true }
prost-types.workspace = true
clap.workspace = true
log4rs.workspace = true

[workspace]
members = [
"pulumi_rust",
"pulumi_wasm_runner",
"pulumi_wasm",
"pulumi_wasm_random",
"pulumi_wasm_main",
"pulumi_rust_wasm",
"wasm_common"
"providers/pulumi_wasm_provider_random",
"pulumi_wasm_rust",
"wasm_common",
"examples/simple"
]

[workspace.dependencies]
Expand Down
34 changes: 33 additions & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
echo %*
cargo component build -p wasm_common || exit /b 1
cargo component build -p pulumi_wasm || exit /b 1
cargo component build -p pulumi_wasm_provider_random || exit /b 1
cargo component build -p pulumi_wasm_example_simple || exit /b 1
cargo build -p pulumi_wasm_runner || exit /b 1
@REM cargo build -p pulumi_rust_wasm || exit /b
@REM @REM wasm-tools component wit target/wasm32-wasi/debug/pulumi_wasm_example_simple.wasm
@REM
echo F|xcopy /b /v /y ".\target\wasm32-wasi\debug\pulumi_wasm.wasm" ".\target\wasm32-wasi\debug\pulumi-wasm.wasm" || exit /b 1
echo F|xcopy /b /v /y ".\target\wasm32-wasi\debug\pulumi_wasm_example_simple.wasm" ".\target\wasm32-wasi\debug\pulumi-wasm-example-simple.wasm" || exit /b 1
echo F|xcopy /b /v /y ".\target\wasm32-wasi\debug\pulumi_wasm_provider_random.wasm" ".\target\wasm32-wasi\debug\pulumi-wasm-provider-random.wasm" || exit /b 1
@REM
@REM @REM wasm-tools component wit target/wasm32-wasi/debug/pulumi-wasm-example-simple.wasm
@REM @REM wasm-tools component wit target/wasm32-wasi/debug/pulumi-wasm-provider-random.wasm
@REM
wasm-tools compose -o target/wasm32-wasi/debug/composed1.wasm target/wasm32-wasi/debug/pulumi-wasm-example-simple.wasm -d target/wasm32-wasi/debug/pulumi-wasm-provider-random.wasm || exit /b 1
wasm-tools compose -o target/wasm32-wasi/debug/composed2.wasm target/wasm32-wasi/debug/composed1.wasm -d target/wasm32-wasi/debug/pulumi-wasm.wasm || exit /b 1
@REM cargo run -p pulumi_wasm_runner -- compile --wasm target/wasm32-wasi/debug/composed2.wasm --output target/wasm32-wasi/debug/composed2.cwasm || exit /b 1
@REM wasmtime compile -D debug-info=y,coredump=y,address-map=y -o target/wasm32-wasi/debug/composed2.cwasm target/wasm32-wasi/debug/composed2.wasm || exit /b 1
@REM
@REM cargo build -p pulumi_entrypoint || exit /b
@REM
@REM @REM wasm-tools component wit target/wasm32-wasi/debug/pulumi-wasm-provider-random.wasm
@REM @REM wasm-tools component wit target/wasm32-wasi/debug/pulumi-wasm-example-simple.wasm
@REM
@REM wasm-tools component wit target/wasm32-wasi/debug/composed1.wasm
@REM wasm-tools component wit target/wasm32-wasi/debug/composed2.wasm
@REM
wasm-tools component wit target/wasm32-wasi/debug/composed2.wasm || exit /b 1
wasm-tools print target/wasm32-wasi/debug/composed1.wasm > composed1.wat || exit /b 1
wasm-tools print target/wasm32-wasi/debug/composed2.wasm > composed2.wat || exit /b 1

@REM cargo build --target wasm32-wasi
16 changes: 7 additions & 9 deletions run.sh → build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ set -e

cargo component build -p wasm_common
cargo component build -p pulumi_wasm
cargo component build -p pulumi_wasm_random
cargo component build -p pulumi_rust_wasm
cargo component build -p pulumi_wasm_main
cargo build
cargo component build -p pulumi_wasm_provider_random
cargo component build -p pulumi_wasm_example_simple
cargo build -p pulumi_wasm_runner


cp "target/wasm32-wasi/debug/pulumi_wasm.wasm" "target/wasm32-wasi/debug/pulumi-wasm.wasm"
cp "target/wasm32-wasi/debug/pulumi_wasm_main.wasm" "target/wasm32-wasi/debug/pulumi-wasm-main.wasm"
cp "target/wasm32-wasi/debug/pulumi_wasm_random.wasm" "target/wasm32-wasi/debug/pulumi-wasm-random.wasm"
cp "target/wasm32-wasi/debug/pulumi_rust_wasm.wasm" "target/wasm32-wasi/debug/pulumi-rust-wasm.wasm"
cp "target/wasm32-wasi/debug/pulumi_wasm_example_simple.wasm" "target/wasm32-wasi/debug/pulumi-wasm-example-simple.wasm"
cp "target/wasm32-wasi/debug/pulumi_wasm_provider_random.wasm" "target/wasm32-wasi/debug/pulumi-wasm-provider-random.wasm"


wasm-tools compose -o target/wasm32-wasi/debug/composed1.wasm target/wasm32-wasi/debug/pulumi-wasm-main.wasm -d target/wasm32-wasi/debug/pulumi-wasm-random.wasm
wasm-tools compose -o target/wasm32-wasi/debug/composed1.wasm target/wasm32-wasi/debug/pulumi-wasm-example-simple.wasm -d target/wasm32-wasi/debug/pulumi-wasm-provider-random.wasm
wasm-tools compose -o target/wasm32-wasi/debug/composed2.wasm target/wasm32-wasi/debug/composed1.wasm -d target/wasm32-wasi/debug/pulumi-wasm.wasm
cargo run -- compile --wasm target/wasm32-wasi/debug/composed2.wasm --output target/wasm32-wasi/debug/composed2.cwasm
#cargo run -p pulumi_wasm_runner -- compile --wasm target/wasm32-wasi/debug/composed2.wasm --output target/wasm32-wasi/debug/composed2.cwasm
#wasmtime compile -D debug-info=y,coredump=y,address-map=y -o target/wasm32-wasi/debug/composed2.cwasm target/wasm32-wasi/debug/composed2.wasm || exit /b 1

wasm-tools component wit target/wasm32-wasi/debug/composed2.wasm
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

@REM cargo run -- run --wasm target/wasm32-wasi/debug/composed2.wasm

.\run.bat && cargo run -- run --wasm target/wasm32-wasi/debug/composed2.wasm
.\build.bat && cargo run -p pulumi_wasm_runner -- run --wasm target/wasm32-wasi/debug/composed2.wasm
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -e

./run.sh
./build.sh

cargo run -- run --wasm target/wasm32-wasi/debug/composed2.wasm
cargo run -p pulumi_wasm_runner -- run --wasm target/wasm32-wasi/debug/composed2.wasm
8 changes: 4 additions & 4 deletions pulumi_wasm_main/Cargo.toml → examples/simple/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "pulumi_wasm_main"
name = "pulumi_wasm_example_simple"
version = "0.1.0"
edition = "2021"

Expand All @@ -24,9 +24,9 @@ rmpv.workspace = true
serde.workspace = true
tonic.workspace = true
serde_json.workspace = true
pulumi_rust_wasm = { path = "../pulumi_rust_wasm" }
pulumi_rust_wasm = { path = "../../pulumi_wasm_rust" }
log.workspace = true
wasm_common = { path = "../wasm_common" }
wasm_common = { path = "../../wasm_common" }

[dev-dependencies]
wasmtime.workspace = true
Expand All @@ -36,5 +36,5 @@ wasmtime-wasi.workspace = true
package = "component:pulumi-wasm-main"

[package.metadata.component.target]
path = "../wits/world.wit"
path = "../../wits/world.wit"
world = "new-main"
File renamed without changes.
2 changes: 1 addition & 1 deletion pulumi_wasm_main/src/lib.rs → examples/simple/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Guest for Component {
let length: Output<i32> = Output::new(&1).map(|i: i32| i * 3);

let _v = create_random_string(RandomStringArgs {
name: "test1234",
name: "test123456",
length,
});

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "pulumi_wasm_random"
name = "pulumi_wasm_provider_random"
version = "0.1.0"
edition = "2021"

Expand All @@ -25,7 +25,7 @@ serde.workspace = true
tonic.workspace = true
serde_json.workspace = true
log.workspace = true
wasm_common = { path = "../wasm_common" }
wasm_common = { path = "../../wasm_common" }

[dev-dependencies]
wasmtime.workspace = true
Expand All @@ -35,5 +35,5 @@ wasmtime-wasi.workspace = true
package = "component:pulumi-provider-random"

[package.metadata.component.target]
path = "../wits/world.wit"
path = "../../wits/world.wit"
world = "pulumi-provider-random"
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions pulumi_rust/src/lib.rs

This file was deleted.

5 changes: 4 additions & 1 deletion pulumi_rust/Cargo.toml → pulumi_wasm_runner/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "pulumi_rust"
name = "pulumi_wasm_runner"
version = "0.1.0"
edition = "2021"

Expand All @@ -22,6 +22,9 @@ serde_json.workspace = true
futures.workspace = true
async-trait.workspace = true
regex.workspace = true
tokio.workspace = true
log4rs.workspace = true
clap.workspace = true

[build-dependencies]
tonic-build.workspace = true
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 8 additions & 1 deletion src/main.rs → pulumi_wasm_runner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ use log4rs::Config;
use log4rs::config::{Appender, Root};
use log4rs::encode::json::JsonEncoder;
use log::LevelFilter;
use crate::pulumi::{Pulumi, WasmFile};

use pulumi_rust::pulumi::{Pulumi, WasmFile};
mod pulumi;

mod grpc {
#![allow(clippy::all)]
#![allow(clippy::pedantic)]
tonic::include_proto!("pulumirpc");
}

#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 7030fc4

Please sign in to comment.