|
| 1 | +<Project Sdk="Microsoft.DotNet.Helix.Sdk" DefaultTargets="Test"> |
| 2 | + |
| 3 | + <!-- This project uses the Helix SDK, documented at |
| 4 | + https://github.com/dotnet/arcade/tree/master/src/Microsoft.DotNet.Helix/Sdk, |
| 5 | + to send a small test job that uses ILC to compile a few projects. |
| 6 | + This is used to smoke-test ILC compiled for architectures we don't |
| 7 | + have native test machines for (not-x64). |
| 8 | + --> |
| 9 | + <PropertyGroup> |
| 10 | + <Creator>$(_Creator)</Creator> |
| 11 | + <HelixAccessToken>$(_HelixAccessToken)</HelixAccessToken> |
| 12 | + <HelixBuild>$(_HelixBuild)</HelixBuild> |
| 13 | + <HelixSource>$(_HelixSource)</HelixSource> |
| 14 | + <HelixTargetQueues>$(_HelixTargetQueues)</HelixTargetQueues> |
| 15 | + <HelixType>$(_HelixType)</HelixType> |
| 16 | + |
| 17 | + <GlobalJsonContent>$([System.IO.File]::ReadAllText('$(RepoRoot)global.json'))</GlobalJsonContent> |
| 18 | + <IncludeDotNetCli>true</IncludeDotNetCli> |
| 19 | + <DotNetCliPackageType>sdk</DotNetCliPackageType> |
| 20 | + <DotNetCliVersion>$([System.Text.RegularExpressions.Regex]::Match($(GlobalJsonContent), '(%3F<="dotnet": ").*(%3F=")'))</DotNetCliVersion> |
| 21 | + </PropertyGroup> |
| 22 | + |
| 23 | + <Target Name="BuildHelixWorkItems" BeforeTargets="CoreTest" Condition="'$(HelixTargetQueue)' != ''"> |
| 24 | + <PropertyGroup> |
| 25 | + <TestTargetOS>wasi</TestTargetOS> |
| 26 | + <TestTargetRid>$(TestTargetOS)-wasm</TestTargetRid> |
| 27 | + <IlcHostPlatform>$(TargetOS)-$(TargetArchitecture)</IlcHostPlatform> |
| 28 | + <WindowsShell Condition="$(HelixTargetQueue.ToLowerInvariant().Contains('windows'))">true</WindowsShell> |
| 29 | + <ExeExt Condition="'$(WindowsShell)' == 'true'">.exe</ExeExt> |
| 30 | + <WorkItemDirectory>$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', '$(IlcHostPlatform)-$(Configuration)-NativeAOT-LLVM-HelixTestPayload'))</WorkItemDirectory> |
| 31 | + </PropertyGroup> |
| 32 | + |
| 33 | + <Error Text="Only WASI SDK supported for $(IlcHostPlatform)" Condition="'$(TestTargetOS)' != 'wasi'" /> |
| 34 | + |
| 35 | + <ItemGroup> |
| 36 | + <PackageFile Include="$(ArtifactsShippingPackagesDir)*" /> |
| 37 | + <SampleProjectFile Include="$(RepoRoot)samples/**/*" /> |
| 38 | + </ItemGroup> |
| 39 | + |
| 40 | + <RemoveDir Directories="$(WorkItemDirectory)" /> |
| 41 | + <Copy SourceFiles="@(PackageFile)" DestinationFolder="$(WorkItemDirectory)pkg-src" /> |
| 42 | + <Copy SourceFiles="@(SampleProjectFile)" DestinationFolder="$(WorkItemDirectory)samples/%(RecursiveDir)" Condition="'%(Filename)%(Extension)' != 'nuget.config'" /> |
| 43 | + <Exec Command="pwsh install-wasi-sdk.ps1 -InstallDir $(WorkItemDirectory) -HostArch $(TargetArchitecture)" Condition="'$(TestTargetOS)' == 'wasi'" /> |
| 44 | + |
| 45 | + <!-- Windows WASI SDK is very heavy due to **many** clang copies. Remove them for better upload times. --> |
| 46 | + <Delete Files="$(WorkItemDirectory)wasi-sdk/bin/wasm32-wasi-clang$(ExeExt); |
| 47 | + $(WorkItemDirectory)wasi-sdk/bin/wasm32-wasi-clang++$(ExeExt); |
| 48 | + $(WorkItemDirectory)wasi-sdk/bin/wasm32-wasi-threads-clang$(ExeExt); |
| 49 | + $(WorkItemDirectory)wasi-sdk/bin/wasm32-wasi-threads-clang++$(ExeExt); |
| 50 | + $(WorkItemDirectory)wasi-sdk/bin/wasm32-wasip1-clang$(ExeExt); |
| 51 | + $(WorkItemDirectory)wasi-sdk/bin/wasm32-wasip1-clang++$(ExeExt); |
| 52 | + $(WorkItemDirectory)wasi-sdk/bin/wasm32-wasip1-threads-clang$(ExeExt); |
| 53 | + $(WorkItemDirectory)wasi-sdk/bin/wasm32-wasip1-threads-clang++$(ExeExt); |
| 54 | + $(WorkItemDirectory)wasi-sdk/bin/wasm32-wasip2-clang$(ExeExt); |
| 55 | + $(WorkItemDirectory)wasi-sdk/bin/wasm32-wasip2-clang++$(ExeExt); |
| 56 | + $(WorkItemDirectory)wasi-sdk/bin/clang-tidy$(ExeExt); |
| 57 | + $(WorkItemDirectory)wasi-sdk/bin/clang-cpp$(ExeExt); |
| 58 | + $(WorkItemDirectory)wasi-sdk/bin/clang-cl$(ExeExt); |
| 59 | + $(WorkItemDirectory)wasi-sdk/bin/ld.lld$(ExeExt); |
| 60 | + $(WorkItemDirectory)wasi-sdk/bin/ld64.lld$(ExeExt); |
| 61 | + $(WorkItemDirectory)wasi-sdk/bin/lld-link$(ExeExt)" /> |
| 62 | + |
| 63 | + <PropertyGroup Condition="'$(WindowsShell)' == 'true'"> |
| 64 | + <HelixPreCommands>set RestoreAdditionalProjectSources=%HELIX_WORKITEM_PAYLOAD%\pkg-src</HelixPreCommands> |
| 65 | + <HelixPreCommands Condition="'$(TestTargetOS)' == 'wasi'">$(HelixPreCommands);set WASI_SDK_PATH=%HELIX_WORKITEM_PAYLOAD%\wasi-sdk</HelixPreCommands> |
| 66 | + <HelixCommand> |
| 67 | +dotnet publish %HELIX_WORKITEM_PAYLOAD%\samples\HelloWorld\HelloWorld.csproj -c $(Configuration) -r $(TestTargetRid) &&^ |
| 68 | +dotnet publish %HELIX_WORKITEM_PAYLOAD%\samples\NativeLibrary\NativeLibrary.csproj -c $(Configuration) -r $(TestTargetRid) |
| 69 | + </HelixCommand> |
| 70 | + </PropertyGroup> |
| 71 | + |
| 72 | + <PropertyGroup Condition="'$(WindowsShell)' != 'true'"> |
| 73 | + <HelixPreCommands>export RestoreAdditionalProjectSources=$HELIX_WORKITEM_PAYLOAD/pkg-src</HelixPreCommands> |
| 74 | + <HelixPreCommands Condition="'$(TestTargetOS)' == 'wasi'">$(HelixPreCommands);export WASI_SDK_PATH=$HELIX_WORKITEM_PAYLOAD/wasi-sdk</HelixPreCommands> |
| 75 | + <HelixPreCommands Condition="'$(TestTargetOS)' == 'wasi'">$(HelixPreCommands);chmod +x $WASI_SDK_PATH/bin/*</HelixPreCommands> |
| 76 | + <HelixCommand> |
| 77 | +dotnet publish $HELIX_WORKITEM_PAYLOAD/samples/HelloWorld/HelloWorld.csproj -c $(Configuration) -r $(TestTargetRid) &&\ |
| 78 | +dotnet publish $HELIX_WORKITEM_PAYLOAD/samples/NativeLibrary/NativeLibrary.csproj -c $(Configuration) -r $(TestTargetRid) |
| 79 | + </HelixCommand> |
| 80 | + </PropertyGroup> |
| 81 | + |
| 82 | + <ItemGroup> |
| 83 | + <HelixWorkItem Include="NativeAOT-LLVM-$(IlcHostPlatform)-ILC-SmokeTest"> |
| 84 | + <Command>$(HelixCommand)</Command> |
| 85 | + <PayloadDirectory>$(WorkItemDirectory)</PayloadDirectory> |
| 86 | + <Timeout>01:00:00</Timeout> |
| 87 | + </HelixWorkItem> |
| 88 | + </ItemGroup> |
| 89 | + |
| 90 | + <Message Text="HelixWorkItem: %(HelixWorkItem.Identity) |
| 91 | + PreCommands: $(HelixPreCommands) |
| 92 | + Command: %(HelixWorkItem.Command) |
| 93 | + PayloadDirectory: %(HelixWorkItem.PayloadDirectory)" Importance="High" /> |
| 94 | + |
| 95 | + <Error Text="Stopping the build for dry run" Condition="'$(HelixDryRun)' == 'true'" /> |
| 96 | + </Target> |
| 97 | + |
| 98 | +</Project> |
0 commit comments