Skip to content

Commit e1fa899

Browse files
committed
wip
1 parent 27e57f7 commit e1fa899

File tree

3 files changed

+32
-23
lines changed

3 files changed

+32
-23
lines changed

ElectronNET.CLI/Commands/Actions/GetTargetPlatformInformation.cs

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ public static class GetTargetPlatformInformation
99
{
1010
public struct GetTargetPlatformInformationResult
1111
{
12-
public string DesiredPlatform { get; set; }
1312
public string NetCorePublishRid { get; set; }
1413
public string ElectronPackerPlatform { get; set; }
1514

@@ -35,31 +34,39 @@ public static GetTargetPlatformInformationResult Do(string desiredPlatform)
3534
electronPackerPlatform = "linux";
3635
break;
3736
default:
38-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
37+
if (desiredPlatform.StartsWith("custom="))
3938
{
40-
desiredPlatform = "win";
41-
netCorePublishRid = "win-x64";
42-
electronPackerPlatform = "win32";
43-
}
44-
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
45-
{
46-
desiredPlatform = "osx";
47-
netCorePublishRid = "osx-x64";
48-
electronPackerPlatform = "darwin";
39+
4940
}
50-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
41+
else
5142
{
52-
desiredPlatform = "linux";
53-
netCorePublishRid = "linux-x64";
54-
electronPackerPlatform = "linux";
43+
44+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
45+
{
46+
desiredPlatform = "win";
47+
netCorePublishRid = "win-x64";
48+
electronPackerPlatform = "win32";
49+
}
50+
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
51+
{
52+
desiredPlatform = "osx";
53+
netCorePublishRid = "osx-x64";
54+
electronPackerPlatform = "darwin";
55+
}
56+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
57+
{
58+
desiredPlatform = "linux";
59+
netCorePublishRid = "linux-x64";
60+
electronPackerPlatform = "linux";
61+
}
5562
}
5663

64+
5765
break;
5866
}
5967

6068
return new GetTargetPlatformInformationResult()
6169
{
62-
DesiredPlatform = desiredPlatform,
6370
ElectronPackerPlatform = electronPackerPlatform,
6471
NetCorePublishRid = netCorePublishRid
6572
};

ElectronNET.CLI/Commands/BuildCommand.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Linq;
45
using System.Runtime.InteropServices;
56
using System.Threading.Tasks;
67
using ElectronNET.CLI.Commands.Actions;
@@ -27,15 +28,16 @@ public Task<bool> ExecuteAsync()
2728
{
2829
Console.WriteLine("Build Electron Application...");
2930

30-
string desiredPlatform = "";
31+
var parsedArgs = _args
32+
.Select(s => s.Split(new[] { ':' }, 1))
33+
.ToDictionary(s => s[0], s => s[1]);
3134

32-
if (_args.Length > 0)
33-
{
34-
desiredPlatform = _args[0];
35-
}
35+
var desiredPlatform = parsedArgs["/target"];
3636

3737
var platformInfo = GetTargetPlatformInformation.Do(desiredPlatform);
3838

39+
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid}...");
40+
3941

4042
string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "obj", "desktop", desiredPlatform);
4143
if (Directory.Exists(tempPath) == false)

buildAll.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ dotnet build
1717
echo "Invoke electronize build in WebApp Demo"
1818

1919
echo "-- win (dev-build)"
20-
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build win
20+
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target:win
2121

2222
echo "-- linux (dev-build)"
23-
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build linux
23+
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target:linux
2424

2525
:: Be aware, that for non-electronnet-dev environments the correct
2626
:: invoke command would be dotnet electronize ...

0 commit comments

Comments
 (0)