Skip to content

Commit

Permalink
fix windows build (keybase#26100)
Browse files Browse the repository at this point in the history
fix windows build
  • Loading branch information
chrisnojima authored Jan 2, 2024
1 parent 880af26 commit 956b976
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packaging/linux/build_binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ build_one_architecture() {
echo "Building Electron client for $electron_arch..."
(
cd "$this_repo/shared"
yarn run package -- --platform linux --arch "$electron_arch" --appVersion "$version" --network-concurrency 8
yarn run package -- --platform=linux --arch="$electron_arch" --appVersion="$version" --network-concurrency=8
rsync -a "desktop/release/linux-${electron_arch}/Keybase-linux-${electron_arch}/" \
"$layout_dir/opt/keybase"
chmod 755 "$layout_dir/opt/keybase"
Expand Down
2 changes: 1 addition & 1 deletion packaging/windows/buildui.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ IF %ERRORLEVEL% NEQ 0 (
EXIT /B 1
)

cmd /C yarn run package --arch x64 --platform win32 --appVersion %KEYBASE_VERSION% --icon %GOPATH%\src\github.com\keybase\client\media\icons\Keybase.ico
cmd /C yarn run package --arch=x64 --platform=win32 --appVersion=%KEYBASE_VERSION% --icon=%GOPATH%\src\github.com\keybase\client\media\icons\Keybase.ico
IF %ERRORLEVEL% NEQ 0 (
EXIT /B 1
)
Expand Down
1 change: 1 addition & 0 deletions shared/desktop/app/main-window.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const setupWindowEvents = (win: Electron.BrowserWindow) => {

const changeDock = (show: boolean) => {
const dock = Electron.app.dock
if (!dock) return
if (show) {
dock
.show()
Expand Down
2 changes: 1 addition & 1 deletion shared/desktop/app/menu-bar.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const MenuBar = () => {
badges = action.payload.desktopAppBadgeCount
updateIcon()
const dock = Electron.app.dock
if (dock.isVisible()) {
if (dock?.isVisible()) {
Electron.app.badgeCount = action.payload.desktopAppBadgeCount
}

Expand Down
2 changes: 1 addition & 1 deletion shared/desktop/app/node2.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ const handleActivate = () => {
mainWindow?.show()
const dock = Electron.app.dock
dock
.show()
?.show()
.then(() => {})
.catch(() => {})
}
Expand Down
44 changes: 15 additions & 29 deletions shared/desktop/package.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ const platform = argv.platform || os.platform()
const appVersion = argv.appVersion || '0.0.0'
const comment = argv.comment
const outDir = argv.outDir
const icon = argv.icon
const saltpackIcon = argv.saltpackIcon
const appCopyright = 'Copyright (c) 2022, Keybase'
const appCopyright = 'Copyright (c) 2024, Keybase'
const companyName = 'Keybase, Inc.'
const electronVersion = require('../package.json').devDependencies.electron
console.log('Found electron version:', electronVersion)

const packagerOpts: Options = {
appBundleId: 'keybase.Electron',
Expand All @@ -99,7 +100,7 @@ const packagerOpts: Options = {
darwinDarkModeSupport: true,
dir: desktopPath('./build'),
download: {checksums: electronChecksums},
electronVersion: undefined,
electronVersion,
// macOS file association to saltpack files
extendInfo: {
CFBundleDocumentTypes: [
Expand All @@ -126,17 +127,24 @@ const packagerOpts: Options = {
],
},
// Any paths placed here will be moved to the final bundle
extraResource: [] as Array<string>,
extraResource: saltpackIcon ? [saltpackIcon] : undefined,
helperBundleId: 'keybase.ElectronHelper',
icon: undefined,
icon: argv.icon,
ignore: [/\.map/, /\/test($|\/)/, /\/tools($|\/)/, /\/release($|\/)/, /\/node_modules($|\/)/],
name: appName,
protocols: [
{
name: 'Keybase',
schemes: ['keybase', 'web+stellar'],
schemes: ['keybase'],
},
],
prune: true,
}

if (!packagerOpts.extraResource?.[0]) {
console.warn(
`Missing 'saltpack.icns' from yarn package arguments. Need an icon to associate ".saltpack" files with Electron on macOS, Windows, and Linux.`
)
}

async function main() {
Expand Down Expand Up @@ -166,28 +174,6 @@ async function main() {
version: appVersion,
})

if (icon) {
packagerOpts.icon = icon
}

if (saltpackIcon) {
packagerOpts.extraResource = [saltpackIcon]
} else {
console.warn(
`Missing 'saltpack.icns' from yarn package arguments. Need an icon to associate ".saltpack" files with Electron on macOS, Windows, and Linux.`
)
}

// use the same version as the currently-installed electron
console.log('Finding electron version')
try {
packagerOpts.electronVersion = require('../package.json').devDependencies.electron
console.log('Found electron version:', packagerOpts.electronVersion)
} catch (err) {
console.log("Couldn't parse yarn list to find electron:", err)
process.exit(1)
}

try {
await startPack()
} catch (err) {
Expand Down Expand Up @@ -256,7 +242,6 @@ async function pack(plat: string, arch: string) {
arch,
out: packageOutDir,
platform: plat,
prune: true,
...(plat === 'win32'
? {
'version-string': {
Expand All @@ -268,6 +253,7 @@ async function pack(plat: string, arch: string) {
}
: null),
}
console.log('Building using options', opts)

const ret = await packager(opts)
// sometimes returns bools, unclear why
Expand Down
13 changes: 13 additions & 0 deletions shared/patches/electron+27.1.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/electron/electron.d.ts b/node_modules/electron/electron.d.ts
index eedb19d..fe8e946 100644
--- a/node_modules/electron/electron.d.ts
+++ b/node_modules/electron/electron.d.ts
@@ -1539,7 +1539,7 @@ declare namespace Electron {
*
* @platform darwin
*/
- readonly dock: Dock;
+ readonly dock: Dock | undefined;
/**
* A `boolean` property that returns `true` if the app is packaged, `false`
* otherwise. For many apps, this property can be used to distinguish development

0 comments on commit 956b976

Please sign in to comment.