Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templates: add a Rust template for non-trigger components #2970

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tschneidereit
Copy link
Contributor

This new template makes it easy to create a component that can be used as a dependency in another component. Until now, that required fully manually setting up a component and adding it to the Spin manifest, etc.

This new template makes it easy to create a component that can be used as a dependency in another component. Until now, that required fully manually setting up a component and adding it to the Spin manifest, etc.

Signed-off-by: Till Schneidereit <[email protected]>
@tschneidereit tschneidereit added the templates Application templates label Dec 19, 2024
@@ -0,0 +1,6 @@
[component.{{project-name | kebab_case}}]
source = "{{ output-path }}/target/wasm32-wasip2/release/{{project-name | snake_case}}.wasm"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use wasip1 everywhere else - is p2 stable enough that we should be moving to it?

@@ -0,0 +1,13 @@
spin_manifest_version = 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels extremely awkward to create a spin.toml for a library component. Why does a dependency need a Spin manifest file? It can't be referenced by a trigger. It can't be referenced by its component ID (although we could allow that of course). Most of its settings are misleading e.g. setting allowed outbound hosts looks like it grants access but actually does nothing. Is this just to opt it into getting included spin build?

I feel like the ask here is for the manifest to provide for building and referencing library components but I am not sold that mixing them in with "application" components is the way to go right now: perhaps we should step back and ask how we should represent library components in the manifest, then create a template as part of that?

@@ -0,0 +1,12 @@
manifest_version = "1"
id = "component-rust"
description = "Pure Rust component to be used as a dependency for other component"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "pure" e.g.

Suggested change
description = "Pure Rust component to be used as a dependency for other component"
description = "Library (dependency) component using Rust"

or something like that?

authors = ["{{authors}}"]
description = "{{project-description}}"
version = "0.1.0"
rust-version = "1.78"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the status of the wasm32-wasip2 target in 1.78?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
templates Application templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants