Skip to content
New issue

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

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

Already on GitHub? # to your account

Additional unversial exe package is generated #8597

Closed
qishibo opened this issue Oct 13, 2024 · 6 comments · Fixed by #8607
Closed

Additional unversial exe package is generated #8597

qishibo opened this issue Oct 13, 2024 · 6 comments · Fixed by #8607

Comments

@qishibo
Copy link

qishibo commented Oct 13, 2024

  • Electron-Builder Version: 23.0.2
  • Node Version: v16.20.0
  • Electron Version:12.2.3
  • Electron Type (current, beta, nightly):
  • Target: {"target": "nsis", "arch": ["x64", "arm64"]}

if I build arm64 and x64 nsis target, and my build field like bellow

"win": {
  "target": [
    {"target": "nsis", "arch": ["x64", "arm64"]}
  ]
},
"nsis": {
  "artifactName": "${productName}-Setup-${version}-${arch}.${ext}",
}

after building I got 3 exes instead of 2(arm64 and x64), it seems that an universial package is generated, and its size is about 2 times bigger than arm64 and x64. I am quite confused about this, can I remove the universal version??

image
@qishibo
Copy link
Author

qishibo commented Oct 15, 2024

tried again in local machine, if I don't want this universal version, how can I config to reduct this

image

@mmaietta
Copy link
Collaborator

I took a solid look at the code and am unable to determine the reason as to why a universal package needs to be generated. The logic is quite complex though and AFAICT I don't think it's possible to remove the universal package from being generated.
AFAICT, the logic exists here:

await BluebirdPromise.map(archs.keys(), async arch => {
const { fileInfo, unpackedSize } = await this.packageHelper.packArch(arch, this)
const file = fileInfo.path
const defineKey = arch === Arch.x64 ? "APP_64" : arch === Arch.arm64 ? "APP_ARM64" : "APP_32"
defines[defineKey] = file
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const defineNameKey = `${defineKey}_NAME` as "APP_64_NAME" | "APP_ARM64_NAME" | "APP_32_NAME"
defines[defineNameKey] = path.basename(file)
// nsis expect a hexadecimal string
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const defineHashKey = `${defineKey}_HASH` as "APP_64_HASH" | "APP_ARM64_HASH" | "APP_32_HASH"
defines[defineHashKey] = Buffer.from(fileInfo.sha512, "base64").toString("hex").toUpperCase()
// NSIS accepts size in KiloBytes and supports only whole numbers
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const defineUnpackedSizeKey = `${defineKey}_UNPACKED_SIZE` as "APP_64_UNPACKED_SIZE" | "APP_ARM64_UNPACKED_SIZE" | "APP_32_UNPACKED_SIZE"
defines[defineUnpackedSizeKey] = Math.ceil(unpackedSize / 1024).toString()

@mmaietta
Copy link
Collaborator

Looks like there's been a request to disable the universal package before as well: #8298

@mmaietta
Copy link
Collaborator

X-posting

Would anyone be willing to test out this patch-package?

Patch found here: #8298 (comment)

Copy link
Contributor

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Dec 23, 2024
@m1rn
Copy link

m1rn commented Dec 24, 2024

Is there any progress?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants