Skip to content

Commit

Permalink
Update sourcebuild configuration to build net previous and net current (
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink authored Jan 29, 2024
1 parent 270691c commit 98c26a1
Show file tree
Hide file tree
Showing 20 changed files with 287 additions and 322 deletions.
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
<!-- Naming is based on dotnet/runtime one -->
<NetFrameworkMinimum>net462</NetFrameworkMinimum>
<NetCoreAppMinimum>netcoreapp3.1</NetCoreAppMinimum>
<!--
Arcade is making things hard to work with. This property is unset when its value is equal to NetMinimum.
https://github.com/dotnet/arcade/blob/66c9c5397d599af40f2a94989241944f5a73442a/src/Microsoft.DotNet.Arcade.Sdk/tools/TargetFrameworkDefaults.props#L16-L18
Because I don't want to complexify further the logic on VSTest just for that, I will set it to NetMinimum.
-->
<NetPrevious Condition=" $(NetPrevious) == '' ">$(NetMinimum)</NetPrevious>
</PropertyGroup>

<!-- Build & pack config -->
Expand Down
20 changes: 14 additions & 6 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@

<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />

<!-- Source build properties -->
<PropertyGroup Condition=" '$(DotNetBuildFromSource)' == 'true' ">
<!-- Force setting TargetFrameworks to net7.0 only if it was set -->
<TargetFrameworks Condition=" '$(TargetFrameworks)' != '' ">$(NetCurrent)</TargetFrameworks>
<!-- Force setting TargetFramework to net7.0 only if it was set -->
<TargetFramework Condition=" '$(TargetFramework)' != '' ">$(NetCurrent)</TargetFramework>
<!--
CI source build leg: this needs to build the current and previous source build TFM. Both are
necessary as the output of this leg is used in other CI source build legs. Those could be
targeting NetCurrent or NetPrevious hence we must produce both.
-->
<PropertyGroup Condition=" '$(DotNetBuildFromSource)' == 'true' AND '$(DotNetBuildFromSourceFlavor)' != 'Product' ">
<TargetFrameworks>$(NetPrevious);$(NetCurrent)</TargetFrameworks>
</PropertyGroup>

<!--
Source build the product: this is the all up build of the product which needs only NetCurrent
-->
<PropertyGroup Condition=" '$(DotNetBuildFromSource)' == 'true' AND '$(DotNetBuildFromSourceFlavor)' == 'Product' ">
<TargetFrameworks>$(NetCurrent)</TargetFrameworks>
</PropertyGroup>

<!-- Test project settings -->
Expand Down
3 changes: 3 additions & 0 deletions eng/SourceBuildPrebuiltBaseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
<!-- Caused by dependency on System.ComponentModel.Composition.4.5.0. This version is overridden in full source-build. -->
<UsagePattern IdentityGlob="System.Security.Principal.Windows/4.5.0" />
<UsagePattern IdentityGlob="Microsoft.Diagnostics.NETCore.Client/0.2.452401" />
<!-- Caused by multi-targeting source build for repo builds/CI. Product source build only targets NetCurrent. -->
<UsagePattern IdentityGlob="Microsoft.AspNetCore.App.Ref/8.0.0" />
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Host.linux-x64/8.0.0" />
</IgnorePatterns>
</UsageData>
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<NetStandardImplicitPackageVersion>2.0.0</NetStandardImplicitPackageVersion>
<AssemblyName>Microsoft.TestPlatform.Build</AssemblyName>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<IsTestProject>false</IsTestProject>
<UseBannedApiAnalyzers>true</UseBannedApiAnalyzers>
</PropertyGroup>

<Choose>
<When Condition=" '$(DotNetBuildFromSource)' == 'true' ">
<PropertyGroup>
<Tfm>$(NetCurrent)</Tfm>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<Tfm>netstandard2.0</Tfm>
</PropertyGroup>
</Otherwise>
</Choose>

<PropertyGroup>
<!-- This package is included even in source build -->
<IsPackable>true</IsPackable>
<NuspecFile>Microsoft.TestPlatform.Build.nuspec</NuspecFile>
<NuspecFile Condition=" '$(DotNetBuildFromSource)' != 'true' ">Microsoft.TestPlatform.Build.nuspec</NuspecFile>
<NuspecFile Condition=" '$(DotNetBuildFromSource)' == 'true' AND '$(DotNetBuildFromSourceFlavor)' != 'Product' ">Microsoft.TestPlatform.Build.sourcebuild.nuspec</NuspecFile>
<NuspecFile Condition=" '$(DotNetBuildFromSource)' == 'true' AND '$(DotNetBuildFromSourceFlavor)' == 'Product' ">Microsoft.TestPlatform.Build.sourcebuild.product.nuspec</NuspecFile>
<NuspecBasePath>$(OutputPath)</NuspecBasePath>
<PackageId>Microsoft.TestPlatform.Build</PackageId>
<PackageTags>vstest visual-studio unittest testplatform mstest microsoft test testing</PackageTags>
Expand All @@ -36,15 +24,16 @@
</PackageDescription>
</PropertyGroup>

<ItemGroup Label="NuGet">
<NuspecProperty Include="tfm=$(Tfm)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkPackageVersion)" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCorePackageVersion)" />
</ItemGroup>

<ItemGroup Label="NuGet">
<NuspecProperty Include="SourceBuildTfmPrevious=$(NetPrevious)" />
<NuspecProperty Include="SourceBuildTfmCurrent=$(NetCurrent)" />
</ItemGroup>

<ItemGroup>
<Content Include="Microsoft.TestPlatform.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
$CommonMetadataElements$

<dependencies>
<group targetFramework="$tfm$" />
<group targetFramework="netstandard2.0" />
</dependencies>
</metadata>

<files>
$CommonFileElements$

<file src="$tfm$/Microsoft.TestPlatform.targets" target="runtimes/any/native" />
<file src="$tfm$/Microsoft.TestPlatform.Build.dll" target="lib/$tfm$" />
<file src="netstandard2.0/Microsoft.TestPlatform.targets" target="runtimes/any/native" />
<file src="netstandard2.0/Microsoft.TestPlatform.Build.dll" target="lib/netstandard2.0" />

<!-- Add localized resources -->
<file src="$tfm$/cs/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/cs" />
<file src="$tfm$/de/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/de" />
<file src="$tfm$/es/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/es" />
<file src="$tfm$/fr/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/fr" />
<file src="$tfm$/it/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/it" />
<file src="$tfm$/ja/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/ja" />
<file src="$tfm$/ko/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/ko" />
<file src="$tfm$/pl/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/pl" />
<file src="$tfm$/pt-BR/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/pt-BR" />
<file src="$tfm$/ru/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/ru" />
<file src="$tfm$/tr/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/tr" />
<file src="$tfm$/zh-Hans/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/zh-Hans" />
<file src="$tfm$/zh-Hant/Microsoft.TestPlatform.Build.resources.dll" target="lib/$tfm$/zh-Hant" />
<file src="netstandard2.0/cs/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/cs" />
<file src="netstandard2.0/de/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/de" />
<file src="netstandard2.0/es/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/es" />
<file src="netstandard2.0/fr/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/fr" />
<file src="netstandard2.0/it/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/it" />
<file src="netstandard2.0/ja/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/ja" />
<file src="netstandard2.0/ko/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/ko" />
<file src="netstandard2.0/pl/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/pl" />
<file src="netstandard2.0/pt-BR/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/pt-BR" />
<file src="netstandard2.0/ru/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/ru" />
<file src="netstandard2.0/tr/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/tr" />
<file src="netstandard2.0/zh-Hans/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/zh-Hans" />
<file src="netstandard2.0/zh-Hant/Microsoft.TestPlatform.Build.resources.dll" target="lib/netstandard2.0/zh-Hant" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
$CommonMetadataElements$

<dependencies>
<group targetFramework="$SourceBuildTfmPrevious$" />
<group targetFramework="$SourceBuildTfmCurrent$" />
</dependencies>
</metadata>

<files>
$CommonFileElements$

<file src="$SourceBuildTfmPrevious$/Microsoft.TestPlatform.targets" target="runtimes/any/native" />
<file src="$SourceBuildTfmPrevious$/Microsoft.TestPlatform.Build.dll" target="lib/$SourceBuildTfmPrevious$" />
<file src="$SourceBuildTfmCurrent$/Microsoft.TestPlatform.Build.dll" target="lib/$SourceBuildTfmCurrent$" />

<!-- Add localized resources -->
<file src="$SourceBuildTfmPrevious$/**/Microsoft.TestPlatform.Build.resources.dll" target="lib/$SourceBuildTfmPrevious$" />
<file src="$SourceBuildTfmCurrent$/**/Microsoft.TestPlatform.Build.resources.dll" target="lib/$SourceBuildTfmCurrent$" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
$CommonMetadataElements$

<dependencies>
<group targetFramework="$SourceBuildTfmCurrent$" />
</dependencies>
</metadata>

<files>
$CommonFileElements$

<file src="$SourceBuildTfmPrevious$/Microsoft.TestPlatform.targets" target="runtimes/any/native" />
<file src="$SourceBuildTfmCurrent$/Microsoft.TestPlatform.Build.dll" target="lib/$SourceBuildTfmCurrent$" />

<!-- Add localized resources -->
<file src="$SourceBuildTfmCurrent$/**/Microsoft.TestPlatform.Build.resources.dll" target="lib/$SourceBuildTfmCurrent$" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Microsoft.TestPlatform.ObjectModel\Microsoft.TestPlatform.ObjectModel.csproj" />
<ProjectReference Include="$(RepoRoot)src\Microsoft.TestPlatform.CoreUtilities\Microsoft.TestPlatform.CoreUtilities.csproj" />
<ProjectReference Include="$(RepoRoot)src\Microsoft.TestPlatform.CoreUtilities\Microsoft.TestPlatform.CoreUtilities.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(DotNetBuildFromSource)' != 'true' ">
<ProjectReference Include="$(RepoRoot)src\DataCollectors\DumpMinitool\DumpMinitool.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@
<TargetFrameworks>$(NetCoreAppMinimum);$(NetFrameworkMinimum);net47;net471;net472;net48</TargetFrameworks>
</PropertyGroup>

<Choose>
<When Condition=" '$(DotNetBuildFromSource)' == 'true' ">
<PropertyGroup>
<NuspecFile>Microsoft.TestPlatform.CLI.sourcebuild.nuspec</NuspecFile>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<NuspecFile>Microsoft.TestPlatform.CLI.nuspec</NuspecFile>
</PropertyGroup>
</Otherwise>
</Choose>

<PropertyGroup>
<!-- This package is included even in source build -->
<NuspecFile Condition=" '$(DotNetBuildFromSource)' != 'true' ">Microsoft.TestPlatform.CLI.nuspec</NuspecFile>
<NuspecFile Condition=" '$(DotNetBuildFromSource)' == 'true' AND '$(DotNetBuildFromSourceFlavor)' != 'Product' ">Microsoft.TestPlatform.CLI.sourcebuild.nuspec</NuspecFile>
<NuspecFile Condition=" '$(DotNetBuildFromSource)' == 'true' AND '$(DotNetBuildFromSourceFlavor)' == 'Product' ">Microsoft.TestPlatform.CLI.sourcebuild.product.nuspec</NuspecFile>
<IsPackable>true</IsPackable>
<!-- This package is included even in source build -->
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
<NuspecBasePath>$(OutputPath)</NuspecBasePath>
<PackageId>Microsoft.TestPlatform.CLI</PackageId>
Expand All @@ -33,7 +23,8 @@
<ItemGroup Label="NuGet">
<NuspecProperty Include="SrcPackageFolder=$(SrcPackageFolder)" />
<NuspecProperty Include="TesthostRuntimeconfig=$(RepoRoot)temp\testhost" />
<NuspecProperty Include="SourceBuildTfm=$(NetCurrent)" />
<NuspecProperty Include="SourceBuildTfmPrevious=$(NetPrevious)" />
<NuspecProperty Include="SourceBuildTfmCurrent=$(NetCurrent)" />
</ItemGroup>

<PropertyGroup>
Expand Down
Loading

0 comments on commit 98c26a1

Please sign in to comment.