Skip to content
Open
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
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- tool versions -->
<WasmToolsVersion>1.227.1</WasmToolsVersion>
<WacVersion>v0.6.1</WacVersion>
<PrebuiltWitBindgenVersion>0.41.0</PrebuiltWitBindgenVersion>
<PrebuiltWitBindgenVersion>0.52.0</PrebuiltWitBindgenVersion>
<PrebuildWkgVersion>0.10.0</PrebuildWkgVersion>

<!-- test artifacts -->
Expand Down
4 changes: 2 additions & 2 deletions samples/calculator/Adder/OperationsImpl.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace ComputerWorld.wit.exports.example.calculator;
namespace ComputerWorld.wit.Exports.example.calculator;

public class OperationsImpl : IOperations
public class OperationsExportsImpl : IOperationsExports
{
public static int Add(int left, int right)
{
Expand Down
6 changes: 3 additions & 3 deletions samples/calculator/CalculatorHost/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HostappWorld.wit.imports.example.calculator;
using HostappWorld.wit.Imports.example.calculator;

var left = 123;
var right = 456;
var result = OperationsInterop.Add(left, right);
var result = IOperationsImports.Add(left, right);
Console.WriteLine($"{left} + {right} = {result}");

Console.WriteLine(OperationsInterop.ToUpper("Hello, World!"));
Console.WriteLine(IOperationsImports.ToUpper("Hello, World!"));
6 changes: 3 additions & 3 deletions test/E2ETest/testapps/E2EConsumer/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System.Runtime.InteropServices;
using ConsumerWorld.wit.imports.test.producerConsumer;
using ConsumerWorld.wit.Imports.test.producerConsumer;

Console.WriteLine($"Hello, world on {RuntimeInformation.OSArchitecture}");

var result = OperationsInterop.Add(123, 456);
var result = IOperationsImports.Add(123, 456);
Console.WriteLine($"123 + 456 = {result}");

// this is just here to make sure we can enable features and pass flags via WitBindgenAddtionalArgs
// the fact that it compiles is enough to test this worked.
var floatResult = OperationsInterop.AddFloat(1.1f, 1.2f);
var floatResult = IOperationsImports.AddFloat(1.1f, 1.2f);
Console.WriteLine($"1.1 + 1.2 = {floatResult}");
4 changes: 2 additions & 2 deletions test/E2ETest/testapps/E2EProducer/OperationsImpl.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace ProducerWorld.wit.exports.test.producerConsumer;
namespace ProducerWorld.wit.Exports.test.producerConsumer;

public class OperationsImpl : IOperations
public class OperationsExportsImpl : IOperationsExports
{
public static int Add(int left, int right)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ImportstestWorld.wit.imports.test.pkg.v0_2_0.FolderInterop.Folder();
ImportstestWorld.wit.Imports.test.pkg.v0_2_0.IFolderImports.Folder();
24 changes: 12 additions & 12 deletions test/WasmComponentSdkTest/testapps/OciWit/Code.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
using CommandWorld.wit.exports.wasi.cli.v0_2_0;
using CommandWorld.wit.Exports.wasi.cli.v0_2_0;
using MyFuncsWorld;
using System.Text;

namespace ProxyWorld.wit.exports.wasi.http.v0_2_0
namespace ProxyWorld.wit.Exports.wasi.http.v0_2_0
{
using ProxyWorld.wit.imports.wasi.http.v0_2_0;
public class IncomingHandlerImpl : IIncomingHandler
using ProxyWorld.wit.Imports.wasi.http.v0_2_0;
public class IncomingHandlerExportsImpl : IIncomingHandlerExports
{
public static void Handle(ITypes.IncomingRequest request, ITypes.ResponseOutparam responseOut)
public static void Handle(ITypesImports.IncomingRequest request, ITypesImports.ResponseOutparam responseOut)
{
var content = Encoding.ASCII.GetBytes("Hello, from C#!");
var headers = new List<(string, byte[])> {
("content-type", Encoding.ASCII.GetBytes("text/plain")),
("content-length", Encoding.ASCII.GetBytes(content.Count().ToString()))
};
var response = new ITypes.OutgoingResponse(ITypes.Fields.FromList(headers));
var response = new ITypesImports.OutgoingResponse(ITypesImports.Fields.FromList(headers));
var body = response.Body();
ITypes.ResponseOutparam.Set(responseOut, Result<ITypes.OutgoingResponse, ITypes.ErrorCode>.Ok(response));
ITypesImports.ResponseOutparam.Set(responseOut, Result<ITypesImports.OutgoingResponse, ITypesImports.ErrorCode>.Ok(response));
using (var stream = body.Write())
{
stream.BlockingWriteAndFlush(content);
}
ITypes.OutgoingBody.Finish(body, null);
ITypesImports.OutgoingBody.Finish(body, null);
}
}
}
namespace CommandWorld.wit.exports.wasi.cli.v0_2_0
namespace CommandWorld.wit.Exports.wasi.cli.v0_2_0
{
public class RunImpl : IRun
public class RunExportsImpl : IRunExports
{
public static void Run()
{
Expand All @@ -38,11 +38,11 @@ public static void Run()

namespace MyFuncsWorld
{
public class MyFuncsWorldImpl : IMyFuncsWorld
public class MyFuncsWorldExportsImpl : IMyFuncsWorldExports
{
public static int GetNumber()
{
return 123;
}
}
}
}
4 changes: 2 additions & 2 deletions test/WasmComponentSdkTest/testapps/SimpleConsumer/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Runtime.InteropServices;
using ConsumerWorld.wit.imports.test.producerConsumer;
using ConsumerWorld.wit.Imports.test.producerConsumer;

Console.WriteLine($"Hello, world on {RuntimeInformation.OSArchitecture}");

var result = OperationsInterop.Add(123, 456);
var result = IOperationsImports.Add(123, 456);
Console.WriteLine($"123 + 456 = {result}");
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace ProducerWorld.wit.exports.test.producerConsumer;
namespace ProducerWorld.wit.Exports.test.producerConsumer;

public class OperationsImpl : IOperations
public class OperationsExportsImpl : IOperationsExports
{
public static int Add(int left, int right)
{
Expand Down
10 changes: 5 additions & 5 deletions test/WitBindgenTest/WitBindgenTest/CodeGenerationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@ public void GeneratesSimpleExport()
// The fact that this compiles is what matters. There would be no point calling
// the function to validate its behavior, as that has nothing to do with WIT codegen
// and wouldn't even be running as WebAssembly.
Assert.NotNull((Func<int>)MyFuncsWorldImpl.GetNumber);
Assert.NotNull((Func<int>)MyFuncsWorldExportsImpl.GetNumber);
}

[Fact]
public void CanSpecifyWorld()
{
Assert.NotNull((Func<int>)SomeStuffImpl.GetNumber);
Assert.NotNull((Func<int>)SomeStuffExportsImpl.GetNumber);
}

[Fact]
public void ShouldBeNormalResult()
{
Assert.NotNull((Func<float, float>)MyResultsWorldImpl.StringError);
Assert.NotNull((Func<float, float>)MyResultsWorldExportsImpl.StringError);
}

[Fact]
public void ShouldBeNormalWitResult()
{
Assert.NotNull((Func<float, MyWitResultsWorld.Result<float, string>>)MyWitResultsWorldImpl.StringError);
Assert.NotNull((Func<float, MyWitResultsWorld.Result<float, string>>)MyWitResultsWorldExportsImpl.StringError);
}

[Fact]
public void CanChangeWitouputLocation()
{
Assert.NotNull((Func<int>)MySimpleWorldImpl.GetNumber);
Assert.NotNull((Func<int>)MySimpleWorldExportsImpl.GetNumber);
}
}
2 changes: 1 addition & 1 deletion test/WitBindgenTest/testapps/LibraryUsingWit/Code.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class Code
{
public static void CallSimpleDoSomething()
{
MyFuncsWorld.exports.MyFuncsWorld.DoSomething();
MyFuncsWorld.IMyFuncsWorldImports.DoSomething();
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using MyFuncsWorld;

public class MyFuncsWorldImpl : IMyFuncsWorld
public class MyFuncsWorldExportsImpl : IMyFuncsWorldExports
{
public static int GetNumber()
{
Expand Down
4 changes: 2 additions & 2 deletions test/WitBindgenTest/testapps/LibraryUsingWit/SomeStuffImpl.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// I don't think this namespace should be so different to the one in MyFuncsWorldImpl,
// but currently that's what the codegen requires
using ProducerWorld.wit.exports.test.multipleWorlds;
using ProducerWorld.wit.Exports.test.multipleWorlds;

public class SomeStuffImpl : ISomeStuff
public class SomeStuffExportsImpl : ISomeStuffExports
{
public static int GetNumber()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using MySimpleWorld;

public class MySimpleWorldImpl : IMySimpleWorld
public class MySimpleWorldExportsImpl : IMySimpleWorldExports
{
public static int GetNumber()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using MyResultsWorld;

public class MyResultsWorldImpl : IMyResultsWorld
public class MyResultsWorldExportsImpl : IMyResultsWorldExports
{
public static float StringError(float a)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@



public class MyWitResultsWorldImpl : IMyWitResultsWorld
public class MyWitResultsWorldExportsImpl : IMyWitResultsWorldExports
{
public static Result<float, string> StringError(float a)
{
Expand Down