forked from bytecodealliance/componentize-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWasmComponent.Sdk.csproj
93 lines (76 loc) · 5.25 KB
/
WasmComponent.Sdk.csproj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="build\BytecodeAlliance.Componentize.DotNet.Wasm.SDK.props" />
<PropertyGroup>
<PackageId>BytecodeAlliance.Componentize.DotNet.Wasm.SDK</PackageId>
<Authors>Bytecode Alliance Developers</Authors>
<Description>Tooling for creating WebAssembly components from C#</Description>
<RepositoryUrl>https://github.com/bytecodealliance/componentize-dotnet</RepositoryUrl>
<PackageLicenseExpression>Apache-2.0 WITH LLVM-exception</PackageLicenseExpression>
<PackageReadmeFile>Readme.md</PackageReadmeFile>
<PackageTags>webassembly, .net, wasm</PackageTags>
<PackageReleaseNotes>https://github.com/bytecodealliance/componentize-dotnet/releases/tag/$(PackageVersion)</PackageReleaseNotes>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<!-- Things you might want to edit -->
<!-- Set BuildWasmToolsLocally to true if you want to build modules/wasm-tools locally and use its output -->
<BuildWasmToolsLocally>false</BuildWasmToolsLocally>
<PrebuiltWasmToolsVersion>1.209.1</PrebuiltWasmToolsVersion>
<PrebuiltWasmToolsBaseUrl>https://github.com/bytecodealliance/wasm-tools/releases/download/v$(PrebuiltWasmToolsVersion)/wasm-tools-$(PrebuiltWasmToolsVersion)</PrebuiltWasmToolsBaseUrl>
<WasmtimeVersionForWasiSnapshotPreview1Adapters>21.0.1</WasmtimeVersionForWasiSnapshotPreview1Adapters>
<WasmToolsModuleRoot>$(MSBuildThisFileDirectory)..\..\modules\wasm-tools\</WasmToolsModuleRoot>
<!-- Don't pack any assemblies in lib/*/.dll.-->
<NoPackageAnalysis>true</NoPackageAnalysis>
<IncludeBuildOutput>false</IncludeBuildOutput>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler.LLVM" PrivateAssets="None" />
<PackageReference Include="runtime.$(NETCoreSdkPortableRuntimeIdentifier).Microsoft.DotNet.ILCompiler.LLVM" PrivateAssets="None" />
<ProjectReference Include="..\WitBindgen\WitBindgen.csproj" PrivateAssets="None" />
</ItemGroup>
<ItemGroup>
<None Include="../../Readme.md" Pack="true" PackagePath="\"/>
</ItemGroup>
<ItemGroup>
<None Include="ImportInDev.proj" />
</ItemGroup>
<Target Name="BuildOrDownloadNativeTooling" BeforeTargets="Build" DependsOnTargets="BuildNativeTooling; DownloadNativeTooling;">
</Target>
<Target Name="BuildNativeTooling" Condition="'$(BuildWasmToolsLocally)' == 'true'">
<Exec Command="cargo build --release" WorkingDirectory="$(WasmToolsModuleRoot)" />
<PropertyGroup>
<WasmToolsExeName>wasm-tools</WasmToolsExeName>
<WasmToolsExeName Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(WasmToolsExeName).exe</WasmToolsExeName>
</PropertyGroup>
<Copy SourceFiles="$(WasmToolsModuleRoot)target\release\$(WasmToolsExeName)" DestinationFolder="tools\$(WasmToolsTarget)\" />
</Target>
<Target Name="DownloadNativeTooling" Condition="'$(BuildWasmToolsLocally)' != 'true'" DependsOnTargets="GetDownloadNativeToolingDependencies; DownloadNativeToolingCore">
</Target>
<Target Name="GetDownloadNativeToolingDependencies">
<ItemGroup>
<PrebuiltWasmToolsTarget Include="aarch64-linux" Rid="linux-arm64" Ext=".tar.gz" />
<PrebuiltWasmToolsTarget Include="aarch64-macos" Rid="osx-arm64" Ext=".tar.gz" />
<PrebuiltWasmToolsTarget Include="x86_64-linux" Rid="linux-x64" Ext=".tar.gz" />
<PrebuiltWasmToolsTarget Include="x86_64-macos" Rid="osx-x64" Ext=".tar.gz" />
<!-- tar on non-Windows often cannot handle zip archives. Until we have a solution, we canonly publish the packages from the Windows build.
See https://github.com/bytecodealliance/componentize-dotnet/issues/41 -->
<PrebuiltWasmToolsTarget Include="x86_64-windows" Rid="win-x64" Ext=".zip" ExeExt=".exe" Condition="$([MSBuild]::IsOSPlatform('Windows'))" />
</ItemGroup>
<ItemGroup>
<PrebuiltWasmToolsOutputs Include="tools\%(PrebuiltWasmToolsTarget.Rid)\wasm-tools%(PrebuiltWasmToolsTarget.ExeExt)" />
</ItemGroup>
</Target>
<Target Name="DownloadNativeToolingCore" Inputs="@(PrebuiltWasmToolsOutputs)" Outputs="@(PrebuiltWasmToolsOutputs)">
<DownloadFile SourceUrl="$(PrebuiltWasmToolsBaseUrl)-%(PrebuiltWasmToolsTarget.Identity)%(PrebuiltWasmToolsTarget.Ext)" DestinationFolder="tools\temp" DestinationFileName="%(PrebuiltWasmToolsTarget.Rid)%(PrebuiltWasmToolsTarget.Ext)" />
<MakeDir Directories="tools\%(PrebuiltWasmToolsTarget.Rid)" />
<Exec Command="tar -xf "temp/%(PrebuiltWasmToolsTarget.Rid)%(PrebuiltWasmToolsTarget.Ext)" -C %(PrebuiltWasmToolsTarget.Rid) --strip-components=1" WorkingDirectory="tools" />
<RemoveDir Directories="tools\temp" />
</Target>
<Target Name="PackTaskDependencies" BeforeTargets="GenerateNuspec">
<ItemGroup>
<_PackageFiles Include="build\**" BuildAction="Content" PackagePath="build" />
<_PackageFiles Include="tools\**" BuildAction="Content" PackagePath="tools" />
</ItemGroup>
</Target>
</Project>