Skip to content

Commit

Permalink
Fix MSTest version under testing platform (#2630)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink authored Mar 25, 2024
1 parent 3beee7a commit a4f58aa
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 20 deletions.
29 changes: 29 additions & 0 deletions src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,35 @@
</None>
</ItemGroup>

<!-- Insert the MSTestVersion.cs -->
<PropertyGroup>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
<Compile Include="**/*.cs" Exclude="**/*.user; **/*.*proj; **/*.sln; **/*.vssscc" />
</ItemGroup>
<Target Name="InsertMSTestVersion" BeforeTargets="PrepareForBuild" >
<ItemGroup>
<Compile Include="$(Compile);$(IntermediateOutputPath)/MSTestVersion.cs" />
</ItemGroup>
</Target>

<!-- Version templating -->
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Templating" Version="$(MicrosoftDotNetBuildTasksTemplatingPackageVersion)" AllowExplicitReference="true" PrivateAssets="All" IsImplicitlyDefined="true" />
</ItemGroup>
<Target Name="GenerateMSTestVersionSourceFile" AfterTargets="PrepareForBuild" >
<PropertyGroup>
<_TemplateProperties>Version=$(Version)</_TemplateProperties>
</PropertyGroup>
<ItemGroup>
<_TemplateCsproj Include="$(MSBuildProjectDirectory)/MSTestVersion.cs.template" Destination="$(IntermediateOutputPath)/MSTestVersion.cs" />
</ItemGroup>
<GenerateFileFromTemplate TemplateFile="%(_TemplateCsproj.Identity)" OutputPath="%(_TemplateCsproj.Destination)" Properties="$(_TemplateProperties)">
<Output TaskParameter="ResolvedOutputPath" ItemName="FileWrites" />
</GenerateFileFromTemplate>
</Target>

<!-- SDK bottom import -->
<Import Project="Sdk.targets" Sdk="MSBuild.Sdk.Extras" Condition=" '$(OS)' == 'Windows_NT' " />
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" Condition=" '$(OS)' != 'Windows_NT' " />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// <summary>
/// Repository version, created at build time.
/// </summary>
internal static class RepositoryVersion
internal static class MSTestVersion
{
public const string Version = "${Version}";
public const string SemanticVersion = "${Version}";
}
10 changes: 0 additions & 10 deletions src/Adapter/MSTest.TestAdapter/RepositoryVersion.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal sealed class MSTestExtension : IExtension

public string DisplayName => "MSTest";

public string Version => RepositoryVersion.Version;
public string Version => MSTestVersion.SemanticVersion;

public string Description => "MSTest Framework for Microsoft Testing Platform";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace Microsoft.Testing.Platform.Helpers;

internal static class AppVersion
{
public static readonly string DefaultSemVer = RepositoryVersion.Version;
public static readonly string DefaultSemVer = PlatformVersion.Version;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
<SuppressLicenseValidation>true</SuppressLicenseValidation>
</PropertyGroup>

<!-- Insert the RepositoryVersion.cs -->
<!-- Insert the PlatformVersion.cs -->
<PropertyGroup>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
<Compile Include="**/*.cs" Exclude="**/*.user; **/*.*proj; **/*.sln; **/*.vssscc" />
</ItemGroup>
<Target Name="InsertRepositoryVersion" BeforeTargets="PrepareForBuild" >
<Target Name="InsertPlatformVersion" BeforeTargets="PrepareForBuild" >
<ItemGroup>
<Compile Include="$(Compile);$(IntermediateOutputPath)/RepositoryVersion.cs" />
<Compile Include="$(Compile);$(IntermediateOutputPath)/PlatformVersion.cs" />
</ItemGroup>
</Target>

Expand Down Expand Up @@ -106,12 +106,12 @@ This package provides the core platform and the .NET implementation of the proto
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Templating" Version="$(MicrosoftDotNetBuildTasksTemplatingPackageVersion)" AllowExplicitReference="true" PrivateAssets="All" IsImplicitlyDefined="true" />
</ItemGroup>
<Target Name="GenerateRepositoryVersionSourceFile" AfterTargets="PrepareForBuild" >
<Target Name="GeneratePlatformVersionSourceFile" AfterTargets="PrepareForBuild" >
<PropertyGroup>
<_TemplateProperties>Version=$(Version)</_TemplateProperties>
</PropertyGroup>
<ItemGroup>
<_TemplateCsproj Include="$(MSBuildProjectDirectory)/RepositoryVersion.cs.template" Destination="$(IntermediateOutputPath)/RepositoryVersion.cs" />
<_TemplateCsproj Include="$(MSBuildProjectDirectory)/PlatformVersion.cs.template" Destination="$(IntermediateOutputPath)/PlatformVersion.cs" />
</ItemGroup>
<GenerateFileFromTemplate TemplateFile="%(_TemplateCsproj.Identity)" OutputPath="%(_TemplateCsproj.Destination)" Properties="$(_TemplateProperties)">
<Output TaskParameter="ResolvedOutputPath" ItemName="FileWrites" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// <summary>
/// Repository version, created at build time.
/// </summary>
internal static class RepositoryVersion
internal static class PlatformVersion
{
public const string Version = "${Version}";
}

0 comments on commit a4f58aa

Please sign in to comment.