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

feat: add arm64 build support #2344

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9f9e3c8
feat: patch upstream for Apple Silicon build
gnattu Dec 10, 2020
a6487f9
fix: volume button does not change state
gnattu Dec 10, 2020
775fdfd
fix: deprecate remote for electron 11
gnattu Dec 10, 2020
3e2f48b
fix: duplicated patch entry
gnattu Dec 10, 2020
d8a54ae
feat: add arm64 build option
gnattu Dec 10, 2020
abacf3e
fix: HFS+ broken on Big Sur
gnattu Dec 11, 2020
7cbcf85
fix: statfs$INODE64 deprecated
gnattu Dec 12, 2020
f2fd85d
fix: build with macOS < 11
gnattu Dec 12, 2020
3a16bbc
fix: indent
gnattu Dec 12, 2020
34c3b53
chore: use scoped event names & clean up
gnattu Dec 14, 2020
4c480d7
fix: gpu status does not load
gnattu Dec 14, 2020
d3fe880
chore: ignore macOS meta file
gnattu Dec 19, 2020
e1ab289
chore: add comment on electron window.open() issue
gnattu Dec 19, 2020
f1d4222
chore: bump electron-builder
gnattu Dec 19, 2020
28abf87
fix: incorrect signing on non-binary
gnattu Dec 19, 2020
10cbf70
fix: PULL_REQUEST_TEMPLATE is not a binary
gnattu Dec 19, 2020
28f30ee
chore: remove debug
gnattu Dec 19, 2020
ebd3e16
fix: npm caused wrong package-lock
gnattu Dec 19, 2020
de0b41b
feat: add arm64 build config
gnattu Dec 20, 2020
7633529
chore: remove hardcoded electron version
gnattu Dec 20, 2020
db754b9
fix: arm64 nsis won’t build without x64 set
gnattu Dec 20, 2020
18fc416
feat: add arm64 build to ci
gnattu Dec 20, 2020
a4bcd9c
feat: add arm64 build for Windows and Linux CI
gnattu Dec 20, 2020
ce97957
fix: multiline script does not run on Windows(azure-pipeline)
gnattu Dec 20, 2020
b465138
fix: remove uncessary script
gnattu Dec 20, 2020
26cddc8
fix: timeout on Linux ci
gnattu Dec 20, 2020
afc54b6
fix: increase total timeout for linux ci
gnattu Dec 20, 2020
60a5049
fix: increase timeout for Windows CI
gnattu Dec 20, 2020
eb4b21b
fix: workaroud for touchbar popover not showing up on electron 11
gnattu Dec 21, 2020
ddbabc7
feat: update touchbar icon
gnattu Dec 21, 2020
122898a
fix: windows updater conflict
gnattu Dec 26, 2020
bb3dbff
fix: newline
gnattu Dec 28, 2020
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
11 changes: 7 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ jobs:
run: |
npm ci
npm run build --if-present
npm run build:arm64 --if-present
npm test
env:
CI: true

build_linux:
name: build_linux
runs-on: ${{ matrix.os }}
timeout-minutes: 12
timeout-minutes: 30

strategy:
matrix:
Expand All @@ -48,18 +49,19 @@ jobs:
sudo apt-get update
sudo apt-get install --no-install-recommends -y libopenjp2-tools rpm bsdtar snapcraft
- name: npm install, build, and test
timeout-minutes: 12
timeout-minutes: 24
run: |
npm ci
npm run build --if-present
npm run build:arm64 --if-present
npm test
env:
CI: true

build_windows:
name: build_windows
runs-on: ${{ matrix.os }}
timeout-minutes: 12
timeout-minutes: 30

strategy:
matrix:
Expand All @@ -79,9 +81,10 @@ jobs:
env:
CI: true
- name: npm build
timeout-minutes: 12
timeout-minutes: 24
run: |
npm run build --if-present
npm run build:arm64 --if-present
env:
CI: true
- name: npm test
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ dist/

# F**k you macOS
.DS_store
._*

#Editor config
.nova
gnattu marked this conversation as resolved.
Show resolved Hide resolved
19 changes: 18 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { app, BrowserWindow, ipcMain, nativeImage, shell } = require('electron')
const { app, BrowserWindow, ipcMain, nativeImage, screen, shell } = require('electron')
const path = require('path-extra')

// Environment
Expand Down Expand Up @@ -194,6 +194,7 @@ app.on('ready', () => {
nativeWindowOpen: true,
zoomFactor: config.get('poi.appearance.zoom', 1),
enableRemoteModule: true,
contextIsolation: false,
// experimentalFeatures: true,
},
backgroundColor: '#00000000',
Expand Down Expand Up @@ -231,6 +232,22 @@ app.on('ready', () => {
mainWindow = null
})

//display config
const handleScreenStatusChange = () => {
mainWindow.webContents.send('screen-status-changed', screen.getAllDisplays())
}
ipcMain.on('displays::get-all', (e) => {
e.returnValue = screen.getAllDisplays()
})
ipcMain.on('displays::remove-all-listeners', () => {
screen.removeListener('display-added', handleScreenStatusChange)
screen.removeListener('display-removed', handleScreenStatusChange)
screen.removeListener('display-metrics-changed', handleScreenStatusChange)
})
screen.addListener('display-added', handleScreenStatusChange)
screen.addListener('display-removed', handleScreenStatusChange)
screen.addListener('display-metrics-changed', handleScreenStatusChange)

// devtool
if (dbg.isEnabled() && config.get('poi.devtool.enable', false)) {
require('./lib/devtool')
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ install:

build_script:
- npm run build
- npm run build:arm64
- .\node_modules\.bin\gulp build_plugins

artifacts:
Expand Down
Binary file added assets/img/touchbar/angle-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/img/touchbar/angle-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/img/touchbar/arrows-alt.png
Binary file not shown.
Binary file removed assets/img/touchbar/bolt.png
Binary file not shown.
Binary file removed assets/img/touchbar/camera-retro.png
Binary file not shown.
Binary file added assets/img/touchbar/camera.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/touchbar/console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/img/touchbar/edit.png
Binary file not shown.
Binary file added assets/img/touchbar/fullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/touchbar/lock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/touchbar/media.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/img/touchbar/pen-square.png
Binary file not shown.
Binary file removed assets/img/touchbar/photo.png
Binary file not shown.
Binary file modified assets/img/touchbar/refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/touchbar/social-media.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/img/touchbar/terminal.png
Binary file not shown.
Binary file added assets/img/touchbar/unlock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/img/touchbar/volume-off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/img/touchbar/volume-up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions build-arm64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
directories:
output: dist
buildResources: build
app: app_compiled
appId: org.poooi.poi
asar: true
npmRebuild: false
mac:
publish: []
icon: assets/icons/poi.icns
category: public.app-category.games
provisioningProfile: poi.provisionprofile
target:
- target: default
arch:
- arm64
dmg:
contents:
- x: 410
'y': 220
type: link
path: /Applications
- x: 130
'y': 220
type: file
win:
publish: []
icon: assets/icons/poi.ico
target:
- target: nsis
arch:
- arm64
- target: 7z
arch:
- arm64
nsis:
artifactName: 'poi-setup-${version}-arm64.${ext}'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds arm64 suffix to the NSIS file name. But electron-builder also creates a latest.yml to use with electron-updater. The name is latest.yml for both x64 and arm64 so they end up overwriting each other. Any solution?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to patch this. You can apply this patch to poi as well: https://github.com/webcatalog/webcatalog-app/pull/1253/files

oneClick: false
allowToChangeInstallationDirectory: true
multiLanguageInstaller: true
linux:
publish: []
target:
- target: 7z
arch:
- arm64
- target: deb
arch:
- arm64
- target: rpm
arch:
- arm64
- target: pacman
arch:
- arm64
- target: AppImage
arch:
- arm64
icon: assets/icons
4 changes: 4 additions & 0 deletions build/azure-pipeline-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ steps:
npm run build
displayName: 'npm build'

- script: |
npm run build:arm64
displayName: 'npm build:arm64'

- script: |
npm test
displayName: 'npm test'
Expand Down
42 changes: 32 additions & 10 deletions lib/touchbar.es
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export const sendEscKey = () => {

// buttons
const devtools = new TouchBarButton({
icon: getIcon('terminal'),
icon: getIcon('console'),
click: () => {
mainWindow.openDevTools({ mode: 'detach' })
},
})

const screenshot = new TouchBarButton({
icon: getIcon('camera-retro'),
icon: getIcon('camera'),
click: () => {
mainWindow.webContents.send('touchbar', 'screenshot')
},
Expand All @@ -43,21 +43,21 @@ const volume = new TouchBarButton({
})

const cachedir = new TouchBarButton({
icon: getIcon('bolt'),
icon: getIcon('social-media'),
click: () => {
mainWindow.webContents.send('touchbar', 'cachedir')
},
})

const screenshotdir = new TouchBarButton({
icon: getIcon('photo'),
icon: getIcon('media'),
click: () => {
mainWindow.webContents.send('touchbar', 'screenshotdir')
},
})

const adjust = new TouchBarButton({
icon: getIcon('arrows-alt'),
icon: getIcon('fullscreen'),
click: () => {
mainWindow.webContents.send('touchbar', 'adjust')
},
Expand All @@ -71,7 +71,7 @@ const refresh = new TouchBarButton({
})

const edit = new TouchBarButton({
icon: config.get('poi.layout.editable') ? getIcon('pen-square') : getIcon('edit'),
icon: config.get('poi.layout.editable') ? getIcon('unlock') : getIcon('lock'),
click: () => {
mainWindow.webContents.send('touchbar', 'edit')
},
Expand All @@ -93,9 +93,24 @@ const spacer2 = new TouchBarSpacer({
})

//popover
const popover = new TouchBarPopover({
items: [devtools, screenshot, volume, cachedir, screenshotdir, adjust, edit, refresh],
//touchBar popover is not working for electron 11 at the moment, refer: https://github.com/electron/electron/issues/26615
//const popover = new TouchBarPopover({
// items: [devtools, screenshot, volume, cachedir, screenshotdir, adjust, edit, refresh],
// icon: getIcon('angle-right'),
//})

const openPopover = new TouchBarButton({
icon: getIcon('angle-right'),
click: () => {
mainWindow.setTouchBar(popoverTouchbar)
},
})

const closePopover = new TouchBarButton({
icon: getIcon('angle-left'),
click: () => {
renderMainTouchbar()
},
})

//tab-switching
Expand Down Expand Up @@ -153,14 +168,21 @@ export const toggleRefreshConfirm = (btn1, btn2) => {

//main-touchbar
const mainTouchbar = new TouchBar({
items: [devtools, screenshot, volume, popover, spacer1, tabs, spacer2, refresh],
items: [devtools, screenshot, volume, openPopover, spacer1, tabs, spacer2, refresh],
escapeItem: poibutton,
})

const popoverTouchbar = new TouchBar({
items: [devtools, screenshot, volume, cachedir, screenshotdir, adjust, edit, closePopover],
escapeItem: poibutton,
})

//Change Volume or Edit btn
export const updateTouchbarInfoIcons = () => {
edit.icon = config.get('poi.layout.editable') ? getIcon('pen-square') : getIcon('edit')
edit.icon = config.get('poi.layout.editable') ? getIcon('unlock') : getIcon('lock')
volume.icon = config.get('poi.content.muted') ? getIcon('volume-off') : getIcon('volume-up')
//TouchBar icon will not auto update on recent macOS
renderMainTouchbar()
}

//Tab switching initialization
Expand Down
9 changes: 8 additions & 1 deletion lib/utils.es
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export function stopNavigateAndHandleNewWindow(id) {
options.webPreferences.webSecurity = false
}
if (frameName.startsWith('plugin[gpuinfo]')) {
options = {}
options.backgroundColor = '#FFFFFFFF'
}
if (url.startsWith('chrome')) {
Expand All @@ -120,7 +121,13 @@ export function stopNavigateAndHandleNewWindow(id) {
sandbox: true,
},
}
e.newGuest = new BrowserWindow(options)
const win = new BrowserWindow(options)
if (frameName.startsWith('plugin[gpuinfo]')) {
win.setBounds({ width: 640, height: 480 })
win.center()
win.loadURL('chrome://gpu')
}
e.newGuest = win
}
})
}
Expand Down
Loading