Electron arm64

This commit is contained in:
Natsumi
2025-08-31 18:07:20 +12:00
parent d6a1004632
commit 61d34db219
4 changed files with 40 additions and 8 deletions
+9 -3
View File
@@ -8,7 +8,7 @@
<TargetFramework>net9.0</TargetFramework>
<OutputType>Library</OutputType>
<Configurations>Debug;Release</Configurations>
<Platforms>x64</Platforms>
<Platforms>x64;ARM64</Platforms>
<PlatformTarget>x64</PlatformTarget>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
@@ -35,10 +35,16 @@
<DefineConstants>LINUX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<PropertyGroup>
+1 -1
View File
@@ -13,7 +13,7 @@
"test:coverage": "jest --coverage",
"prod": "cross-env PLATFORM=windows webpack --config webpack.config.js --mode production",
"prod-linux": "cross-env PLATFORM=linux webpack --config webpack.config.js --mode production",
"build-electron": "node ./src-electron/download-dotnet-runtime.js && node ./src-electron/patch-package-version.js && electron-builder --x64 --publish never",
"build-electron": "node ./src-electron/download-dotnet-runtime.js && node ./src-electron/patch-package-version.js && electron-builder --publish never",
"postbuild-electron": "node ./src-electron/patch-node-api-dotnet.js && node ./src-electron/rename-builds.js",
"start-electron": "electron ."
},
+27 -4
View File
@@ -3,8 +3,29 @@ const path = require('path');
const https = require('https');
const { spawnSync } = require('child_process');
let runnerArch = process.arch.toString();
let runnerPlatform = process.platform.toString();
const args = process.argv.slice(2);
for (let i = 0; i < args.length; i++) {
if (args[i] === '--arch' && i + 1 < args.length) {
runnerArch = args[i + 1];
} else if (args[i] === '--platform' && i + 1 < args.length) {
runnerPlatform = args[i + 1];
}
}
let platform = '';
if (runnerPlatform === 'linux') {
platform = 'linux';
} else if (runnerPlatform === 'darwin') {
platform = 'osx';
} else if (runnerPlatform === 'win32') {
platform = 'win';
} else {
throw new Error(`Unsupported platform: ${runnerPlatform}`);
}
const DOTNET_VERSION = '9.0.8';
const DOTNET_RUNTIME_URL = `https://builds.dotnet.microsoft.com/dotnet/Runtime/${DOTNET_VERSION}/dotnet-runtime-${DOTNET_VERSION}-linux-x64.tar.gz`;
const DOTNET_RUNTIME_URL = `https://builds.dotnet.microsoft.com/dotnet/Runtime/${DOTNET_VERSION}/dotnet-runtime-${DOTNET_VERSION}-${platform}-${runnerArch}.tar.gz`;
const DOTNET_RUNTIME_DIR = path.join(
__dirname,
'..',
@@ -58,12 +79,14 @@ async function extractTarGz(tarGzPath, extractDir) {
}
async function main() {
if (process.platform !== 'linux') {
console.log('Skipping .NET runtime download on non-Linux platform');
if (platform !== 'linux' && platform !== 'darwin') {
console.log('Skipping .NET runtime download on non supported platform');
return;
}
console.log(`Downloading .NET ${DOTNET_VERSION} runtime...`);
console.log(
`Downloading .NET ${DOTNET_VERSION}-${platform}-${runnerArch} runtime...`
);
if (!fs.existsSync(DOTNET_RUNTIME_DIR)) {
fs.mkdirSync(DOTNET_RUNTIME_DIR, { recursive: true });
+3
View File
@@ -43,6 +43,9 @@ switch (process.platform) {
platformName = 'linux';
break;
}
if (process.arch === 'arm64') {
platformName += '-arm64';
}
const postBuildPath = path.join(
__dirname,
`./../build/${platformName}-unpacked/resources/app.asar.unpacked/node_modules/node-api-dotnet/init.js`