Skip to content

Commit

Permalink
* New optional build parameters added
Browse files Browse the repository at this point in the history
* New electronize add command support added
* Some rid removed and added based on new .NET Core RID catalog. See dotnet/docs#8710 and https://github.com/dotnet/docs/blob/master/docs/core/rid-catalog.md
* cake depedency market as private asset and updated to 0.34.1.
* cake.build script improvments
* unit test packages update.
* Since Electron.NET releases its first stable version https://github.com/ElectronNET/Electron.NET/releases/tag/5.22.14 this the first stable version of Cake.Electron.Net
  • Loading branch information
Blind-Striker committed Sep 7, 2019
1 parent 1dd5b21 commit 6d5c5e7
Show file tree
Hide file tree
Showing 16 changed files with 730 additions and 204 deletions.
21 changes: 21 additions & 0 deletions Cake.Electron.Net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,27 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.Electron.Net", "src\Ca
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.Electron.Net.Tests", "tests\Cake.Electron.Net.Tests\Cake.Electron.Net.Tests.csproj", "{432632D4-BCA3-4925-AC59-1A84930DAB22}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{BC2844A9-6CAA-420C-B49C-54E8B8E39DB0}"
ProjectSection(SolutionItems) = preProject
.travis.yml = .travis.yml
appveyor.yml = appveyor.yml
build\azure-pipelines.artifact.yml = build\azure-pipelines.artifact.yml
build\azure-pipelines.macos.yml = build\azure-pipelines.macos.yml
build\azure-pipelines.ubuntu.yml = build\azure-pipelines.ubuntu.yml
build\azure-pipelines.windows.yml = build\azure-pipelines.windows.yml
build.cake = build.cake
build.ps1 = build.ps1
build.sh = build.sh
cake.config = cake.config
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3C7D4326-B0CC-4FAD-8AE0-5027B7324E0C}"
ProjectSection(SolutionItems) = preProject
CONTRIBUTING.md = CONTRIBUTING.md
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Electron.Net/Cake.Electron.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<AssemblySearchPaths Condition="'$(BaseFrameworkPathOverrideForMono)' != ''">$(FrameworkPathOverride)/Facades;$(AssemblySearchPaths)</AssemblySearchPaths>
</PropertyGroup>

<Target Name="PostBuild" AfterTargets="PreBuildEvent">
<Target Name="PreBuild" AfterTargets="PreBuildEvent">
<ItemGroup>
<LicenseFile Include="../../LICENSE" />
</ItemGroup>
Expand Down
42 changes: 42 additions & 0 deletions src/Cake.Electron.Net/Commands/ElectronNetAdder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using Cake.Core;
using Cake.Core.Annotations;
using Cake.Electron.Net.Commands.Settings;
using Cake.Electron.Net.Utils;

namespace Cake.Electron.Net.Commands
{
public static class ElectronNetAdder
{
private const string CmdBase = "electronize add";

[CakeMethodAlias]
public static int ElectronNetAdd(this ICakeContext context, ElectronNetAddSettings settings)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}

return ElectronNetAdd(context, settings.WorkingDirectory, settings.Add.Value);
}

[CakeMethodAlias]
public static int ElectronNetAdd(this ICakeContext context, string workingDirectory, string add)
{
if (workingDirectory == null)
{
throw new ArgumentNullException(nameof(workingDirectory));
}

if (string.IsNullOrEmpty(add))
{
throw new ArgumentNullException(nameof(add));
}

string cmd = $"{CmdBase} {add}";

return ElectronCakeContext.Current.ProcessHelper.CmdExecute(cmd, workingDirectory);
}
}
}
127 changes: 116 additions & 11 deletions src/Cake.Electron.Net/Commands/ElectronNetBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,48 @@ public static int ElectronNetBuild(this ICakeContext context, ElectronNetBuildSe
settings.WorkingDirectory,
settings.ElectronTarget,
settings.DotNetConfig,
settings.RelativePath,
settings.AbsolutePath,
settings.PackageJson,
settings.InstallModules,
settings.ElectronParams);
}

[CakeMethodAlias]
public static int ElectronNetBuild(this ICakeContext context, string workingDirectory, ElectronTarget electronTarget, DotNetConfig? dotNetConfig = null, params string[] electronParams)
public static int ElectronNetBuild(
this ICakeContext context,
string workingDirectory,
ElectronTarget electronTarget,
DotNetConfig? dotNetConfig = null,
string relativePath = null,
string absolutePath = null,
string packageJson = null,
bool installModules = false,
params string[] electronParams)
{
return ElectronNetBuild(context, workingDirectory, electronTarget?.Value, dotNetConfig?.ToString(), electronParams);
return ElectronNetBuild(
context,
workingDirectory,
electronTarget?.Value,
dotNetConfig?.ToString(),
relativePath,
absolutePath,
packageJson,
installModules,
electronParams);
}

[CakeMethodAlias]
public static int ElectronNetBuild(this ICakeContext context, string workingDirectory, string electronTarget, string dotNetConfig = null, params string[] electronParams)
public static int ElectronNetBuild(
this ICakeContext context,
string workingDirectory,
string electronTarget,
string dotNetConfig = null,
string relativePath = null,
string absolutePath = null,
string packageJson = null,
bool installModules = false,
params string[] electronParams)
{
if (workingDirectory == null)
{
Expand All @@ -46,22 +77,42 @@ public static int ElectronNetBuild(this ICakeContext context, string workingDire
}


StringBuilder cmdBuilder = new StringBuilder();
var cmdBuilder = new StringBuilder();
cmdBuilder.Append($"{CmdBase} /target {electronTarget}");

if (dotNetConfig != null)
{
cmdBuilder.Append($" /dotnet-configuration {dotNetConfig}");
}

if (relativePath != null)
{
cmdBuilder.Append($" /relative-path {relativePath}");
}

if (absolutePath != null)
{
cmdBuilder.Append($" /absolute-path {absolutePath}");
}

if (packageJson != null)
{
cmdBuilder.Append($" /package-json {packageJson}");
}

if (installModules)
{
cmdBuilder.Append(" /install-modules");
}

if (electronParams == null || electronParams.Length <= 0)
{
return ElectronCakeContext.Current.ProcessHelper.CmdExecute(cmdBuilder.ToString(), workingDirectory);
}

var switchs = ElectronCakeContext.Current.CommandBuilder.SwitchHelper(electronParams);
string switches = ElectronCakeContext.Current.CommandBuilder.SwitchHelper(electronParams);

cmdBuilder.Append($" /electron-params \"{switchs}\"");
cmdBuilder.Append($" /electron-params \"{switches}\"");

return ElectronCakeContext.Current.ProcessHelper.CmdExecute(cmdBuilder.ToString(), workingDirectory);
}
Expand All @@ -79,17 +130,51 @@ public static int ElectronNetBuildCustom(this ICakeContext context, ElectronNetC
settings.ElectronTargetCustom,
settings.ElectronArch,
settings.DotNetConfig,
settings.RelativePath,
settings.AbsolutePath,
settings.PackageJson,
settings.InstallModules,
settings.ElectronParams);
}

[CakeMethodAlias]
public static int ElectronNetBuildCustom(this ICakeContext context, string workingDirectory, ElectronTargetCustom electronTarget, string electronArch = null, DotNetConfig? dotNetConfig = null, params string[] electronParams)
public static int ElectronNetBuildCustom(
this ICakeContext context,
string workingDirectory,
ElectronTargetCustom electronTarget,
string electronArch = null,
DotNetConfig? dotNetConfig = null,
string relativePath = null,
string absolutePath = null,
string packageJson = null,
bool installModules = false,
params string[] electronParams)
{
return ElectronNetBuildCustom(context, workingDirectory, electronTarget?.Value, electronArch, dotNetConfig?.ToString(), electronParams);
return ElectronNetBuildCustom(
context,
workingDirectory,
electronTarget?.Value,
electronArch,
dotNetConfig?.ToString(),
relativePath,
absolutePath,
packageJson,
installModules,
electronParams);
}

[CakeMethodAlias]
public static int ElectronNetBuildCustom(this ICakeContext context, string workingDirectory, string electronTarget, string electronArch = null, string dotNetConfig = null, params string[] electronParams)
public static int ElectronNetBuildCustom(
this ICakeContext context,
string workingDirectory,
string electronTarget,
string electronArch = null,
string dotNetConfig = null,
string relativePath = null,
string absolutePath = null,
string packageJson = null,
bool installModules = false,
params string[] electronParams)
{
if (workingDirectory == null)
{
Expand All @@ -114,14 +199,34 @@ public static int ElectronNetBuildCustom(this ICakeContext context, string worki
cmdBuilder.Append($" /electron-arch {electronArch}");
}

if (relativePath != null)
{
cmdBuilder.Append($" /relative-path {relativePath}");
}

if (absolutePath != null)
{
cmdBuilder.Append($" /absolute-path {absolutePath}");
}

if (packageJson != null)
{
cmdBuilder.Append($" /package-json {packageJson}");
}

if (installModules)
{
cmdBuilder.Append(" /install-modules");
}

if (electronParams == null || electronParams.Length <= 0)
{
return ElectronCakeContext.Current.ProcessHelper.CmdExecute(cmdBuilder.ToString(), workingDirectory);
}

var switchs = ElectronCakeContext.Current.CommandBuilder.SwitchHelper(electronParams);
string switches = ElectronCakeContext.Current.CommandBuilder.SwitchHelper(electronParams);

cmdBuilder.Append($" /electron-params \"{switchs}\"");
cmdBuilder.Append($" /electron-params \"{switches}\"");

return ElectronCakeContext.Current.ProcessHelper.CmdExecute(cmdBuilder.ToString(), workingDirectory);
}
Expand Down
14 changes: 14 additions & 0 deletions src/Cake.Electron.Net/Commands/Settings/ElectronNetAddSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
using Cake.Electron.Net.Contracts;

namespace Cake.Electron.Net.Commands.Settings
{
public class ElectronNetAddSettings : ICommandSettings
{
public ElectronAdd Add { get; set; }

public string WorkingDirectory { get; set; }
}
}
34 changes: 22 additions & 12 deletions src/Cake.Electron.Net/Commands/Settings/ElectronNetBuildSettings.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
namespace Cake.Electron.Net.Commands.Settings
{
public class ElectronNetBuildSettings
{
public ElectronTarget ElectronTarget { get; set; } = ElectronTarget.Win;

public DotNetConfig DotNetConfig { get; set; } = DotNetConfig.Release;

public string[] ElectronParams { get; set; }

public string WorkingDirectory { get; set; }
}
using Cake.Electron.Net.Contracts;

namespace Cake.Electron.Net.Commands.Settings
{
public class ElectronNetBuildSettings : IBuildCommandSettings
{
public ElectronTarget ElectronTarget { get; set; } = ElectronTarget.Win;

public DotNetConfig DotNetConfig { get; set; } = DotNetConfig.Release;

public string RelativePath { get; set; }

public string AbsolutePath { get; set; }

public string PackageJson { get; set; }

public bool InstallModules { get; set; } = false;

public string[] ElectronParams { get; set; }

public string WorkingDirectory { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
namespace Cake.Electron.Net.Commands.Settings
{
public class ElectronNetCustomBuildSettings
{
public ElectronTargetCustom ElectronTargetCustom { get; set; } = ElectronTargetCustom.Win10WinSrv2016X64;

public string ElectronArch { get; set; }

public DotNetConfig DotNetConfig { get; set; } = DotNetConfig.Release;

public string[] ElectronParams { get; set; }

public string WorkingDirectory { get; set; }
}
using Cake.Electron.Net.Contracts;

namespace Cake.Electron.Net.Commands.Settings
{
public class ElectronNetCustomBuildSettings : IBuildCommandSettings
{
public ElectronTargetCustom ElectronTargetCustom { get; set; } = ElectronTargetCustom.Win10WinSrv2016X64;

public string ElectronArch { get; set; }

public DotNetConfig DotNetConfig { get; set; } = DotNetConfig.Release;

public string RelativePath { get; set; }

public string AbsolutePath { get; set; }

public string PackageJson { get; set; }

public bool InstallModules { get; set; } = false;

public string[] ElectronParams { get; set; }

public string WorkingDirectory { get; set; }
}
}
18 changes: 10 additions & 8 deletions src/Cake.Electron.Net/Commands/Settings/ElectronNetInitSettings.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
namespace Cake.Electron.Net.Commands.Settings
{
public class ElectronNetInitSettings
{
public string WorkingDirectory { get; set; }

public string Path { get; set; }
}
using Cake.Electron.Net.Contracts;

namespace Cake.Electron.Net.Commands.Settings
{
public class ElectronNetInitSettings : ICommandSettings
{
public string WorkingDirectory { get; set; }

public string Path { get; set; }
}
}

0 comments on commit 6d5c5e7

Please sign in to comment.