Skip to content

Commit

Permalink
perf: 🚀 为 windows 添加 ARM64 软件包编译
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Oct 21, 2023
1 parent 8360198 commit 368e8ee
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- os: macos-latest
arch: [arm64, amd64]
- os: windows-latest
arch: amd64
arch: [arm64, amd64]
steps:
- name: Check out Git repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -66,4 +66,4 @@ jobs:
dist-release/*.yml
dist-release/*.blockmap
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
11 changes: 6 additions & 5 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"updaterCacheDirName": "escrcpy-updater"
},
"nsis": {
"artifactName": "${productName}-${version}-win-setup.${ext}",
"artifactName": "${productName}-${version}-win-setup-${arch}.${ext}",
"shortcutName": "${productName}",
"uninstallDisplayName": "${productName}",
"oneClick": false,
Expand All @@ -24,25 +24,26 @@
"deleteAppDataOnUninstall": false
},
"portable": {
"artifactName": "${productName}-${version}-win-portable.${ext}",
"artifactName": "${productName}-${version}-win-portable-${arch}.${ext}",
"requestExecutionLevel": "user"
},
"win": {
"icon": "logo.ico",
"target": [
{
"target": "nsis",
"arch": ["x64"]
"arch": ["x64", "arm64"]
},
{
"target": "zip",
"arch": ["x64"]
"arch": ["x64", "arm64"]
},
{
"target": "portable",
"arch": ["x64"]
"arch": ["x64", "arm64"]
}
],
"artifactName": "${productName}-${version}-win-${arch}.${ext}",
"extraResources": {
"from": "electron/resources/extra",
"to": "extra"
Expand Down
3 changes: 3 additions & 0 deletions electron/configs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const logoPath = buildResolve('logo.png')
export const icoLogoPath = buildResolve('logo.ico')
export const icnsLogoPath = buildResolve('logo.icns')

export const trayPath = extraResolve('tray.png')
export const macTrayPath = extraResolve('tray-Template.png')

export const adbPath
= process.platform === 'win32'
? extraResolve('core/adb.exe')
Expand Down
7 changes: 3 additions & 4 deletions electron/events/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import handles from './handles/index.js'
import tray from './tray/index.js'

export default (mainWindow) => {
handles(mainWindow)
updater(mainWindow)
tray(mainWindow)

ipcMain.on('restart-app', () => {
app.relaunch()
app.quit()
})
handles(mainWindow)
updater(mainWindow)
tray(mainWindow)
}
17 changes: 13 additions & 4 deletions electron/events/tray/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Menu, Tray, app, dialog } from 'electron'
import { logoPath } from '@electron/configs/index'
import { macTrayPath, trayPath } from '@electron/configs/index'
import appStore from '@electron/helpers/store.js'

export default (mainWindow) => {
Expand Down Expand Up @@ -29,7 +29,9 @@ export default (mainWindow) => {
else if (response === 1) {
mainWindow.hide()

tray = new Tray(logoPath)
const trayIcon = process.platform === 'darwin' ? macTrayPath : trayPath

tray = new Tray(trayIcon)

tray.setToolTip('escrcpy')

Expand All @@ -44,6 +46,13 @@ export default (mainWindow) => {
showApp()
},
},
{
label: '重启服务',
click: () => {
app.relaunch()
quitApp()
},
},
{
label: '退出',
click: () => {
Expand Down Expand Up @@ -84,8 +93,8 @@ export default (mainWindow) => {
checkboxLabel: '是否记住选择?',
})

console.log('response', response)
console.log('checkboxChecked', checkboxChecked)
// console.log('response', response)
// console.log('checkboxChecked', checkboxChecked)

if (checkboxChecked) {
appStore.set('appCloseCode', response)
Expand Down
2 changes: 1 addition & 1 deletion electron/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const extraResolve = (value) => {
}

export const buildResolve = value =>
resolve(`electron/resources/build/${value}`)
resolve(process.env.CWD, `electron/resources/build/${value}`)

export function exposeContext(key, value) {
if (process.contextIsolated) {
Expand Down
2 changes: 2 additions & 0 deletions electron/helpers/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ if (process.platform === 'darwin') {
process.env.IS_PACKAGED = JSON.stringify(app.isPackaged)

process.env.DESKTOP_PATH = app.getPath('desktop')

process.env.CWD = process.cwd()
Binary file added electron/resources/extra/tray-Template.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 electron/resources/extra/tray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 368e8ee

Please sign in to comment.