diff --git a/.gitignore b/.gitignore
index d7088a4..863657b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ bin/
obj/
.vs/
artifacts/
+test/WasmComponentSdkTest/testapps/OciWit/wit
diff --git a/README.md b/README.md
index ff7fb58..8691c77 100644
--- a/README.md
+++ b/README.md
@@ -186,6 +186,17 @@ By default the project will find all wit files and execute wit-bindgen against e
```
+### Referencing Wit Packages from OCI Registries
+Wit can be packaged into [OCI Artifacts](https://tag-runtime.cncf.io/wgs/wasm/deliverables/wasm-oci-artifact/) which can be pushed to OCI registries. To import a WIT definition from an OCI registry specify the Registry on the `Wit` Element. This will pull a WASM component binary that contains the WIT definition. wit-bindgen can use the binary format directly to generate the bindings. To view the WIT directly use [`wasm-tools component wit wit/wit.wasm`](https://github.com/bytecodealliance/wasm-tools).
+
+```xml
+
+
+
+
+```
+
+
### WIT strings and memory
The calculator example above works easily because it doesn't need to allocate memory dynamically. Once you start working with strings, you must add an extra line to the `` in your _host_ `.csproj` file (that is, the application that's _importing_ the interface):
diff --git a/src/WitBindgen/WitBindgen.csproj b/src/WitBindgen/WitBindgen.csproj
index 8939313..791064a 100644
--- a/src/WitBindgen/WitBindgen.csproj
+++ b/src/WitBindgen/WitBindgen.csproj
@@ -24,7 +24,11 @@
$(MSBuildThisFileDirectory)..\..\modules\wit-bindgen\
- $(MSBuildThisFileDirectory)tools\version-$(PrebuiltWitBindgenVersion)
+ $(MSBuildThisFileDirectory)tools\version-wit-bindgen-$(PrebuiltWitBindgenVersion)
+
+ dev
+ https://github.com/bytecodealliance/wasm-pkg-tools/releases/download/$(PrebuildWkgVersion)/wkg
+ $(MSBuildThisFileDirectory)tools\version-wkg-$(PrebuildWkgVersion)
true
@@ -54,24 +58,28 @@
-
-
-
-
-
+
+
+
+
+
-
+
+
-
+
-
+
+
-
-
+
+
+
+
diff --git a/src/WitBindgen/build/ByteCodeAlliance.Componentize.DotNet.WitBindgen.props b/src/WitBindgen/build/ByteCodeAlliance.Componentize.DotNet.WitBindgen.props
index 8ce9e12..e67f4d0 100644
--- a/src/WitBindgen/build/ByteCodeAlliance.Componentize.DotNet.WitBindgen.props
+++ b/src/WitBindgen/build/ByteCodeAlliance.Componentize.DotNet.WitBindgen.props
@@ -6,6 +6,8 @@
$(WitBindgenToolTarget)-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLower())
$(MSBuildThisFileDirectory)..\tools\$(WitBindgenToolTarget)\wit-bindgen
$(WitBindgenExe).exe
+ $(MSBuildThisFileDirectory)..\tools\$(WitBindgenToolTarget)\wkg
+ $(WkgExe).exe
diff --git a/src/WitBindgen/build/ByteCodeAlliance.Componentize.DotNet.WitBindgen.targets b/src/WitBindgen/build/ByteCodeAlliance.Componentize.DotNet.WitBindgen.targets
index cf6b814..db39ff0 100644
--- a/src/WitBindgen/build/ByteCodeAlliance.Componentize.DotNet.WitBindgen.targets
+++ b/src/WitBindgen/build/ByteCodeAlliance.Componentize.DotNet.WitBindgen.targets
@@ -1,4 +1,4 @@
-
+
native-aot
@@ -55,6 +55,15 @@
+
+
+ @(Wit)
+
+
+
+
+
+
$(IntermediateOutputPath)wit_bindgen\
@@ -82,8 +91,8 @@
-
-
+
+
diff --git a/src/WitBindgen/build/Wit.CSharp.xml b/src/WitBindgen/build/Wit.CSharp.xml
index 92013af..341a7ff 100644
--- a/src/WitBindgen/build/Wit.CSharp.xml
+++ b/src/WitBindgen/build/Wit.CSharp.xml
@@ -26,5 +26,12 @@
PersistenceStyle="Attribute" HasConfigurationCondition="false" />
+
+
+
+
+
+
diff --git a/test/WasmComponentSdkTest/WasmComponentSdkTest/SimpleProducerConsumerTest.cs b/test/WasmComponentSdkTest/WasmComponentSdkTest/SimpleProducerConsumerTest.cs
index e52c153..3e3724f 100644
--- a/test/WasmComponentSdkTest/WasmComponentSdkTest/SimpleProducerConsumerTest.cs
+++ b/test/WasmComponentSdkTest/WasmComponentSdkTest/SimpleProducerConsumerTest.cs
@@ -46,6 +46,14 @@ public void CanComposeImportWithExport()
Assert.Contains("123 + 456 = 579", stdout);
}
+ [Fact]
+ public void CanBuildAppFromOci()
+ {
+ var composed = FindModulePath("../testapps/OciWit", "ociwit-component.wasm");
+ var stdout = ExecuteCommandComponent(composed);
+ Assert.StartsWith("Oci is awesome!", stdout);
+ }
+
private static string ExecuteCommandComponent(string componentFilePath)
{
var startInfo = new ProcessStartInfo(WasmtimeExePath, $"-W component-model {componentFilePath}") { RedirectStandardOutput = true };
diff --git a/test/WasmComponentSdkTest/WasmComponentSdkTest/WasmComponentSdkTest.csproj b/test/WasmComponentSdkTest/WasmComponentSdkTest/WasmComponentSdkTest.csproj
index bf6eba0..304f688 100644
--- a/test/WasmComponentSdkTest/WasmComponentSdkTest/WasmComponentSdkTest.csproj
+++ b/test/WasmComponentSdkTest/WasmComponentSdkTest/WasmComponentSdkTest.csproj
@@ -29,6 +29,7 @@
+
diff --git a/test/WasmComponentSdkTest/testapps/OciWit/Code.cs b/test/WasmComponentSdkTest/testapps/OciWit/Code.cs
new file mode 100644
index 0000000..19f405f
--- /dev/null
+++ b/test/WasmComponentSdkTest/testapps/OciWit/Code.cs
@@ -0,0 +1,9 @@
+using CommandWorld.wit.exports.wasi.cli.v0_2_0;
+
+public class RunImpl : IRun
+{
+ public static void Run()
+ {
+ Console.WriteLine("Oci is awesome!");
+ }
+}
diff --git a/test/WasmComponentSdkTest/testapps/OciWit/OciWit.csproj b/test/WasmComponentSdkTest/testapps/OciWit/OciWit.csproj
new file mode 100644
index 0000000..d19847a
--- /dev/null
+++ b/test/WasmComponentSdkTest/testapps/OciWit/OciWit.csproj
@@ -0,0 +1,23 @@
+
+
+
+
+
+ net8.0
+ enable
+ enable
+
+ true
+ wasi-wasm
+
+
+
+
+
+
+
+
+
+
+
+