Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CONFIG_ADAPTER_WASM := crates/componentized-static-config/constants-config.wasm


.PHONY: all
all: build components
all: build components test

.PHONY: build
build: config
Expand All @@ -49,13 +49,21 @@ install: config
cargo +$(RUST_TOOLCHAIN) install --path . --locked

.PHONY: clean
clean: clean-wit
clean: clean-components clean-wit
@:

.PHONY: clean-all
clean-all: clean-components clean-tools clean-wit
cargo clean

.PHONY: clean-components
clean-components: clean-wit
rm -rf ${COMPONENTS_DIR}

.PHONY: clean-tools
clean-tools:
rm -rf ${TOOLS_DIR}

.PHONY: clean-wit ## Remove the fetched wit dependencies, fetched again by `make wit`
clean-wit:
rm -rf wit/deps components/wit/deps components/*/wit/deps
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Static config components <!-- omit in toc -->

Create custom wasi:config components with static values.
Create custom `wasi:config` components with static values.

- [Build](#build)
- [Community](#community)
Expand Down
2 changes: 1 addition & 1 deletion components/factory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use componentized_static_config::create_component;
pub(crate) struct Factory;

impl Guest for Factory {
fn build_component(values: Vec<(String, String)>) -> Result<Wasm, ErrorCode> {
fn create(values: Vec<(String, String)>) -> Result<Wasm, ErrorCode> {
let output = create_component(values).map_err(|e| ErrorCode::Other(Some(e.to_string())))?;
Ok(output)
}
Expand Down
2 changes: 1 addition & 1 deletion components/factory/tests/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn build_component(engine: &Engine, values: &[(&str, &str)]) -> Result<Vec<u8>>
&mut store,
&instance,
FACTORY_INTERFACE,
"build-component",
"create",
&[values],
)? {
Val::Result(Ok(Some(bytes))) => match *bytes {
Expand Down
7 changes: 4 additions & 3 deletions wit/factory.wit
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@since(version = 0.2.0)
@since(version = 0.3.0-dev)
interface factory {
use componentized:component/types@0.1.0.{wasm, error-code};

@since(version = 0.2.0)
build-component: func(values: list<tuple<string, string>>) -> result<wasm, error-code>;
/// Create a component implementing `wasi:config/store` with the provided values.
@since(version = 0.3.0-dev)
create: func(values: list<tuple<string, string>>) -> result<wasm, error-code>;
}
Loading