Skip to content

Commit 49ddca6

Browse files
authored
multitarget all packages (#55)
multitarget all packages to support `netstandard2.0` and `net461` run test also for `net461` disable known test failure on travis osx
1 parent 8764730 commit 49ddca6

File tree

10 files changed

+56
-15
lines changed

10 files changed

+56
-15
lines changed

build.proj

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,36 @@
2424
<Exec Command='dotnet pack src/Dotnet.ProjInfo.Workspace.FCS -c $(Configuration) -o "$(NupkgsDir)" -p:Version=$(Version)' />
2525
</Target>
2626

27-
<Target Name="Test">
27+
<Target Name="TestTool">
2828
<Exec Command='dotnet run -c $(Configuration) -- "$(Version)" --fail-on-focused-tests --summary' WorkingDirectory="$(RepoRootDir)/test/dotnet-proj.Tests" IgnoreStandardErrorWarningFormat="true" Condition=" '$(UnstableTests)' != 'true' " />
29+
</Target>
30+
31+
<ItemGroup>
32+
<TestArgs Include="--fail-on-focused-tests --summary" Condition=" '$(UnstableTests)' != 'true' " />
33+
<TestArgs Include="--known-failure --fail-on-focused-tests --summary" Condition=" '$(UnstableTests)' == 'true' " />
34+
<TestArgs Include="--flaky --fail-on-focused-tests --summary" Condition=" '$(UnstableTests)' == 'true' " />
35+
</ItemGroup>
2936

30-
<Exec Command='dotnet run -c $(Configuration) -- --fail-on-focused-tests --summary' WorkingDirectory="$(RepoRootDir)/test/Dotnet.ProjInfo.Workspace.Tests" IgnoreStandardErrorWarningFormat="true" Condition=" '$(UnstableTests)' != 'true' " />
31-
<Exec Command='dotnet run -c $(Configuration) -- --fail-on-focused-tests --summary' WorkingDirectory="$(RepoRootDir)/test/Dotnet.ProjInfo.Workspace.FCS.Tests" IgnoreStandardErrorWarningFormat="true" Condition=" '$(UnstableTests)' != 'true' " />
37+
<Target Name="TestLibsNetCore">
38+
<Exec Command='dotnet run -p test/Dotnet.ProjInfo.Workspace.Tests -f netcoreapp2.1 -c $(Configuration) -- %(TestArgs.Identity)' IgnoreStandardErrorWarningFormat="true" />
39+
<Exec Command='dotnet run -p test/Dotnet.ProjInfo.Workspace.FCS.Tests -f netcoreapp2.1 -c $(Configuration) -- %(TestArgs.Identity)' IgnoreStandardErrorWarningFormat="true" />
40+
</Target>
3241

33-
<Exec Command='dotnet run -c $(Configuration) -- --known-failure --fail-on-focused-tests --summary' WorkingDirectory="$(RepoRootDir)/test/Dotnet.ProjInfo.Workspace.Tests" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" Condition=" '$(UnstableTests)' == 'true' " />
34-
<Exec Command='dotnet run -c $(Configuration) -- --known-failure --fail-on-focused-tests --summary' WorkingDirectory="$(RepoRootDir)/test/Dotnet.ProjInfo.Workspace.FCS.Tests" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" Condition=" '$(UnstableTests)' == 'true' " />
42+
<Target Name="TestLibsNet">
43+
<PropertyGroup>
44+
<WorkspaceTestsExePath>$([System.IO.Path]::GetFullPath("test/Dotnet.ProjInfo.Workspace.Tests/bin/$(Configuration)/net461/Dotnet.ProjInfo.Workspace.Tests.exe"))</WorkspaceTestsExePath>
45+
<WorkspaceFCSTestsExePath>$([System.IO.Path]::GetFullPath("test/Dotnet.ProjInfo.Workspace.FCS.Tests/bin/$(Configuration)/net461/Dotnet.ProjInfo.Workspace.FCS.Tests.exe"))</WorkspaceFCSTestsExePath>
46+
</PropertyGroup>
3547

36-
<Exec Command='dotnet run -c $(Configuration) -- --flaky --fail-on-focused-tests --summary' WorkingDirectory="$(RepoRootDir)/test/Dotnet.ProjInfo.Workspace.Tests" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" Condition=" '$(UnstableTests)' == 'true' " />
37-
<Exec Command='dotnet run -c $(Configuration) -- --flaky --fail-on-focused-tests --summary' WorkingDirectory="$(RepoRootDir)/test/Dotnet.ProjInfo.Workspace.FCS.Tests" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" Condition=" '$(UnstableTests)' == 'true' " />
48+
<Exec Command='dotnet build test/Dotnet.ProjInfo.Workspace.Tests -f net461 -c $(Configuration) -p:Version=$(Version)' />
49+
<Exec Command='$(MonoOrEmpty) "$(WorkspaceTestsExePath)" %(TestArgs.Identity)' IgnoreStandardErrorWarningFormat="true" />
50+
51+
<Exec Command='dotnet build test/Dotnet.ProjInfo.Workspace.FCS.Tests -f net461 -c $(Configuration) -p:Version=$(Version)' />
52+
<Exec Command='$(MonoOrEmpty) "$(WorkspaceFCSTestsExePath)" %(TestArgs.Identity)' IgnoreStandardErrorWarningFormat="true" />
3853
</Target>
3954

55+
<Target Name="Test" DependsOnTargets="TestTool;TestLibsNet;TestLibsNetCore" />
56+
4057
<Target Name="VSTest" DependsOnTargets="Test" />
4158

4259
</Project>

src/Dotnet.ProjInfo.Helpers/Dotnet.ProjInfo.Helpers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
55
</PropertyGroup>
66
<ItemGroup>
77
<Compile Include="..\..\paket-files\mono\mono\mcs\class\Microsoft.Build.Utilities\Microsoft.Build.Utilities\CommandLineBuilder.cs" />

src/Dotnet.ProjInfo.Workspace.FCS/Dotnet.ProjInfo.Workspace.FCS.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
55
</PropertyGroup>
66
<ItemGroup>
77
<Compile Include="Library.fs" />

src/Dotnet.ProjInfo.Workspace/Common.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,9 @@ module Utils =
5757
exitCode, (workingDir, exePath, args)
5858

5959
let isWindows () =
60+
#if NET461
61+
System.Environment.OSVersion.Platform = System.PlatformID.Win32NT
62+
#else
6063
System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(
6164
System.Runtime.InteropServices.OSPlatform.Windows)
65+
#endif

src/Dotnet.ProjInfo.Workspace/Dotnet.ProjInfo.Workspace.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
55
</PropertyGroup>
66
<ItemGroup>
77
<ProjectReference Include="..\Dotnet.ProjInfo\Dotnet.ProjInfo.fsproj" />

test/Dotnet.ProjInfo.Workspace.FCS.Tests/Dotnet.ProjInfo.Workspace.FCS.Tests.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
66
</PropertyGroup>
77
<ItemGroup>
88
<Compile Include="..\dotnet-proj.Tests\FileUtils.fs" />

test/Dotnet.ProjInfo.Workspace.FCS.Tests/Tests.fs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ let tests (suiteConfig: TestSuiteConfig) =
179179
outDir
180180

181181
let asLines (s: string) =
182-
s.Split(Environment.NewLine) |> List.ofArray
182+
s.Split([| Environment.NewLine |], StringSplitOptions.None) |> List.ofArray
183183

184184
let stdOutLines (cmd: Command) =
185185
cmd.Result.StandardOutput
@@ -407,6 +407,14 @@ let tests (suiteConfig: TestSuiteConfig) =
407407

408408
expectP2PKeyIsTargetPath fcsPo
409409

410+
if (isOSX () && suiteConfig.SkipKnownFailure) then
411+
let errorOnOsx =
412+
"""
413+
no errors but was: System.Exception: Build was not evaluated, expected the results to be ready after 'Eval' (GetCheckResultsAndImplementationsForProject, data = ("FinalizeTypeCheck", [|Id 1014; Id 1015; Id 1016; Id 1017; Id 1018|], Id 1020,
414+
""".Trim()
415+
Tests.skiptest (sprintf "Known failure on OSX travis. error is %s" errorOnOsx)
416+
//TODO check failure on osx
417+
410418
let result =
411419
fcs.ParseAndCheckProject(fcsPo)
412420
|> Async.RunSynchronously

test/Dotnet.ProjInfo.Workspace.Tests/Dotnet.ProjInfo.Workspace.Tests.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
66
</PropertyGroup>
77
<ItemGroup>
88
<Compile Include="..\dotnet-proj.Tests\FileUtils.fs" />

test/Dotnet.ProjInfo.Workspace.Tests/Tests.fs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,13 @@ let findByPath path parsed =
145145
| None -> failwithf "key '%s' not found in %A" path (parsed |> Array.map (fun kv -> kv.Key))
146146

147147
let isOSX () =
148+
#if NET461
149+
System.Environment.OSVersion.Platform = PlatformID.MacOSX
150+
|| File.Exists "/usr/bin/osascript" // osascript is the AppleScript interpreter on OS X
151+
#else
148152
System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(
149153
System.Runtime.InteropServices.OSPlatform.OSX)
154+
#endif
150155

151156
open TestsConfig
152157

@@ -189,7 +194,7 @@ let tests (suiteConfig: TestSuiteConfig) =
189194
outDir
190195

191196
let asLines (s: string) =
192-
s.Split(Environment.NewLine) |> List.ofArray
197+
s.Split([| Environment.NewLine |], StringSplitOptions.None) |> List.ofArray
193198

194199
let stdOutLines (cmd: Command) =
195200
cmd.Result.StandardOutput

test/dotnet-proj.Tests/FileUtils.fs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,15 @@ let shellExecRun (logger: Logger) workDir cmd (args: string list) =
7676
>> setField "error" cmd.Result.StandardError)
7777
cmd
7878

79+
let isWindows () =
80+
#if NET461
81+
System.Environment.OSVersion.Platform = System.PlatformID.Win32NT
82+
#else
83+
RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
84+
#endif
85+
7986
let shellExecRunNET (logger: Logger) workDir cmd (args: string list) =
80-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) then
87+
if (isWindows ()) then
8188
shellExecRun logger workDir cmd args
8289
else
8390
shellExecRun logger workDir "mono" (cmd :: args)

0 commit comments

Comments
 (0)