-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0035f93
commit 95e0570
Showing
10 changed files
with
94 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.obsidian |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
./run.sh | ||
|
||
cargo run -- run --wasm target/wasm32-wasi/debug/composed2.wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/pulumi-language-wasm.exe | ||
/pulumi-language-wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
pulumi plugin rm language wasm -y | ||
|
||
go build | ||
|
||
pulumi plugin install language wasm 1.0 --file ./pulumi-language-wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2022, Pulumi Corporation. All rights reserved. | ||
|
||
package executors | ||
|
||
import ( | ||
"github.com/andrzejressel/pulumi-wasm/pulumi-language-wasm/fsys" | ||
"runtime" | ||
) | ||
|
||
type unix struct{} | ||
|
||
var _ wasmExecutorFactory = &unix{} | ||
|
||
func (s unix) NewWasmExecutor(opts WasmExecutorOptions) (*WasmExecutor, error) { | ||
if runtime.GOOS != "linux" && runtime.GOOS != "darwin" { | ||
return nil, nil | ||
} | ||
probePaths := []string{opts.UseExecutor} | ||
if opts.UseExecutor == "" { | ||
probePaths = []string{"./entrypoint.sh"} | ||
} | ||
cmd, err := fsys.LookPath(opts.WD, probePaths...) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return s.newWasmCliExecutor(cmd) | ||
} | ||
|
||
func (unix) newWasmCliExecutor(script string) (*WasmExecutor, error) { | ||
return &WasmExecutor{ | ||
Name: script, | ||
Cmd: "bash", | ||
BuildArgs: []string{"-c", script, "build"}, | ||
RunArgs: []string{"-c", script, "run"}, | ||
PluginArgs: []string{"-c", script, "plugin"}, | ||
VersionArgs: []string{"-c", script, "version"}, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
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 | ||
|
||
|
||
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" | ||
|
||
|
||
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/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 | ||
#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 | ||
wasm-tools print target/wasm32-wasi/debug/composed1.wasm > composed1.wat | ||
wasm-tools print target/wasm32-wasi/debug/composed2.wasm > composed2.wat |