Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
MattAgh committed Sep 25, 2020
1 parent ad8749d commit e42ab12
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Utils/MSharp.Build/BuildTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ public BuildTools(bool installAll = true) : base(installAll) { }

protected override void AddTasks()
{
Add(() => InstallChocolatey());
if (Runtime.IsWindows())
Add(() => InstallChocolatey());
Add(() => InstallDotnetCoreSdk());
Add(() => InstallReplaceInFiles());
Add(() => InstallAcceleratePackageRestore());
Expand Down
2 changes: 1 addition & 1 deletion Utils/MSharp.Build/MSharp.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<FileVersion>1.2.136</FileVersion>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
<PackageVersion>1.1.148</PackageVersion>
<PackageVersion>1.1.149</PackageVersion>
</PropertyGroup>
<ItemGroup>
<Folder Include="CICD\" />
Expand Down
14 changes: 14 additions & 0 deletions Utils/MSharp.Build/Runtime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

namespace MSharp.Build
{
static class Runtime
{
internal static bool IsWindows() => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

internal static string OS => RuntimeInformation.OSDescription;
}
}
18 changes: 17 additions & 1 deletion Utils/MSharp.Build/WindowsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,23 @@ namespace MSharp.Build
{
class WindowsCommand
{
public static FileInfo Yarn, Chocolaty, NodeJs, TypeScript, WebPack, Bower, DotNet;
static FileInfo _Chocolaty;
public static FileInfo Chocolaty
{
get
{
if (!Runtime.IsWindows())
throw new Exception("Choco is only supported on Windows. It is not available for " + Runtime.OS);
return _Chocolaty;
}
set
{
if (!Runtime.IsWindows())
throw new Exception("Choco is only supported on Windows. It is not available for " + Runtime.OS);
_Chocolaty = value;
}
}
public static FileInfo Yarn, NodeJs, TypeScript, WebPack, Bower, DotNet;

public static FileInfo Where => System32("WHERE.exe").ExistsOrThrow();

Expand Down

0 comments on commit e42ab12

Please sign in to comment.