This commit is contained in:
Robert Muehsig
2018-01-24 22:39:46 +01:00
parent 27e57f7fa1
commit e1fa8990ef
3 changed files with 32 additions and 23 deletions

View File

@@ -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
};

View File

@@ -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)

View File

@@ -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 ...