Skip to content

Commit

Permalink
Follow-up to the move of SourceGen + Engine (#4971)
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored Feb 12, 2025
1 parent d454a96 commit a9e46d6
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 32 deletions.
10 changes: 10 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
<MoqPublicKey>0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7</MoqPublicKey>
</PropertyGroup>

<!-- Versioning -->
<PropertyGroup>
<MSTestEnginePreReleaseVersionLabel>alpha</MSTestEnginePreReleaseVersionLabel>

<!--
This is a early preview package, keep 1.0.0-alpha or similar suffix even in official builds.
-->
<MSTestEngineVersionPrefix>1.0.0</MSTestEngineVersionPrefix>
</PropertyGroup>

<!-- Pack config -->
<PropertyGroup>
<Copyright>$(CopyrightMicrosoft)</Copyright>
Expand Down
4 changes: 0 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,5 @@
<Uri>https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage</Uri>
<Sha>766fbe6747db12e9e1ce4fd233946db99bd2fb08</Sha>
</Dependency>
<Dependency Name="MSTest.Engine" Version="1.0.0-alpha.25107.2">
<Uri>https://github.com/microsoft/testanywhere</Uri>
<Sha>0787bef4335997b316090bf2b95213e4fb3db003</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
2 changes: 0 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@
<PropertyGroup Label="MSTest prod dependencies - darc updated">
<MicrosoftDotNetBuildTasksTemplatingPackageVersion>10.0.0-beta.24606.6</MicrosoftDotNetBuildTasksTemplatingPackageVersion>
<MicrosoftTestingExtensionsCodeCoverageVersion>17.14.0-preview.25111.3</MicrosoftTestingExtensionsCodeCoverageVersion>
<!-- comment to facilitate merge conflicts -->
<MSTestEngineVersion>1.0.0-alpha.25107.2</MSTestEngineVersion>
</PropertyGroup>
</Project>
9 changes: 4 additions & 5 deletions src/Adapter/MSTest.Engine/MSTest.Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
<RootNamespace>Microsoft.Testing.Framework</RootNamespace>
<!-- Cancel default license (closed-source) and set license as packaged license file -->
<PackageLicenseExpressionInternal></PackageLicenseExpressionInternal>
<PackageLicenseExpression></PackageLicenseExpression>
<PackageLicenseFile>License.txt</PackageLicenseFile>
<!--
This is a early preview package, keep 1.0.0-alpha or similar suffix even in official builds.
-->
<VersionPrefix>1.0.0</VersionPrefix>
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>
<VersionPrefix>$(MSTestEngineVersionPrefix)</VersionPrefix>
<PreReleaseVersionLabel>$(MSTestEnginePreReleaseVersionLabel)</PreReleaseVersionLabel>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<!-- Temporarly disable missing XML documentation on public APIs -->
<NoWarn>$(NoWarn);CS1591</NoWarn>
<IsPackable>true</IsPackable>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
<RootNamespace>Microsoft.Testing.Framework.SourceGeneration</RootNamespace>
<!-- Cancel default license (closed-source) and set license as packaged license file -->
<PackageLicenseExpressionInternal></PackageLicenseExpressionInternal>
<PackageLicenseExpression></PackageLicenseExpression>
<PackageLicenseFile>License.txt</PackageLicenseFile>
<!--
This is a early preview package, keep 1.0.0-alpha or similar suffix even in official builds.
-->
<VersionPrefix>1.0.0</VersionPrefix>
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>

<VersionPrefix>$(MSTestEngineVersionPrefix)</VersionPrefix>
<PreReleaseVersionLabel>$(MSTestEnginePreReleaseVersionLabel)</PreReleaseVersionLabel>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<IsPackable>true</IsPackable>
</PropertyGroup>

<PropertyGroup>
Expand Down
11 changes: 9 additions & 2 deletions src/Package/MSTest.Sdk/MSTest.Sdk.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand Down Expand Up @@ -35,7 +35,14 @@
</ItemGroup>
<Target Name="GenerateTemplates" AfterTargets="PrepareForBuild">
<PropertyGroup>
<_TemplateProperties>MSTestEngineVersion=$(MSTestEngineVersion);MSTestVersion=$(Version);MicrosoftTestingPlatformVersion=$(Version.Replace('$(VersionPrefix)', '$(TestingPlatformVersionPrefix)'));MicrosoftNETTestSdkVersion=$(MicrosoftNETTestSdkVersion);MicrosoftTestingExtensionsCodeCoverageVersion=$(MicrosoftTestingExtensionsCodeCoverageVersion);MicrosoftPlaywrightVersion=$(MicrosoftPlaywrightVersion);AspireHostingTestingVersion=$(AspireHostingTestingVersion);MicrosoftTestingExtensionsFakesVersion=$(MicrosoftTestingExtensionsFakesVersion)</_TemplateProperties>
<!-- https://github.com/dotnet/arcade/blob/cb9979d0e7061c2252f4a3057c20eb72f503cff7/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.BeforeCommonTargets.targets#L111-L114 -->
<_MSTestEnginePreReleaseVersionLabel>$(MSTestEnginePreReleaseVersionLabel)</_MSTestEnginePreReleaseVersionLabel>
<_MSTestEnginePreReleaseVersionLabel Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(OfficialBuild)' != 'true'">ci</_MSTestEnginePreReleaseVersionLabel>
<_MSTestEnginePreReleaseVersionLabel Condition="'$(ContinuousIntegrationBuild)' != 'true' and '$(OfficialBuild)' != 'true'">dev</_MSTestEnginePreReleaseVersionLabel>
<_MSTestEngineVersionSuffix>$(_MSTestEnginePreReleaseVersionLabel)$(_BuildNumberLabels)</_MSTestEngineVersionSuffix>
<_MSTestEngineVersion>$(MSTestEngineVersionPrefix)</_MSTestEngineVersion>
<_MSTestEngineVersion Condition="'$(_MSTestEngineVersionSuffix)' != ''">$(_MSTestEngineVersion)-$(_MSTestEngineVersionSuffix)</_MSTestEngineVersion>
<_TemplateProperties>MSTestEngineVersion=$(_MSTestEngineVersion);MSTestVersion=$(Version);MicrosoftTestingPlatformVersion=$(Version.Replace('$(VersionPrefix)', '$(TestingPlatformVersionPrefix)'));MicrosoftNETTestSdkVersion=$(MicrosoftNETTestSdkVersion);MicrosoftTestingExtensionsCodeCoverageVersion=$(MicrosoftTestingExtensionsCodeCoverageVersion);MicrosoftPlaywrightVersion=$(MicrosoftPlaywrightVersion);AspireHostingTestingVersion=$(AspireHostingTestingVersion);MicrosoftTestingExtensionsFakesVersion=$(MicrosoftTestingExtensionsFakesVersion)</_TemplateProperties>
</PropertyGroup>

<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
<!-- Packages needed for the test assets but that we don't want to reference -->
<ItemGroup>
<PackageDownload Include="Aspire.Hosting.Testing" Version="[$(AspireHostingTestingVersion)]" />
<PackageDownload Include="MSTest.Engine" Version="[$(MSTestEngineVersion)]" />
<PackageDownload Include="MSTest.SourceGeneration" Version="[$(MSTestEngineVersion)]" />
</ItemGroup>

<Target Name="CopyNuGetPackagesForTestAssets" BeforeTargets="BeforeBuild">
Expand All @@ -36,8 +34,6 @@
<Copy SkipUnchangedFiles="true" SourceFiles="@(MicrosoftTestingExtensionsCodeCoveragePackage)" DestinationFiles="$(ArtifactsTmpDir)/packages/%(Filename)%(Extension)" />

<Copy SkipUnchangedFiles="true" SourceFiles="$(NuGetPackageRoot)aspire.hosting.testing\$(AspireHostingTestingVersion)\aspire.hosting.testing.$(AspireHostingTestingVersion).nupkg" DestinationFiles="$(ArtifactsTmpDir)/packages/aspire.hosting.testing.$(AspireHostingTestingVersion).nupkg" />
<Copy SkipUnchangedFiles="true" SourceFiles="$(NuGetPackageRoot)mstest.engine\$(MSTestEngineVersion)\mstest.engine.$(MSTestEngineVersion).nupkg" DestinationFiles="$(ArtifactsTmpDir)/packages/mstest.engine.$(MSTestEngineVersion).nupkg" />
<Copy SkipUnchangedFiles="true" SourceFiles="$(NuGetPackageRoot)mstest.sourcegeneration\$(MSTestEngineVersion)\mstest.sourcegeneration.$(MSTestEngineVersion).nupkg" DestinationFiles="$(ArtifactsTmpDir)/packages/mstest.sourcegeneration.$(MSTestEngineVersion).nupkg" />
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ static AcceptanceTestBase()
var cpmPropFileDoc = XDocument.Load(Path.Combine(RootFinder.Find(), "Directory.Packages.props"));
MicrosoftNETTestSdkVersion = cpmPropFileDoc.Descendants("MicrosoftNETTestSdkVersion").Single().Value;

var versionsPropsFileDoc = XDocument.Load(Path.Combine(RootFinder.Find(), "eng", "Versions.props"));
MSTestVersion = ExtractVersionFromPackage(Constants.ArtifactsPackagesShipping, "MSTest.TestFramework.");
MicrosoftTestingPlatformVersion = ExtractVersionFromPackage(Constants.ArtifactsPackagesShipping, "Microsoft.Testing.Platform.");
MSTestEngineVersion = ExtractVersionFromXmlFile(versionsPropsFileDoc, "MSTestEngineVersion");
MSTestEngineVersion = ExtractVersionFromPackage(Constants.ArtifactsPackagesShipping, "MSTest.Engine.");
}

protected static TFixture AssetFixture { get; private set; } = default!;
Expand Down Expand Up @@ -195,12 +194,4 @@ private static string ExtractVersionFromPackage(string rootFolder, string packag
string packageFullName = Path.GetFileName(matches[0]);
return packageFullName.Substring(packagePrefixName.Length, packageFullName.Length - packagePrefixName.Length - NuGetPackageExtensionName.Length);
}

private static string ExtractVersionFromXmlFile(XDocument versionPropsXmlDocument, string entryName)
{
XElement[] matches = versionPropsXmlDocument.Descendants(entryName).ToArray();
return matches.Length != 1
? throw new InvalidOperationException($"Was expecting to find a single entry for '{entryName}' but found {matches.Length}.")
: matches[0].Value;
}
}

0 comments on commit a9e46d6

Please # to comment.