mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
Compare commits
25 Commits
0.3.0-pre.
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
456135a562 | ||
|
|
300f52510c | ||
|
|
7e6760a428 | ||
|
|
29fdbb5315 | ||
|
|
36bba6a49f | ||
|
|
44a010e0ed | ||
|
|
25770db138 | ||
|
|
1c99ab02cc | ||
|
|
73c56e2450 | ||
|
|
30037fce69 | ||
|
|
69048d5565 | ||
|
|
d9c8e04b5c | ||
|
|
368ef412bb | ||
|
|
cb20fbad25 | ||
|
|
89cdf2f55b | ||
|
|
1c62c1f132 | ||
|
|
d3e3188681 | ||
|
|
4f95043309 | ||
|
|
13f1203ccc | ||
|
|
9d0378798b | ||
|
|
1d6ef7a250 | ||
|
|
2d6d4e2320 | ||
|
|
df8e269d5c | ||
|
|
bdfbcd5b77 | ||
|
|
19e785f53f |
13
.github/workflows/retry-test-jobs.yml
vendored
13
.github/workflows/retry-test-jobs.yml
vendored
@@ -27,24 +27,23 @@ jobs:
|
||||
run: |
|
||||
echo "Inspecting jobs of workflow run $RUN_ID in $REPO"
|
||||
|
||||
jobs_json="$(gh api repos/$REPO/actions/runs/$RUN_ID/jobs)"
|
||||
jobs_json="$(gh api -R $REPO repos/$REPO/actions/runs/$RUN_ID/jobs)"
|
||||
|
||||
echo "Jobs and conclusions:"
|
||||
echo "$jobs_json" | jq '.jobs[] | {name: .name, conclusion: .conclusion}'
|
||||
|
||||
failed_matrix_jobs=$(echo "$jobs_json" | jq '
|
||||
failed_matrix_jobs=$(echo "$jobs_json" | jq -r '
|
||||
[ .jobs[]
|
||||
| select(.conclusion == "failure"
|
||||
and (.name | contains(" API-")))
|
||||
]
|
||||
| length
|
||||
| length // 0
|
||||
')
|
||||
failed_matrix_jobs=${failed_matrix_jobs:-0}
|
||||
|
||||
echo "Failed Integration Tests matrix jobs: $failed_matrix_jobs"
|
||||
|
||||
if [ "$failed_matrix_jobs" -gt 0 ]; then
|
||||
if [ "${failed_matrix_jobs}" -gt 0 ]; then
|
||||
echo "Detected failing Integration Tests jobs – re-running failed jobs for this run."
|
||||
gh run rerun "$RUN_ID" --failed
|
||||
gh run rerun -R "$REPO" "$RUN_ID" --failed
|
||||
else
|
||||
echo "Only non-matrix jobs (like Test Results) failed – not auto-rerunning."
|
||||
fi
|
||||
|
||||
15
Changelog.md
15
Changelog.md
@@ -1,3 +1,17 @@
|
||||
# 0.4.0
|
||||
|
||||
## ElectronNET.Core
|
||||
|
||||
- Fixed ElectronSingleInstance handling (#996) @softworkz
|
||||
- Fixed `PackageId` handling (#993) @softworkz
|
||||
- Added cross-platform npm restore and check mismatch on publish (#988) @softworkz
|
||||
|
||||
# 0.3.1
|
||||
|
||||
## ElectronNET.Core
|
||||
|
||||
- Fixed issue transforming the project ID (#989, #990) @softworkz
|
||||
|
||||
# 0.3.0
|
||||
|
||||
## ElectronNET.Core
|
||||
@@ -6,6 +20,7 @@
|
||||
- Updated all model classes to Electron API 39.2 (#949) @softworkz
|
||||
- Fixed output path for `electron-builder` (#942) @softworkz
|
||||
- Fixed floating point display resolution (#944) @softworkz
|
||||
- Fixed error in case of missing electron-host-hook (#978)
|
||||
- Fixed previous API break using exposed `JsonElement` objects (#938) @softworkz
|
||||
- Fixed and improved several test cases (#962) @softworkz
|
||||
- Fixed startup of Electron.NET from VS Code Debug Adapter (#952)
|
||||
|
||||
@@ -41,7 +41,7 @@ A `package.json` file **is allowed** in the `ElectronHostHook` folder if you're
|
||||
|
||||
```xml
|
||||
<PropertyGroup Label="ElectronNetCommon">
|
||||
<PackageId>my-electron-app</PackageId>
|
||||
<ElectronPackageId>my-electron-app</ElectronPackageId>
|
||||
<Title>My Electron App</Title>
|
||||
<Version>1.0.0</Version>
|
||||
<Description>My awesome Electron.NET application</Description>
|
||||
|
||||
@@ -31,7 +31,7 @@ dotnet add package ElectronNET.Core.AspNet # For ASP.NET projects
|
||||
### Step 2: Configure Project Settings
|
||||
|
||||
**Auto-generated Configuration:**
|
||||
ElectronNET.Core automatically creates `electron-builder.json` during the first build or NuGet restore. No manual configuration is needed for basic setups.
|
||||
ElectronNET.Core automatically creates `electron-builder.json` in the `Properties` folder of your project during the first build or NuGet restore. No manual configuration is needed for basic setups.
|
||||
|
||||
**Migrate Existing Configuration:**
|
||||
If you have an existing `electron.manifest.json` file:
|
||||
@@ -63,6 +63,9 @@ You can also manually edit `electron-builder.json`:
|
||||
}
|
||||
```
|
||||
|
||||
**Modify Launch Settings:**
|
||||
ElectronNET.Core no longer needs a separate CLI tool (electronize.exe) for launching. You should update your launch settings to use either the ASP.NET-first or Electron-first approach. See [Debugging](../Using/Debugging.md) for details.
|
||||
|
||||
## 🎯 Testing Migration
|
||||
|
||||
After completing the migration steps:
|
||||
|
||||
@@ -54,7 +54,7 @@ Add the Electron.NET configuration to your `.csproj` file:
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.3.0" />
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.4.0" />
|
||||
</ItemGroup>
|
||||
```
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ These are the current default values when you don't make any changes:
|
||||
<ElectronSingleInstance>true</ElectronSingleInstance>
|
||||
<ElectronSplashScreen></ElectronSplashScreen>
|
||||
<ElectronIcon></ElectronIcon>
|
||||
<PackageId>$(MSBuildProjectName.Replace(".", "-").ToLower())</PackageId>
|
||||
<ElectronPackageId>$(MSBuildProjectName.Replace(".", "-").ToLower())</ElectronPackageId>
|
||||
<ElectronBuilderJson>electron-builder.json</ElectronBuilderJson>
|
||||
<Title>$(MSBuildProjectName)</Title>
|
||||
</PropertyGroup>
|
||||
@@ -38,15 +38,15 @@ Since electron builder still expects a `package.json` file to exist, ElectronNET
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "$(PackageId)",
|
||||
"name": "$(ElectronPackageId)",
|
||||
"productName": "$(ElectronTitle)",
|
||||
"build": {
|
||||
"appId": "$(PackageId)",
|
||||
"appId": "$(ElectronPackageId)",
|
||||
"linux": {
|
||||
"desktop": {
|
||||
"entry": { "Name": "$(Title)" }
|
||||
},
|
||||
"executableName": "$(PackageId)"
|
||||
"executableName": "$(ElectronPackageId)"
|
||||
},
|
||||
"deb": {
|
||||
"desktop": {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public string RuntimeIdentifier { get; internal set; }
|
||||
|
||||
public string ElectronSingleInstance { get; internal set; }
|
||||
public bool ElectronSingleInstance { get; internal set; }
|
||||
|
||||
public string Title { get; internal set; }
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
namespace ElectronNET.Runtime.Services.ElectronProcess
|
||||
{
|
||||
using ElectronNET.Common;
|
||||
using ElectronNET.Runtime.Data;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
using ElectronNET.Runtime.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Launches and manages the Electron app process.
|
||||
@@ -33,14 +34,42 @@
|
||||
this.socketPort = socketPort;
|
||||
}
|
||||
|
||||
protected override Task StartCore()
|
||||
protected override async Task StartCore()
|
||||
{
|
||||
var dir = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
|
||||
string startCmd, args, workingDir;
|
||||
|
||||
if (this.isUnpackaged)
|
||||
{
|
||||
this.CheckRuntimeIdentifier();
|
||||
|
||||
var electrondir = Path.Combine(dir.FullName, ".electron");
|
||||
|
||||
ProcessRunner chmodRunner = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
var distFolder = Path.Combine(electrondir, "node_modules", "electron", "dist");
|
||||
|
||||
chmodRunner = new ProcessRunner("ElectronRunner-Chmod");
|
||||
chmodRunner.Run("chmod", "-R +x " + distFolder, electrondir);
|
||||
await chmodRunner.WaitForExitAsync().ConfigureAwait(true);
|
||||
|
||||
if (chmodRunner.LastExitCode != 0)
|
||||
{
|
||||
throw new Exception("Failed to set executable permissions on Electron dist folder.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine("[StartCore]: Exception: " + chmodRunner?.StandardError);
|
||||
Console.Error.WriteLine("[StartCore]: Exception: " + chmodRunner?.StandardOutput);
|
||||
Console.Error.WriteLine("[StartCore]: Exception: " + ex);
|
||||
}
|
||||
|
||||
startCmd = Path.Combine(electrondir, "node_modules", "electron", "dist", "electron");
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
@@ -53,17 +82,71 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = dir.Parent?.Parent;
|
||||
dir = dir.Parent!.Parent!;
|
||||
startCmd = Path.Combine(dir.FullName, this.electronBinaryName);
|
||||
args = $"-dotnetpacked -electronforcedport={this.socketPort:D} " + this.extraArguments;
|
||||
workingDir = dir.FullName;
|
||||
}
|
||||
|
||||
|
||||
// We don't await this in order to let the state transition to "Starting"
|
||||
Task.Run(async () => await this.StartInternal(startCmd, args, workingDir).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
private void CheckRuntimeIdentifier()
|
||||
{
|
||||
var buildInfoRid = ElectronNetRuntime.BuildInfo.RuntimeIdentifier;
|
||||
if (string.IsNullOrEmpty(buildInfoRid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var osPart = buildInfoRid.Split('-').First();
|
||||
|
||||
var mismatch = false;
|
||||
|
||||
switch (osPart)
|
||||
{
|
||||
case "win":
|
||||
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
mismatch = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "linux":
|
||||
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
mismatch = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "osx":
|
||||
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
mismatch = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "freebsd":
|
||||
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD))
|
||||
{
|
||||
mismatch = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (mismatch)
|
||||
{
|
||||
throw new PlatformNotSupportedException($"This Electron.NET application was built for '{buildInfoRid}'. It cannot run on this platform.");
|
||||
}
|
||||
}
|
||||
|
||||
protected override Task StopCore()
|
||||
|
||||
@@ -165,13 +165,9 @@
|
||||
ElectronNetRuntime.DotnetAppType = DotnetAppType.AspNetCoreApp;
|
||||
}
|
||||
|
||||
if (isSingleInstance?.Length > 0 && bool.TryParse(isSingleInstance, out var isSingleInstanceActive) && isSingleInstanceActive)
|
||||
if (bool.TryParse(isSingleInstance, out var parsedBool))
|
||||
{
|
||||
buildInfo.ElectronSingleInstance = "yes";
|
||||
}
|
||||
else
|
||||
{
|
||||
buildInfo.ElectronSingleInstance = "no";
|
||||
buildInfo.ElectronSingleInstance = parsedBool;
|
||||
}
|
||||
|
||||
if (httpPort?.Length > 0 && int.TryParse(httpPort, out var port))
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[] args, Func<Task> onAppReadyCallback)
|
||||
{
|
||||
ElectronNetRuntime.OnAppReadyCallback = onAppReadyCallback;
|
||||
|
||||
|
||||
// no matter how this is set - let's unset to prevent Electron not starting as expected
|
||||
// e.g., VS Code sets this env variable, but this will cause `require("electron")` to not
|
||||
// work as expected, see issue #952
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<ProjectReference Include="..\ElectronNET.API\ElectronNET.API.csproj" Condition="$(ElectronNetDevMode)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.3.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.4.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\ElectronNET\build\ElectronNET.Core.targets" Condition="$(ElectronNetDevMode)" />
|
||||
|
||||
@@ -93,7 +93,7 @@ app.on('will-finish-launching', () => {
|
||||
|
||||
const manifestJsonFile = require(manifestJsonFilePath);
|
||||
|
||||
if (manifestJsonFile.singleInstance === "yes") {
|
||||
if (manifestJsonFile.singleInstance) {
|
||||
const mainInstance = app.requestSingleInstanceLock();
|
||||
app.on('second-instance', (events, args = []) => {
|
||||
args.forEach((parameter) => {
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
<ProjectReference Include="..\ElectronNET.AspNet\ElectronNET.AspNet.csproj" Condition="$(ElectronNetDevMode)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.3.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||
<PackageReference Include="ElectronNET.Core.AspNet" Version="0.3.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.4.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||
<PackageReference Include="ElectronNET.Core.AspNet" Version="0.4.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.9.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<ElectronSplashScreen></ElectronSplashScreen>
|
||||
<ElectronIcon></ElectronIcon>
|
||||
<PackageIcon></PackageIcon>
|
||||
<PackageId>$(MSBuildProjectName.Replace(".", "-").ToLower())</PackageId>
|
||||
<ElectronPackageId>$(MSBuildProjectName.Replace(".", "-").ToLower())</ElectronPackageId>
|
||||
<ElectronBuilderJson>electron-builder.json</ElectronBuilderJson>
|
||||
<Title>$(MSBuildProjectName)</Title>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<PropertyGroup Condition="'$(ElectronExecutable)' == ''">
|
||||
<WinPrefix>win</WinPrefix>
|
||||
<ElectronExecutable Condition="'$(RuntimeIdentifier.StartsWith($(WinPrefix)))' == 'true'">$(Title)</ElectronExecutable>
|
||||
<ElectronExecutable Condition="'$(RuntimeIdentifier.StartsWith($(WinPrefix)))' != 'true'">$(PackageId)</ElectronExecutable>
|
||||
<ElectronExecutable Condition="'$(RuntimeIdentifier.StartsWith($(WinPrefix)))' != 'true'">$(ElectronPackageId)</ElectronExecutable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
@@ -12,6 +12,10 @@
|
||||
<_IsMsAspNetProject Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true'">True</_IsMsAspNetProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageId Condition="'$(PackageId)' == ''">$(ElectronPackageId)</PackageId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AssemblyMetadata Include="ElectronExecutable" Value="$(ElectronExecutable)" />
|
||||
<AssemblyMetadata Include="ElectronVersion" Value="$(ElectronVersion)" />
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<TemplateProperty Include="PackageId" Value="$(PackageId)" />
|
||||
<TemplateProperty Include="ElectronPackageId" Value="$(ElectronPackageId)" />
|
||||
<TemplateProperty Include="Title" Value="$(Title)" />
|
||||
<TemplateProperty Include="ElectronTitle" Value="$(ElectronTitle)" />
|
||||
<TemplateProperty Include="Version" Value="$(Version)" />
|
||||
@@ -135,7 +135,7 @@
|
||||
<TemplateProperty Include="ElectronSplashScreen" Value="$(ElectronSplashScreenFileName)" />
|
||||
<TemplateProperty Include="ElectronVersion" Value="$(ElectronVersion)" />
|
||||
<TemplateProperty Include="TargetName" Value="$(ElectronTargetName)" />
|
||||
<TemplateProperty Include="ElectronSingleInstance" Value="$(ElectronSingleInstance)" />
|
||||
<TemplateProperty Include="ElectronSingleInstance" Value="$(ElectronSingleInstance.ToLower())" />
|
||||
</ItemGroup>
|
||||
|
||||
<MakeDir Directories="$(ElectronIntermediateOutputPath)" />
|
||||
@@ -297,12 +297,58 @@
|
||||
<RemoveDir Directories="$(ElectronHookTargetModuleDir)" Condition="Exists($(ElectronHookTargetModuleDir))" />
|
||||
</Target>
|
||||
|
||||
<Target Name="ElectronCheckVersionMismatch">
|
||||
|
||||
<PropertyGroup>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'win-x64'">x64</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'win-x86'">ia32</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'win-arm64'">arm64</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'linux-x64'">x64</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'linux-arm'">armv7l</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'linux-arm64'">arm64</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'osx-x64'">x64</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'osx-arm64'">arm64</ElectronArch>
|
||||
|
||||
<ElectronPlatform Condition="'$(RuntimeIdentifier)' == 'win-x64' OR '$(RuntimeIdentifier)' == 'win-x86' OR '$(RuntimeIdentifier)' == 'win-arm64'">win</ElectronPlatform>
|
||||
<ElectronPlatform Condition="'$(RuntimeIdentifier)' == 'linux-x64' OR '$(RuntimeIdentifier)' == 'linux-arm' OR '$(RuntimeIdentifier)' == 'linux-arm64'">linux</ElectronPlatform>
|
||||
<ElectronPlatform Condition="'$(RuntimeIdentifier)' == 'osx-x64' OR '$(RuntimeIdentifier)' == 'osx-arm64'">mac</ElectronPlatform>
|
||||
|
||||
<!-- npm uses different OS names than Electron -->
|
||||
<NpmOs Condition="'$(ElectronPlatform)' == 'win'">win32</NpmOs>
|
||||
<NpmOs Condition="'$(ElectronPlatform)' == 'linux'">linux</NpmOs>
|
||||
<NpmOs Condition="'$(ElectronPlatform)' == 'mac'">darwin</NpmOs>
|
||||
|
||||
<!-- npm CPU is same as ElectronArch except for linux-arm -->
|
||||
<NpmCpu>$(ElectronArch)</NpmCpu>
|
||||
<NpmCpu Condition="'$(RuntimeIdentifier)' == 'linux-arm'">arm</NpmCpu>
|
||||
|
||||
<_CurrentOSPlatform Condition="$([MSBuild]::IsOSPlatform('Windows'))">win</_CurrentOSPlatform>
|
||||
<_CurrentOSPlatform Condition="$([MSBuild]::IsOSPlatform('Linux'))">linux</_CurrentOSPlatform>
|
||||
<_CurrentOSPlatform Condition="$([MSBuild]::IsOSPlatform('OSX'))">mac</_CurrentOSPlatform>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Validate that the target platform matches the current OS -->
|
||||
<PropertyGroup>
|
||||
<IsLinuxWsl>false</IsLinuxWsl>
|
||||
<IsLinuxWsl Condition="'$(ElectronPlatform)' == 'linux' AND '$(_CurrentOSPlatform)' == 'win'">true</IsLinuxWsl>
|
||||
|
||||
<_IsCrossCompileAllowed>false</_IsCrossCompileAllowed>
|
||||
<!-- Allow Linux builds on Windows via WSL -->
|
||||
<_IsCrossCompileAllowed Condition="'$(_CurrentOSPlatform)' == 'win' AND '$(ElectronPlatform)' == 'linux' AND '$(IsLinuxWsl)' == 'true'">true</_IsCrossCompileAllowed>
|
||||
|
||||
<_IsPlatformMismatch>false</_IsPlatformMismatch>
|
||||
<_IsPlatformMismatch Condition="'$(_CurrentOSPlatform)' != '$(ElectronPlatform)' AND '$(_IsCrossCompileAllowed)' != 'true'">true</_IsPlatformMismatch>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name="ElectronConfigureApp"
|
||||
Inputs="@(ElectronPackageJsonFiles)"
|
||||
Outputs="@(ElectronPackageJsonFiles->'$(OutDir)%(TargetPath)')"
|
||||
AfterTargets="CopyFilesToOutputDirectory"
|
||||
DependsOnTargets="ElectronResetHostHook"
|
||||
DependsOnTargets="ElectronResetHostHook;ElectronCheckVersionMismatch"
|
||||
>
|
||||
|
||||
<Copy SourceFiles="@(ElectronPackageJsonFiles)" DestinationFiles="@(ElectronPackageJsonFiles->'$(OutDir)%(TargetPath)')" >
|
||||
@@ -316,10 +362,9 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<ElectronOutputPath>$([System.IO.Path]::GetFullPath('$(ElectronOutDir)'))</ElectronOutputPath>
|
||||
<LinuxPrefix>linux</LinuxPrefix>
|
||||
<IsLinuxWsl>false</IsLinuxWsl>
|
||||
<IsLinuxWsl Condition="'$(RuntimeIdentifier.StartsWith($(LinuxPrefix)))' == 'true'AND $([MSBuild]::IsOSPlatform('Windows'))">true</IsLinuxWsl>
|
||||
<_NpmCmd>npm install --no-bin-links</_NpmCmd>
|
||||
<!-- Add cross-platform parameters when there's a platform mismatch (for remote debugging preparation) -->
|
||||
<_NpmCmd Condition="'$(_IsPlatformMismatch)' == 'true'">$(_NpmCmd) --os=$(NpmOs) --cpu=$(NpmCpu) --arch=$(NpmCpu) --platform=$(NpmOs)</_NpmCmd>
|
||||
<_NpmCmd Condition="'$(IsLinuxWsl)' == 'true'">wsl bash -ic '$(_NpmCmd)'</_NpmCmd>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -335,6 +380,23 @@
|
||||
|
||||
<Message Importance="High" Text="Electron setup failed!" Condition="'$(ExecExitCode)' != '0'" />
|
||||
|
||||
<!-- Fix up incorrect symlinks created by npm on Windows when targeting macOS -->
|
||||
<PropertyGroup>
|
||||
<_ElectronFrameworksDir>$(ElectronOutDir)node_modules\electron\dist\Electron.app\Contents\Frameworks</_ElectronFrameworksDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ElectronFrameworkDirs Include="$(_ElectronFrameworksDir)\Electron Framework.framework" />
|
||||
<_ElectronFrameworkDirs Include="$(_ElectronFrameworksDir)\Mantle.framework" />
|
||||
<_ElectronFrameworkDirs Include="$(_ElectronFrameworksDir)\ReactiveObjC.framework" />
|
||||
<_ElectronFrameworkDirs Include="$(_ElectronFrameworksDir)\Squirrel.framework" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Only execute on Windows host when targeting macOS -->
|
||||
<Message Importance="High" Text="Fixing macOS framework Resources symlinks" Condition="'$(ElectronPlatform)' == 'mac' AND '$(_CurrentOSPlatform)' == 'win'" />
|
||||
|
||||
<Exec Command="cmd /c del Resources && mklink /D Resources "Versions\Current\Resources"" WorkingDirectory="%(_ElectronFrameworkDirs.Identity)" Condition="'$(ElectronPlatform)' == 'mac' AND '$(_CurrentOSPlatform)' == 'win'" />
|
||||
|
||||
</Target>
|
||||
|
||||
<Target Name="BeforePublishElectronApp" BeforeTargets="PrepareForPublish">
|
||||
@@ -367,7 +429,7 @@
|
||||
<_ElectronPublishAppAfterTarget Condition="'$(UsingMicrosoftNETSdkWeb)' != 'true'">Publish</_ElectronPublishAppAfterTarget>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="ElectronPublishApp" AfterTargets="$(_ElectronPublishAppAfterTarget)">
|
||||
<Target Name="ElectronPublishApp" AfterTargets="$(_ElectronPublishAppAfterTarget)" DependsOnTargets="ElectronCheckVersionMismatch">
|
||||
|
||||
<PropertyGroup>
|
||||
<PublishDir>$(_OriginalPublishDir)</PublishDir>
|
||||
@@ -376,21 +438,18 @@
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Default values -->
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'win-x64'">x64</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'win-x86'">ia32</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'win-arm64'">arm64</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'linux-x64'">x64</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'linux-arm'">armv7l</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'linux-arm64'">arm64</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'osx-x64'">x64</ElectronArch>
|
||||
<ElectronArch Condition="'$(RuntimeIdentifier)' == 'osx-arm64'">arm64</ElectronArch>
|
||||
<Error Condition="'$(_IsPlatformMismatch)' == 'true'"
|
||||
Code="ELECTRON100"
|
||||
Text="The target RuntimeIdentifier '$(RuntimeIdentifier)' (platform: $(ElectronPlatform)) does not match the current operating system ($(_CurrentOSPlatform)).
|
||||
|
||||
<ElectronPlatform Condition="'$(RuntimeIdentifier)' == 'win-x64' OR '$(RuntimeIdentifier)' == 'win-x86' OR '$(RuntimeIdentifier)' == 'win-arm64'">win</ElectronPlatform>
|
||||
<ElectronPlatform Condition="'$(RuntimeIdentifier)' == 'linux-x64' OR '$(RuntimeIdentifier)' == 'linux-arm' OR '$(RuntimeIdentifier)' == 'linux-arm64'">linux</ElectronPlatform>
|
||||
<ElectronPlatform Condition="'$(RuntimeIdentifier)' == 'osx-x64' OR '$(RuntimeIdentifier)' == 'osx-arm64'">mac</ElectronPlatform>
|
||||
</PropertyGroup>
|
||||
Electron applications must be built on the target operating system:
|
||||
- Windows targets (win-x64, win-x86, win-arm64) must be built on Windows
|
||||
- Linux targets (linux-x64, linux-arm, linux-arm64) must be built on Linux (or Windows with WSL)
|
||||
- macOS targets (osx-x64, osx-arm64) must be built on macOS
|
||||
|
||||
EXCEPTION: Linux targets can be built on Windows using WSL (Windows Subsystem for Linux).
|
||||
|
||||
For more information, see: https://github.com/ElectronNET/Electron.NET/wiki/Migration-Checks#8-cross-platform-build-validation" />
|
||||
|
||||
<RemoveEnvironmentVariables Variables="BUILD_BUILDNUMBER;BUILD_NUMBER;TRAVIS_BUILD_NUMBER;APPVEYOR_BUILD_NUMBER;CIRCLE_BUILD_NUM;CI_PIPELINE_IID" />
|
||||
|
||||
@@ -452,7 +511,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<ElectronPaParams></ElectronPaParams>
|
||||
<ElectronPaParams Condition="'$(PackageId)' != ''">$(ElectronPaParams) -c.appId "$(PackageId)"</ElectronPaParams>
|
||||
<ElectronPaParams Condition="'$(ElectronPackageId)' != ''">$(ElectronPaParams) -c.appId "$(ElectronPackageId)"</ElectronPaParams>
|
||||
<ElectronPaParams Condition="'$(Version)' != ''">$(ElectronPaParams) -c.buildVersion "$(Version)"</ElectronPaParams>
|
||||
<ElectronPaParams Condition="'$(Copyright)' != ''">$(ElectronPaParams) -c.copyright "$(Copyright)"</ElectronPaParams>
|
||||
<ElectronPaParams>$(ElectronPaParams) -c.extraResources "bin/**/*"</ElectronPaParams>
|
||||
|
||||
@@ -479,7 +479,7 @@
|
||||
Description="The version of the app, following the major.minor.patch pattern. Version numbers may include a pre-release suffix."
|
||||
Category="AppInfo" />
|
||||
|
||||
<StringProperty Name="PackageId"
|
||||
<StringProperty Name="ElectronPackageId"
|
||||
DisplayName="App Identifier"
|
||||
Category="AppInfo">
|
||||
</StringProperty>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "$(PackageId)",
|
||||
"name": "$(ElectronPackageId)",
|
||||
"productName": "$(ElectronTitle)",
|
||||
"build": {
|
||||
"appId": "$(PackageId)",
|
||||
"appId": "$(ElectronPackageId)",
|
||||
"linux": {
|
||||
"desktop": {
|
||||
"entry": { "Name": "$(Title)" }
|
||||
},
|
||||
"executableName": "$(PackageId)"
|
||||
"executableName": "$(ElectronPackageId)"
|
||||
},
|
||||
"deb": {
|
||||
"desktop": {
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"license": "$(License)",
|
||||
"executable": "$(TargetName)",
|
||||
"singleInstance": "$(ElectronSingleInstance)",
|
||||
"singleInstance": $(ElectronSingleInstance),
|
||||
"homepage": "$(ProjectUrl)",
|
||||
"splashscreen": {
|
||||
"imageFile": "$(ElectronSplashScreen)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>0.3.0</Version>
|
||||
<Version>0.4.0</Version>
|
||||
<PackageNamePrefix>ElectronNET.Core</PackageNamePrefix>
|
||||
<Authors>Gregor Biswanger, Florian Rappl, softworkz</Authors>
|
||||
<Product>Electron.NET</Product>
|
||||
|
||||
Reference in New Issue
Block a user