Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
3 changes: 2 additions & 1 deletion packages/app-builder-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"semver": "^7.3.8",
"tar": "^6.1.12",
"temp-file": "^3.4.0",
"tiny-async-pool": "1.3.0"
"tiny-async-pool": "1.3.0",
"simple-plist": "1.3.1"
},
"///": "babel in devDependencies for proton tests",
"devDependencies": {
Expand Down
28 changes: 16 additions & 12 deletions packages/app-builder-lib/src/electron/electronMac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { filterCFBundleIdentifier } from "../appInfo"
import { AsarIntegrity } from "../asar/integrity"
import { MacPackager } from "../macPackager"
import { normalizeExt } from "../platformPackager"
import { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from "../util/appBuilder"
import SimplePlist from "simple-plist"
import { executeAppBuilderAsJson } from "../util/appBuilder"
import { createBrandingOpts } from "./ElectronFramework"

function doRename(basePath: string, oldName: string, newName: string) {
Expand Down Expand Up @@ -229,31 +230,34 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa
appPlist.ElectronAsarIntegrity = asarIntegrity
}

const plistDataToWrite: any = {
[appPlistFilename]: appPlist,
[helperPlistFilename]: helperPlist,
}
if (helperEHPlist != null) {
plistDataToWrite[helperEHPlistFilename] = helperEHPlist
SimplePlist.writeFileSync(helperEHPlistFilename, helperEHPlist)
}

if (helperNPPlist != null) {
plistDataToWrite[helperNPPlistFilename] = helperNPPlist
SimplePlist.writeFileSync(helperNPPlistFilename, helperNPPlist)
}

if (helperRendererPlist != null) {
plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist
SimplePlist.writeFileSync(helperRendererPlistFilename, helperRendererPlist)
}

if (helperPluginPlist != null) {
plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist
SimplePlist.writeFileSync(helperPluginPlistFilename, helperPluginPlist)
}

if (helperGPUPlist != null) {
plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist
SimplePlist.writeFileSync(helperGPUPlistFilename, helperGPUPlist)
}

if (helperLoginPlist != null) {
plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist
SimplePlist.writeFileSync(helperLoginPlistFilename, helperLoginPlist)
}

SimplePlist.writeFileSync(appPlistFilename, appPlist)
SimplePlist.writeFileSync(helperPlistFilename, helperPlist)

await Promise.all([
executeAppBuilderAndWriteJson(["encode-plist"], plistDataToWrite),
doRename(path.join(contentsPath, "MacOS"), electronBranding.productName, appPlist.CFBundleExecutable),
unlinkIfExists(path.join(appOutDir, "LICENSE")),
unlinkIfExists(path.join(appOutDir, "LICENSES.chromium.html")),
Expand Down
14 changes: 6 additions & 8 deletions packages/app-builder-lib/src/frameworks/LibUiFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Platform } from "../core"
import { Framework, PrepareApplicationStageDirectoryOptions } from "../Framework"
import { LinuxPackager } from "../linuxPackager"
import { MacPackager } from "../macPackager"
import { executeAppBuilderAndWriteJson } from "../util/appBuilder"
import SimplePlist from "simple-plist"

export class LibUiFramework implements Framework {
readonly name: string = "libui"
Expand Down Expand Up @@ -71,16 +71,14 @@ export class LibUiFramework implements Framework {
NSHighResolutionCapable: true,
}
await packager.applyCommonInfo(appPlist, appContentsDir)
await Promise.all([
executeAppBuilderAndWriteJson(["encode-plist"], { [path.join(appContentsDir, "Info.plist")]: appPlist }),
writeExecutableMain(
path.join(appContentsDir, "MacOS", appPlist.CFBundleExecutable),
`#!/bin/sh
SimplePlist.writeFileSync(path.join(appContentsDir, "Info.plist"), appPlist)
await writeExecutableMain(
path.join(appContentsDir, "MacOS", appPlist.CFBundleExecutable),
`#!/bin/sh
DIR=$(dirname "$0")
"$DIR/node" "$DIR/../Resources/app/${options.packager.info.metadata.main || "index.js"}"
`
),
])
)
}

private async prepareLinuxApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {
Expand Down
5 changes: 3 additions & 2 deletions packages/app-builder-lib/src/targets/pkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { findIdentity, Identity } from "../codeSign/macCodeSign"
import { Target } from "../core"
import { MacPackager } from "../macPackager"
import { PkgOptions } from "../options/pkgOptions"
import { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from "../util/appBuilder"
import SimplePlist from "simple-plist"
import { executeAppBuilderAsJson } from "../util/appBuilder"
import { getNotLocalizedLicenseFile } from "../util/license"

const certType = "Developer ID Installer"
Expand Down Expand Up @@ -237,7 +238,7 @@ export class PkgTarget extends Target {
args.push("--scripts", scriptsDir)
}
if (plistInfo.length > 0) {
await executeAppBuilderAndWriteJson(["encode-plist"], { [propertyListOutputFile]: plistInfo })
SimplePlist.writeFileSync(propertyListOutputFile, packageInfo)
}

args.push(packageOutputFile)
Expand Down
39 changes: 39 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading