forked from dotnet/dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
54 lines (43 loc) · 2.88 KB
/
Directory.Build.targets
File metadata and controls
54 lines (43 loc) · 2.88 KB
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
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(SkipArcadeSdkImport)' != 'true'" />
<Import Project="$(RepositoryEngineeringDir)shared-source-only.targets" Condition="'$(SkipSharedSourceOnlyImport)' != 'true'" />
<!-- The SkipPrepareSdkArchive switch exists so that outside components like the license scan test pipeline
can run a subset of tests that don't need the SDK archive without building the VMR.
The switch is also useful for the local dev innerloop to build the test projects without needing to run them. -->
<Target Name="DetermineSourceBuiltSdkVersion" Condition="'$(SkipPrepareSdkArchive)' != 'true'">
<PropertyGroup>
<SdkFilenamePrefix>dotnet-sdk-</SdkFilenamePrefix>
</PropertyGroup>
<ItemGroup>
<SdkTarballItem Condition="'$(SdkTarballPath)' != ''" Include="$(SdkTarballPath)" />
<SdkTarballItem Condition="'$(SdkTarballPath)' == ''" Include="$(ArtifactsAssetsDir)Sdk/**/$(SdkFilenamePrefix)*$(ArchiveExtension)"
Exclude="$(ArtifactsAssetsDir)Sdk/**/$(SdkFilenamePrefix)*.wixpack.zip" />
</ItemGroup>
<Error Text="Didn't find an SDK archive." Condition="'@(SdkTarballItem)' == ''" />
<Error Text="Found more than one SDK archive." Condition="@(SdkTarballItem->Count()) > 1" />
<!--
Extract SDK version from SDK tarball filename.
Keep in sync with dotnet-sdk's archive location and filename.
Example:
artifacts\assets\<config>\Sdk\9.0.100-alpha.1.24057.1\dotnet-sdk-9.0.100-alpha.1.24057.1-fedora.38-x64.tar.gz
artifacts\assets\<config>\Sdk\<SdkVersion>\dotnet-sdk-<SdkVersion>-<TargetRid><ArchiveExtension>
-->
<PropertyGroup>
<SdkFilename>%(SdkTarballItem.Filename)%(SdkTarballItem.Extension)</SdkFilename>
<SdkTarballPath Condition="'$(SdkTarballPath)' == ''">%(SdkTarballItem.Identity)</SdkTarballPath>
<SourceBuiltSdkVersion>$(SdkFilename.Replace('$(SdkFilenamePrefix)','').Replace('-$(TargetRid)$(ArchiveExtension)',''))</SourceBuiltSdkVersion>
</PropertyGroup>
</Target>
<Target Name="DetermineSourceBuiltRuntimeVersion">
<!-- We can't rely on there being a runtime artifact in the assets directory because this may be a non-1xx branch
that doesn't produce any runtime artifacts. So instead, we determine the runtime version by examining the
directory structure of the shared runtime within the SDK. -->
<Error Text="Didn't find extracted SDK directory at '$(DotNetSdkExtractDir)'." Condition="!Exists('$(DotNetSdkExtractDir)')" />
<ItemGroup>
<RuntimeVersionFile Include="$(DotNetSdkExtractDir)shared\Microsoft.NETCore.App\*\.version" />
</ItemGroup>
<PropertyGroup>
<SourceBuiltRuntimeVersion>$([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName('%(RuntimeVersionFile.Identity)'))))</SourceBuiltRuntimeVersion>
</PropertyGroup>
</Target>
</Project>