Skip to content
This repository was archived by the owner on Jan 11, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions src/Microsoft.DotNet.Build.Tasks.net45/project.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"dependencies": {
"Newtonsoft.Json": "7.0.1",
"NuGet.Versioning": "3.4.0-beta-488",
"System.Collections.Immutable": "1.1.37",
"System.Reflection.Metadata": "1.1.0"
},
"frameworks": {
"net45": { }
}
}
"dependencies": {
"Newtonsoft.Json": "7.0.1",
"NuGet.Versioning": "3.4.0-beta-488",
"System.Collections.Immutable": "1.1.37",
"System.Reflection.Metadata": "1.1.0",
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23907",
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0-rc2-23907"

This comment was marked as spam.

This comment was marked as spam.

},
"frameworks": {
"net46": { }

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

},
"runtimes": {
"win": { }
}
}
35 changes: 35 additions & 0 deletions src/Microsoft.DotNet.Build.Tasks/GetTargetOS.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System.Runtime.InteropServices;
using System;
using System.IO;
using System.Linq;

namespace Microsoft.DotNet.Build.Tasks
{
public class GetTargetOS : Task
{
[Output]
public string TargetOS { get; set; }

public override bool Execute()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
TargetOS = "Windows_NT";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
TargetOS = "Linux";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
TargetOS = "OSX";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD")))
TargetOS = "FreeBSD";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD")))
TargetOS = "NetBSD";

return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<Compile Include="GetPackageVersion.cs" />
<Compile Include="GetPackageDependencies.cs" />
<Compile Include="GetNextRevisionNumber.cs" />
<Compile Include="GetTargetOS.cs" />
<Compile Include="LocatePreviousContract.cs" />
<Compile Include="NormalizePaths.cs" />
<Compile Include="GetDoItemsIntersect.cs" />
Expand Down
25 changes: 16 additions & 9 deletions src/Microsoft.DotNet.Build.Tasks/PackageFiles/tests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!-- This is the target that copies the test assets to the test output -->
<Import Project="$(MSBuildThisFileDirectory)publishtest.targets" />

<UsingTask TaskName="GetTargetOS" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<!-- Which categories of tests to run by default -->
<PropertyGroup>
<TestDisabled>false</TestDisabled>
Expand Down Expand Up @@ -59,11 +59,7 @@
<PropertyGroup>
<XunitResultsFileName>testResults.xml</XunitResultsFileName>
<XunitOptions>$(XunitOptions) -xml $(XunitResultsFileName)</XunitOptions>
<XunitOptions Condition="'$(OSGroup)'=='Windows_NT'">$(XunitOptions) -notrait category=nonwindowstests</XunitOptions>
<XunitOptions Condition="'$(OSGroup)'=='Linux'">$(XunitOptions) -notrait category=nonlinuxtests</XunitOptions>
<XunitOptions Condition="'$(OSGroup)'=='OSX'">$(XunitOptions) -notrait category=nonosxtests</XunitOptions>
<XunitOptions Condition="'$(OSGroup)'=='FreeBSD'">$(XunitOptions) -notrait category=nonfreebsdtests</XunitOptions>
<XunitOptions Condition="'$(OSGroup)'=='NetBSD'">$(XunitOptions) -notrait category=nonnetbsdtests</XunitOptions>

<XunitOptions Condition="'$(Performance)'!='true'">$(XunitOptions) -notrait Benchmark=true</XunitOptions>

<XunitOptions Condition="'$(XunitMaxThreads)'!=''">$(XunitOptions) -maxthreads $(XunitMaxThreads)</XunitOptions>
Expand Down Expand Up @@ -113,6 +109,14 @@
Outputs="$(TestsSuccessfulSemaphore);$(TestPath)%(TestTargetFramework.Folder)/$(XunitResultsFileName);$(CoverageOutputFilePath)"
Condition="'$(TestDisabled)'!='true'">

<ItemGroup>
<RunWithoutTraits Condition="'$(TargetOS)'=='Windows_NT'" Include="nonwindowstests" />
<RunWithoutTraits Condition="'$(TargetOS)'=='Linux'" Include="nonlinuxtests" />
<RunWithoutTraits Condition="'$(TargetOS)'=='OSX'" Include="nonosxtests"/>
<RunWithoutTraits Condition="'$(TargetOS)'=='FreeBSD'" Include="nonfreebsdtests"/>
<RunWithoutTraits Condition="'$(TargetOS)'=='NetBSD'" Include="nonnetbsdtests"/>
</ItemGroup>

<PropertyGroup>
<XunitTraitOptions Condition="'@(RunWithTraits)'!=''">$(XunitTraitOptions) -trait category=@(RunWithTraits, ' -trait category=') </XunitTraitOptions>
<XunitTraitOptions Condition="'@(RunWithoutTraits)'!=''">$(XunitTraitOptions) -notrait category=@(RunWithoutTraits, ' -notrait category=') </XunitTraitOptions>
Expand Down Expand Up @@ -169,10 +173,13 @@
<Target Name="CheckTestPlatforms"
AfterTargets="Test"
Condition="'$(TestDisabled)'!='true'">
<GetTargetOS>
<Output TaskParameter="TargetOS" PropertyName="TargetOS" />
</GetTargetOS>
<PropertyGroup>
<TestDisabled Condition="'%(UnsupportedPlatformsItems.Identity)' == '$(OSGroup)'">true</TestDisabled>
<TestDisabled Condition="'%(UnsupportedPlatformsItems.Identity)' == '$(TargetOS)'">true</TestDisabled>
</PropertyGroup>
<Message Condition="'%(UnsupportedPlatformsItems.Identity)' == '$(OSGroup)'"
Text="Skipping tests in $(AssemblyName) because it is not supported on $(OSGroup)" />
<Message Condition="'%(UnsupportedPlatformsItems.Identity)' == '$(TargetOS)'"
Text="Skipping tests in $(AssemblyName) because it is not supported on $(TargetOS)" />
</Target>
</Project>
5 changes: 3 additions & 2 deletions src/Microsoft.DotNet.Build.Tasks/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Microsoft.Build.Utilities.Core": "0.1.0-preview-00005",
"Microsoft.CSharp": "4.0.1-rc2-23907",
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23907",
"Microsoft.Win32.Registry": {
"Microsoft.Win32.Registry": {
"version": "4.0.0-rc2-23907",
"exclude": "Compile"
},
Expand All @@ -21,7 +21,8 @@
"System.Reflection.Metadata": "1.1.0",
"System.Xml.ReaderWriter": "4.0.11-rc2-23907",
"System.Xml.XDocument": "4.0.11-rc2-23907",
"System.Xml.XPath.XmlDocument": "4.0.0"
"System.Xml.XPath.XmlDocument": "4.0.0",
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0-rc2-23907"
},
"frameworks": {
"dnxcore50": {}
Expand Down