Skip to content

Commit

Permalink
Update target to use boolean instead of enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink committed Jul 22, 2024
1 parent cf221a9 commit 7a70c5a
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/Microsoft.DotNet.Arcade.Sdk/tools/MSTest/MSTest.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,31 @@
<Project>

<PropertyGroup>
<MSTestDependencyMode Condition=" '$(MSTestDependencyMode)' == '' ">Packages</MSTestDependencyMode>
<MSTestRunner Condition=" '$(MSTestRunner)' == '' ">VSTest</MSTestRunner>
<UseMSTestMetaPackage Condition=" '$(UseMSTestMetaPackage)' == '' ">false</UseMSTestMetaPackage>
<UseMSTestSdk Condition=" '$(UseMSTestSdk)' == '' ">false</UseMSTestSdk>
<UseMSTestRunner Condition=" '$(UseMSTestRunner)' == '' ">false</UseMSTestRunner>
</PropertyGroup>

<ItemGroup Condition=" '$(MSTestDependencyMode)' == 'Packages' ">
<PackageReference Include="Microsoft.TestPlatform" Version="$(MicrosoftTestPlatformVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
<PackageReference Include="MSTest.TestFramework" Version="$(MSTestTestFrameworkVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
<PackageReference Include="MSTest.TestAdapter" Version="$(MSTestTestAdapterVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
<Target Name="_MSTestValidatePackageDeps" BeforeTargets="Build">
<Error Condition=" '$(UseMSTestMetaPackage)' == 'true' AND '$(UseMSTestSdk)' == 'true' " Text="Cannot use 'MSTest' metapackage and 'MSTest.Sdk' simultaneously." />
</Target>

<ItemGroup Condition=" '$(UseMSTestMetaPackage)' == 'false' AND '$(UseMSTestSdk)' == 'false' ">
<PackageReference Include="Microsoft.TestPlatform" Version="$(MicrosoftTestPlatformVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" />
<PackageReference Include="MSTest.TestFramework" Version="$(MSTestTestFrameworkVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" />
<PackageReference Include="MSTest.TestAdapter" Version="$(MSTestTestAdapterVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" />
</ItemGroup>

<ItemGroup Condition=" '$(MSTestDependencyMode)' == 'MetaPackage' ">
<PackageReference Include="MSTest" Version="$(MSTestVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
<!-- Tests.props will force adding Microsoft.NET.Test.Sdk which we don't want when using MSTest SDK or meta package -->
<ItemGroup Condition=" '$(IsTestProject)' == 'true' AND '$(ExcludeMicrosoftNetTestSdk)' != 'true' AND ('$(UseMSTestMetaPackage)' == 'true' OR '$(UseMSTestSdk)' == 'true') ">
<PackageReference Remove="Microsoft.NET.Test.Sdk" />
</ItemGroup>

<Import Project="..\VSTest.targets" Condition=" '$(MSTestRunner)' == 'VSTest' " />
<Import Project="..\Microsoft.Testing.Platform.targets" Condition=" '$(MSTestRunner)' == 'Microsoft.Testing.Platform' " />
<ItemGroup Condition=" '$(UseMSTestMetaPackage)' == 'true' ">
<PackageReference Include="MSTest" Version="$(MSTestVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" />
</ItemGroup>

<Import Project="..\VSTest.targets" Condition=" '$(UseMSTestRunner)' == 'false' " />
<Import Project="..\Microsoft.Testing.Platform.targets" Condition=" '$(UseMSTestRunner)' == 'true' " />

</Project>

0 comments on commit 7a70c5a

Please sign in to comment.