diff --git a/ElectronNET.CLI/Commands/Actions/GetTargetPlatformInformation.cs b/ElectronNET.CLI/Commands/Actions/GetTargetPlatformInformation.cs index a5cf151..f36df3f 100644 --- a/ElectronNET.CLI/Commands/Actions/GetTargetPlatformInformation.cs +++ b/ElectronNET.CLI/Commands/Actions/GetTargetPlatformInformation.cs @@ -9,7 +9,6 @@ namespace ElectronNET.CLI.Commands.Actions { public struct GetTargetPlatformInformationResult { - public string DesiredPlatform { get; set; } public string NetCorePublishRid { get; set; } public string ElectronPackerPlatform { get; set; } @@ -35,31 +34,39 @@ namespace ElectronNET.CLI.Commands.Actions electronPackerPlatform = "linux"; break; default: - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + if (desiredPlatform.StartsWith("custom=")) { - desiredPlatform = "win"; - netCorePublishRid = "win-x64"; - electronPackerPlatform = "win32"; + } - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + else { - desiredPlatform = "osx"; - netCorePublishRid = "osx-x64"; - electronPackerPlatform = "darwin"; - } - if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - desiredPlatform = "linux"; - netCorePublishRid = "linux-x64"; - electronPackerPlatform = "linux"; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + desiredPlatform = "win"; + netCorePublishRid = "win-x64"; + electronPackerPlatform = "win32"; + } + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + desiredPlatform = "osx"; + netCorePublishRid = "osx-x64"; + electronPackerPlatform = "darwin"; + } + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + desiredPlatform = "linux"; + netCorePublishRid = "linux-x64"; + electronPackerPlatform = "linux"; + } } + break; } return new GetTargetPlatformInformationResult() { - DesiredPlatform = desiredPlatform, ElectronPackerPlatform = electronPackerPlatform, NetCorePublishRid = netCorePublishRid }; diff --git a/ElectronNET.CLI/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs index b9866c9..133cd5c 100644 --- a/ElectronNET.CLI/Commands/BuildCommand.cs +++ b/ElectronNET.CLI/Commands/BuildCommand.cs @@ -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 ElectronNET.CLI.Commands.Actions; @@ -27,15 +28,16 @@ namespace ElectronNET.CLI.Commands { Console.WriteLine("Build Electron Application..."); - string desiredPlatform = ""; + var parsedArgs = _args + .Select(s => s.Split(new[] { ':' }, 1)) + .ToDictionary(s => s[0], s => s[1]); - if (_args.Length > 0) - { - desiredPlatform = _args[0]; - } + var desiredPlatform = parsedArgs["/target"]; var platformInfo = GetTargetPlatformInformation.Do(desiredPlatform); + Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid}..."); + string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "obj", "desktop", desiredPlatform); if (Directory.Exists(tempPath) == false) diff --git a/buildAll.cmd b/buildAll.cmd index a1dd47f..a678d3f 100755 --- a/buildAll.cmd +++ b/buildAll.cmd @@ -17,10 +17,10 @@ dotnet build echo "Invoke electronize build in WebApp Demo" echo "-- win (dev-build)" -dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build win +dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target:win echo "-- linux (dev-build)" -dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build linux +dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target:linux :: Be aware, that for non-electronnet-dev environments the correct :: invoke command would be dotnet electronize ...