mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-12 11:47:52 +00:00
wip
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 ...
|
||||
|
||||
Reference in New Issue
Block a user