lyra-wasm-scripting-test/guests/csharp/dotnet-guest-test/dotnet-guest-test.csproj

60 lines
2.4 KiB
XML

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>
<UseAppHost>false</UseAppHost>
<PublishTrimmed>true</PublishTrimmed>
<InvariantGlobalization>true</InvariantGlobalization>
<SelfContained>true</SelfContained>
<IlcExportUnmanagedEntrypoints>true</IlcExportUnmanagedEntrypoints>
</PropertyGroup>
<!-- Copy WIT files from LyraApi to lyra-api wit folder. -->
<Target Name="CopyFolderOnBuild" BeforeTargets="WitCompile_InvokeTool">
<ItemGroup>
<MyFiles Include="..\LyraApi\wit\**\*.wit" />
</ItemGroup>
<Copy SourceFiles="@(MyFiles)" DestinationFolder="wit\deps\lyraapi\%(RecursiveDir)" />
</Target>
<!-- Remove bindgen of LyraApi WIT .-->
<Target Name="RemoveBindgenLyraApi" AfterTargets="WitCompile_InvokeTool">
<ItemGroup>
<FilesToDelete Include="obj\Debug\net*\wasi-wasm\wit_bindgen\*.lyra.api.*.cs"/>
</ItemGroup>
<Delete Files="@(FilesToDelete)" />
</Target>
<!-- Reuse bindgen from LyraApi package instead of using local bindgen. -->
<Target Name="UpdateLyraApiReferences" AfterTargets="WitCompile_InvokeTool; RemoveBindgenLyraApi">
<Exec Condition="'$(OS)' == 'Unix'" Command="find obj/Debug -type f -wholename '*wit_bindgen/*.cs' -exec sed -i 's/ExampleWorld\.wit\.imports\.lyra\.api/ImportsWorld.wit.imports.lyra.api/g' {} \;" />
<Exec Condition="'$(OS)' == 'Windows_NT'" Command="powershell -Command &quot;Get-ChildItem -Path 'obj\Debug' -Recurse -Filter '*.cs' ^
| Where-Object { $_.FullName -match 'wit_bindgen' } ^
| ForEach-Object { (Get-Content -Path $_.FullName) -replace 'ExampleWorld\.wit\.imports\.lyra\.api', 'ImportsWorld.wit.imports.lyra.api' ^
| Set-Content -Path $_.FullName }&quot;" />
</Target>
<ItemGroup>
<PackageReference Include="BytecodeAlliance.Componentize.DotNet.Wasm.SDK" Version="0.4.0-preview00007" />
</ItemGroup>
<ItemGroup>
<Wit Remove="**\*.wit" />
<!-- <Wit Include="wit/deps/lyraapi" World="imports" /> -->
<Wit Include="wit" World="example" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="runtime.linux-x64.Microsoft.DotNet.ILCompiler.LLVM" Version="10.0.0-alpha.1.24531.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LyraApi\LyraApi.csproj" />
</ItemGroup>
</Project>