Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update skips logic #335

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
20 changes: 13 additions & 7 deletions UnoCheck/CheckCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public override async Task<int> ExecuteAsync(CommandContext context, CheckSettin

AnsiConsole.MarkupLine(" ok");
AnsiConsole.Markup($"[bold blue]{Icon.Thinking} Scheduling appointments...[/]");

Util.UpdateSkips(settings, Util.BaseSkips);

if (!string.IsNullOrEmpty(settings.DotNetSdkRoot))
{
sharedState.SetEnvironmentVariable("DOTNET_ROOT", settings.DotNetSdkRoot);
Expand All @@ -106,21 +107,18 @@ public override async Task<int> ExecuteAsync(CommandContext context, CheckSettin
settings.TargetPlatforms = ParseTfmsToTargetPlatforms(settings);
if (!string.IsNullOrEmpty(settings.Ide))
{
var currentSkips = settings.Skip?.ToList() ?? [];

switch (settings.Ide.ToLowerInvariant())
{
case "rider":
currentSkips.AddRange(Util.RiderSkips);
Util.UpdateSkips(settings, Util.RiderSkips);
break;
case "vs":
currentSkips.AddRange(Util.VSSkips);
Util.UpdateSkips(settings, Util.VSSkips);
break;
case "vscode":
currentSkips.AddRange(Util.VSCodeSkips);
Util.UpdateSkips(settings, Util.VSCodeSkips);
break;
}
settings.Skip = currentSkips.Distinct().ToArray();
}

sharedState.ContributeState(StateKey.EntryPoint, StateKey.TargetPlatforms, TargetPlatformHelper.GetTargetPlatformsFromFlags(settings.TargetPlatforms));
Expand Down Expand Up @@ -348,6 +346,14 @@ internal static string[] ParseTfmsToTargetPlatforms(CheckSettings settings)
{
var parsedTfm = NuGetFramework.ParseFolder(tfm);

// For all TFM's besides net8.0 we skip these checks.
// https://github.com/unoplatform/private/issues/506
if (parsedTfm.Version.Major == 8)
{
var skips = settings.Skip?.ToList() ?? [];
settings.Skip = skips.Except(["git", "linuxninja", "psexecpolicy", "windowspyhtonInstallation"]).Distinct().ToArray();
}

if (parsedTfm.Version.Major >= 5 && parsedTfm.HasPlatform == false)
{
// Returning empty list which means that we will target all platforms.
Expand Down
13 changes: 11 additions & 2 deletions UnoCheck/Util.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Spectre.Console;
Expand All @@ -9,9 +10,17 @@ namespace DotNetCheck
{
public class Util
{
public static string[] RiderSkips = ["vswin","vswinworkloads", "dotnetnewunotemplates"];
public static string[] BaseSkips = ["git", "linuxninja", "psexecpolicy", "windowspyhtonInstallation"];
public static string[] RiderSkips = ["vswin","vswinworkloads"];
public static string[] VSCodeSkips = ["vswin","vswinworkloads"];
public static string[] VSSkips = ["dotnetnewunotemplates"];
public static string[] VSSkips = ["vswin","vswinworkloads"];

public static void UpdateSkips(CheckSettings settings, string[] skips)
{
var currentSkips = settings.Skip?.ToList() ?? [];
currentSkips.AddRange(skips);
settings.Skip = currentSkips.Distinct().ToArray();
}
public static void LogAlways(string message)
{
Console.WriteLine(message);
Expand Down
Loading