Skip to content

Commit

Permalink
final doc update, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
JanProvaznik committed Aug 21, 2024
1 parent d9f5cda commit 1b9569e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 16 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
- Rust example tasks [examples/]
- The tasks run in a Wasm/WASI runtime - [Wasmtime](https://github.com/bytecodealliance/wasmtime) which sandboxes the execution from the rest of the system and files/directories a task allowed to touch have to be specified.

see [spec](https://github.com/dotnet/msbuild/pull/10259) for details
- see [spec](https://github.com/dotnet/msbuild/pull/10259) for details

- State: Proof of concept, will not be maintained, outcome is that the WASI ecosystem is not ready for productization in MSBuild (Aug 2024)
- Released as NuGet packages: [MSBuildWasm](https://www.nuget.org/packages/MSBuildWasm), [MSBuildWasm.Templates](https://www.nuget.org/packages/MSBuildWasm.Templates/)

## User manual
Create a MSBuild task using Wasm/WASI toolchain.
Expand All @@ -30,10 +33,16 @@ Create a MSBuild task using Wasm/WASI toolchain.
```
4. `dotnet build`

Inputs and outputs from a tasks can be bools, strings and "ITaskItem" which is basically a file path.

[Writing tasks for MSBuild](https://learn.microsoft.com/en-us/visualstudio/msbuild/task-writing)

## Developer manual
the [spec](https://github.com/dotnet/msbuild/pull/10259)
elaborates how this package interplays with MSBuild and how to create a task

### Running tests
see `.github/workflows/dotnet.yml` action
1. compile examples and template rust tasks to using `cargo`
2. `dotnet test test/WasmTasksTests`

## License
This project is licensed under the MIT License - see the LICENSE file for details.
Expand All @@ -43,4 +52,4 @@ This project includes software developed under the Apache License, Version 2.0:
Wasmtime - https://github.com/bytecodealliance/wasmtime
Wasmtime.Dotnet - https://github.com/bytecodealliance/wasmtime-dotnet

For full terms and conditions, please see the Apache 2.0 license.
For full terms and conditions, please see the Apache 2.0 license.
2 changes: 1 addition & 1 deletion examples/ExampleProject/ExampleProject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSBuildWasm" Version="0.2.0" />
<PackageReference Include="MSBuildWasm" Version="0.2.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/MSBuildWasm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PropertyGroup>
<IsPackable>true</IsPackable>
<PackageId>MSBuildWasm</PackageId>
<Version>0.2.0</Version>
<Version>0.2.1</Version>
<Authors>Jan Provaznik</Authors>
<Company>Microsoft</Company>

Expand Down
6 changes: 3 additions & 3 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# MSBuildWasm
**EXPERIMENTAL**

This package introduces the `WasmTaskFactory` which can be used to create MSBuild tasks from .wasm modules.
This package introduces the `WasmTaskFactory` which creates MSBuild tasks from .wasm modules.

## Usage
0. To create a compatible Wasm module use the template in https://github.com/JanProvaznik/MSBuildWasm/tree/main/templates
0. Create a compatible WASIp1 module [spec](https://github.com/dotnet/msbuild/blob/main/documentation/specs/proposed/Wasm-tasks.md), e.g. from a [template](https://github.com/JanProvaznik/MSBuildWasm/tree/main/templates/content/RustWasmTaskTemplate/rust_template)
1. In a the .proj file add
```xml
<UsingTask TaskName="MyTask" AssemblyFile="$(MSBuildWasmAssembly)" TaskFactory="WasmTaskFactory" Condition="$(MSBuildWasmAssembly) != ''">
Expand All @@ -17,4 +17,4 @@ This package introduces the `WasmTaskFactory` which can be used to create MSBuil
<MyTask/>
</Target>
```
3. `dotnet build`
3. `dotnet build`
4 changes: 2 additions & 2 deletions templates/MSBuildWasm.Templates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<NoWarn>$(NoWarn);NU5128</NoWarn>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.1.0-alpha</Version>
<Version>0.1.1</Version>
<PackageTags>MSBuild;Wasm;WebAssembly</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>msbuildwasmlogo.png</PackageIcon>
Expand All @@ -33,7 +33,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.TemplateEngine.Tasks" Version="*" PrivateAssets="all" IsImplicitlyDefined="true" />
<PackageReference Include="MSBuildWasm" Version="0.2.0" />
<PackageReference Include="MSBuildWasm" Version="0.2.1" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 5 additions & 4 deletions templates/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# MSBuildWasm Template Package
**EXPERIMENTAL**

The package contains Rust template for creating MSBuild Tasks using Rust with MSBuildWasm
Rust template for creating [MSBuild Tasks](https://learn.microsoft.com/visualstudio/msbuild/task-writing) using Rust with MSBuildWasm package using this [spec](https://github.com/dotnet/msbuild/blob/main/documentation/specs/proposed/Wasm-tasks.md)

If/when other languages support function imports and exports in WASIp1 modules, templates for them may be added.

use `dotnet new rust.msbuild.task`
## Usage
- install `cargo` and the `wasm32-wasi` target
- `dotnet new rust.msbuild.task -o my_project` - creates a new .NET project which includes a template Rust task
- `dotnet build my_project` - runs MSBuild which will compile the Rust to .wasm and create a MSBuild task from it
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSBuildWasm" Version="0.2.0" />
<PackageReference Include="MSBuildWasm" Version="0.2.1" />
</ItemGroup>

<Target Name="CompileRustWasm" BeforeTargets="Build">
Expand Down

0 comments on commit 1b9569e

Please sign in to comment.