Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:electron: Fix "Unknown problem opening <local actual file>" on Electron #3220

Merged
merged 38 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
35ea4b7
add electron logging to main browser process console
MikesGlitch Aug 8, 2024
d158198
add logging
MikesGlitch Aug 8, 2024
10ac92c
removing old way
MikesGlitch Aug 8, 2024
edd898b
release notes
MikesGlitch Aug 8, 2024
b82be35
adding some logs in to test mac build
MikesGlitch Aug 8, 2024
52d6989
repent satan
MikesGlitch Aug 8, 2024
b4d5391
Merge branch 'actualbudget:master' into electron/testing
MikesGlitch Aug 8, 2024
21646a1
i caste yeee oooott sinner
MikesGlitch Aug 8, 2024
fbbe7c1
derp
MikesGlitch Aug 8, 2024
1790ea5
hmmm<
MikesGlitch Aug 8, 2024
3a2f6d8
forcing nodegyprebuild
MikesGlitch Aug 8, 2024
8f425ea
not like this.... Not like this... :cry:
MikesGlitch Aug 8, 2024
44af02e
hmm
MikesGlitch Aug 8, 2024
cdf0ab8
dunno
MikesGlitch Aug 8, 2024
fd02afa
will it recognise it if i link it manually.. :eyes:
MikesGlitch Aug 8, 2024
ddf003c
give up
MikesGlitch Aug 8, 2024
ccafa49
rebuild
MikesGlitch Aug 8, 2024
05740c6
merge asars fasle
MikesGlitch Aug 9, 2024
c2f1dd6
update package
MikesGlitch Aug 9, 2024
2feb605
manually do it ffs work damnit
MikesGlitch Aug 9, 2024
d7070f7
remove the cmd
MikesGlitch Aug 9, 2024
984a2e1
dont rebuild cause i build it manually
MikesGlitch Aug 9, 2024
e631c61
dafuq is this, two bettersqlite modules installed huhhhhh
MikesGlitch Aug 9, 2024
b149b85
test
MikesGlitch Aug 9, 2024
db1ff4d
does this work?
MikesGlitch Aug 9, 2024
bfabab6
bloody hell
MikesGlitch Aug 9, 2024
020f580
couple more logs
MikesGlitch Aug 9, 2024
1d3c025
test this out
MikesGlitch Aug 9, 2024
e00e03f
arch in name
MikesGlitch Aug 9, 2024
8d82132
adding the rebuild step back into first build
MikesGlitch Aug 9, 2024
a8cc797
try rebuild before pack - so we know what arch we need
MikesGlitch Aug 9, 2024
40cab78
having a laugh
MikesGlitch Aug 11, 2024
6cf26b3
tidying up
MikesGlitch Aug 12, 2024
aebd585
release notes
MikesGlitch Aug 12, 2024
ada03c7
move package up a bit
MikesGlitch Aug 12, 2024
d75d2d8
merge
MikesGlitch Aug 12, 2024
117c71d
exit process if no electron verison
MikesGlitch Aug 12, 2024
f0659a5
Merge branch 'actualbudget:master' into electron/testing
MikesGlitch Aug 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions bin/package-electron
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ if [ "$OSTYPE" == "msys" ]; then
fi
fi

yarn rebuild-electron
MikesGlitch marked this conversation as resolved.
Show resolved Hide resolved

yarn workspace loot-core build:node

yarn workspace @actual-app/web build --mode=desktop
Expand All @@ -50,10 +48,10 @@ yarn workspace desktop-electron update-client
if [ -f ../../.secret-tokens ]; then
source ../../.secret-tokens
fi
yarn build --publish never --arm64 --x64
MikesGlitch marked this conversation as resolved.
Show resolved Hide resolved
yarn build

echo "\nCreated release"
else
SKIP_NOTARIZATION=true yarn build --publish never --x64
SKIP_NOTARIZATION=true yarn build
fi
)
36 changes: 36 additions & 0 deletions packages/desktop-electron/beforePackHook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { rebuild } from '@electron/rebuild';
import { Arch, AfterPackContext } from 'electron-builder';

/* The beforePackHook runs before packing the Electron app for an architecture
We hook in here to build anything architecture dependent - such as beter-sqlite3
To build, we call @electron/rebuild on the better-sqlite3 module */
const beforePackHook = async (context: AfterPackContext) => {
const arch: string = Arch[context.arch];
const buildPath = context.packager.projectDir;
const projectRootPath = buildPath + '/../../';
const electronVersion = context.packager.config.electronVersion;

if (!electronVersion) {
console.error('beforePackHook: Unable to find electron version.');
process.exit(); // End the process - electron version is required
}

try {
await rebuild({
arch,
buildPath,
electronVersion,
force: true,
projectRootPath,
onlyModules: ['better-sqlite3'],
});

console.info(`Rebuilt better-sqlite3 with ${arch}!`);
} catch (err) {
console.error('beforePackHook:', err);
process.exit(); // End the process - unsuccessful build
}
};

// eslint-disable-next-line import/no-unused-modules, import/no-default-export
export default beforePackHook;
17 changes: 7 additions & 10 deletions packages/desktop-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,22 @@
"!node_modules/better-sqlite3/{benchmark,src,bin,docs,deps,build/Release/obj,build/Release/sqlite3.a,build/Release/test_extension.node}",
"build"
],
"publish": {
"provider": "github",
"repo": "actual",
"owner": "actualbudget",
"vPrefixedTagName": true
},
MikesGlitch marked this conversation as resolved.
Show resolved Hide resolved
"beforePack": "./build/beforePackHook.js",
"mac": {
"category": "public.app-category.finance",
"icon": "icons/icon.icns",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"artifactName": "${productName}-mac.${ext}",
"artifactName": "${productName}-mac-${arch}.${ext}",
"notarize": {
"teamId": "79ANZ983YF"
},
"target": [
{
"target": "default",
"target": "dmg",
"arch": [
"universal"
MikesGlitch marked this conversation as resolved.
Show resolved Hide resolved
"x64",
"arm64"
]
}
]
Expand All @@ -63,7 +59,8 @@
"target": "nsis",
"icon": "icons/icon.ico",
"artifactName": "${productName}-windows.${ext}"
}
},
"npmRebuild": false
MikesGlitch marked this conversation as resolved.
Show resolved Hide resolved
},
"dependencies": {
"electron-is-dev": "2.0.0",
Expand Down
7 changes: 7 additions & 0 deletions upcoming-release-notes/3220.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
category: Bugfix
authors: [MikesGlitch]
---

Fix electron builds throwing "We had an unknown problem opening file"

Loading