master
targets 56 lines 3.5 KB
Raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <!-- If we have a RuntimeIdentifier, the DLL is referenced automatically.
4 If it is missing, we fall back to PlatformTarget to reference it manually. -->
5 <Choose>
6 <When Condition="'$(RuntimeIdentifier)' != ''">
7 <PropertyGroup>
8 <_wslcPlatform Condition="$(RuntimeIdentifier.EndsWith('-x64'))">x64</_wslcPlatform>
9 <_wslcPlatform Condition="$(RuntimeIdentifier.EndsWith('-arm64'))">arm64</_wslcPlatform>
10 <_wslcInvalidPlatformProperty Condition="'$(_wslcPlatform)' == ''">RuntimeIdentifier</_wslcInvalidPlatformProperty>
11 <_wslcInvalidPlatform Condition="'$(_wslcPlatform)' == ''">$(RuntimeIdentifier)</_wslcInvalidPlatform>
12 </PropertyGroup>
13 </When>
14 <Otherwise>
15 <PropertyGroup>
16 <_wslcPlatform Condition="'$(PlatformTarget)' == 'x64'">x64</_wslcPlatform>
17 <_wslcPlatform Condition="'$(PlatformTarget)' == 'arm64'">arm64</_wslcPlatform>
18 <_wslcInvalidPlatformProperty Condition="'$(_wslcPlatform)' == ''">PlatformTarget</_wslcInvalidPlatformProperty>
19 <_wslcInvalidPlatform Condition="'$(_wslcPlatform)' == ''">$(PlatformTarget)</_wslcInvalidPlatform>
20 </PropertyGroup>
21
22 <ItemGroup Condition="'$(_wslcPlatform)' != ''">
23 <ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-$(_wslcPlatform)\native\wslcsdk.dll" />
24 </ItemGroup>
25 </Otherwise>
26 </Choose>
27
28 <Target Name="WslcValidatePlatform" BeforeTargets="PrepareForBuild" Condition="'$(_wslcInvalidPlatform)' != ''">
29 <Error Text="wslcsdk.dll could not be copied because the $(_wslcInvalidPlatformProperty) '$(_wslcInvalidPlatform)' is not supported. Only x64 and arm64 platforms are supported." />
30 </Target>
31
32 <Import Project="$(MSBuildThisFileDirectory)..\Microsoft.WSL.Containers.common.targets" />
33
34 <!-- ================================================================== -->
35 <!-- C# specific: CPS Up-to-Date Check for container source files -->
36 <!-- ================================================================== -->
37
38 <!-- Register the saved tar and source files for CPS up-to-date check.
39 The tar is the sole build output (build is atomic with save — see
40 _WslcBuildAndSaveSingleImage in common.targets). -->
41 <Target Name="_WslcRegisterUpToDateCheckInputs"
42 BeforeTargets="CollectUpToDateCheckBuiltDesignTime"
43 Condition="'$(UsingMicrosoftNETSdk)' == 'true' AND '@(WslcImage)' != ''">
44 <ItemGroup>
45 <UpToDateCheckBuilt Include="%(WslcImage.TarLocation)"
46 Condition="'%(WslcImage.TarLocation)' != ''" />
47 <UpToDateCheckBuilt Include="$(OutDir)%(WslcImage.Identity).tar"
48 Condition="'%(WslcImage.TarLocation)' == ''" />
49 <UpToDateCheckInput Include="%(WslcImage.Dockerfile)" Condition="'%(WslcImage.Dockerfile)' != ''" />
50 <_WslcUpToDateDirs Include="@(WslcImage->'%(Sources)')" Condition="'%(WslcImage.Sources)' != ''" />
51 <UpToDateCheckInput Include="%(_WslcUpToDateDirs.Identity)\**\*" Condition="'%(_WslcUpToDateDirs.Identity)' != ''" />
52 <UpToDateCheckInput Include="%(WslcImage.Context)\**\*" Condition="'%(WslcImage.Sources)' == '' AND '%(WslcImage.Context)' != ''" />
53 </ItemGroup>
54 </Target>
55
56 </Project>