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

WASI-Build spec #10259

Draft
wants to merge 4 commits into
base: feature/wasi-tasks
Choose a base branch
from

Conversation

JanProvaznik
Copy link
Contributor

@JanProvaznik JanProvaznik commented Jun 18, 2024

This is a PR for the proposed WASI-Build feature spec, only documentation

@JanProvaznik JanProvaznik added Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. WIP Work in Progress Pull Request--do not merge yet. labels Jun 18, 2024
@JanProvaznik JanProvaznik self-assigned this Jun 18, 2024
Copy link
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

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

Hey, I've got LOTS of comments here but this is great progress and I'm getting even more excited about the project. Feel free to reach out to discuss anything.

documentation/specs/proposed/WASI-tasks.md Outdated Show resolved Hide resolved
documentation/specs/proposed/WASI-tasks.md Outdated Show resolved Hide resolved
documentation/specs/proposed/WASI-tasks.md Outdated Show resolved Hide resolved
documentation/specs/proposed/WASI-tasks.md Outdated Show resolved Hide resolved
documentation/specs/proposed/WASI-tasks.md Outdated Show resolved Hide resolved
documentation/specs/proposed/WASI-tasks.md Outdated Show resolved Hide resolved
documentation/specs/proposed/WASI-tasks.md Outdated Show resolved Hide resolved

windows/linux/mac all seem like they will have some specifics

threadsafety?
Copy link
Member

Choose a reason for hiding this comment

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

hopefully not a problem here, should be able to treat as single-threaded (for now). Another place where a couple of // TODO thread safety are probably fine.

Copy link
Member

Choose a reason for hiding this comment

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

IIRC we're forced to single-threaded execution until threads land in WASI.

Copy link
Member

Choose a reason for hiding this comment

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

Ah yeah good point, there are two sides of thread safety:

  1. Inside the task
  2. In MSBuild outside the task.

Probably fine to deprioritize both, inside for @baronfel's reason and outside because task execution should appear single-threaded (due to MSBuild's multi-process instead of multi-thread model).

</PropertyGroup>

<Target Name="RunWasmtime" AfterTargets="Build">
<Exec Command="wasmtime bin/$(Configuration)/$(TargetFramework)/wasi-wasm/AppBundle/$(AssemblyName).wasm" />
Copy link
Member

Choose a reason for hiding this comment

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

Might be interesting to have a WASM program that does something "build-y" like read a list of files and write an output. The actual transformation doesn't have to be interesting, concatenation would be fine.

documentation/specs/proposed/WASI-tasks.md Outdated Show resolved Hide resolved
@JanProvaznik JanProvaznik changed the base branch from main to feature/wasi-tasks June 20, 2024 14:49
## Stories for requirements
Currently tasks have unrestricted access to resources, Wasm/WASI runtimes provide a way to sandbox tasks (by default executables don't have access to any resources). This can be acheived by specifying Inputs and Outputs of these tasks and other resources they can access.

We want to be able to run tasks written in other languages than C# in MSBuild. Those tasks will need a definition for how to write them. Invoking a Wasm runtime can easily run pre-compiled tasks.
Copy link
Member

Choose a reason for hiding this comment

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

definition for how to write them. please explain what exactly you mean here.

We can use the Exec task in this manner to run an executable .wasm file (.NET example):
- note that this execution does not get any resources so it can't manipulate files

1. install [wasi-sdk](https://github.com/WebAssembly/wasi-sdk), [wasmtime](https://wasmtime.dev)
Copy link
Member

Choose a reason for hiding this comment

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

I love this example, thanks!

- the compilation target is called wasm-wasi 👍👎
- *-> mostly use Wasm-tasks unless Wasm/WASI is more appropriate for that situation*

### Open questions
Copy link
Member

@YuliiaKovalova YuliiaKovalova Jun 27, 2024

Choose a reason for hiding this comment

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

I believe this section is slightly outdated after the recent sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. Disabled-Tests WIP Work in Progress Pull Request--do not merge yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants