Skip to content

Commit

Permalink
Merge branch 'master' into burnhamup/escape_version
Browse files Browse the repository at this point in the history
  • Loading branch information
burnhamup committed Mar 6, 2021
2 parents 5d147ce + 0b03f10 commit 301cef1
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 8 deletions.
14 changes: 14 additions & 0 deletions packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,13 @@
"string"
]
},
"packageName": {
"description": "The name of the package.",
"type": [
"null",
"string"
]
},
"priority": {
"description": "The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute.",
"type": [
Expand Down Expand Up @@ -1736,6 +1743,13 @@
"string"
]
},
"packageName": {
"description": "The name of the package.",
"type": [
"null",
"string"
]
},
"publish": {
"anyOf": [
{
Expand Down
3 changes: 1 addition & 2 deletions packages/app-builder-lib/src/electron/ElectronFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async function unpack(prepareOptions: PrepareApplicationStageDirectoryOptions, o
const zipFile = `electron-v${options.version}-${platformName}-${options.arch}.zip`
const resolvedDist = path.isAbsolute(dist) ? dist : path.resolve(packager.projectDir, dist)
if ((await statOrNull(path.join(resolvedDist, zipFile))) != null) {
log.debug({ resolvedDist, zipFile }, "Resolved electronDist")
log.info({ resolvedDist, zipFile }, "Resolved electronDist")
options.cache = resolvedDist
dist = null
}
Expand All @@ -162,7 +162,6 @@ async function unpack(prepareOptions: PrepareApplicationStageDirectoryOptions, o
if (isSafeToUnpackElectronOnRemoteBuildServer(packager)) {
return
}
log.info({ zipPath: options.cache }, "Unpacking electron zip")
await executeAppBuilder(["unpack-electron", "--configuration", JSON.stringify([options]), "--output", appOutDir, "--distMacOsAppName", distMacOsAppName])
}
else {
Expand Down
5 changes: 5 additions & 0 deletions packages/app-builder-lib/src/options/linuxOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ export interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSp
*/
readonly packageCategory?: string | null

/**
* The name of the package.
*/
readonly packageName?: string | null

readonly vendor?: string | null
readonly maintainer?: string | null

Expand Down
3 changes: 2 additions & 1 deletion packages/app-builder-lib/src/targets/fpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { installPrefix, LinuxTargetHelper } from "./LinuxTargetHelper"
import { getLinuxToolsPath } from "./tools"

interface FpmOptions {
name: string
maintainer: string | undefined
vendor: string
url: string
Expand Down Expand Up @@ -83,6 +84,7 @@ export default class FpmTarget extends Target {
}

return {
name: options.packageName ?? this.packager.appInfo.linuxPackageName,
maintainer: author!!,
url: projectUrl!!,
vendor: options.vendor || author!!,
Expand Down Expand Up @@ -124,7 +126,6 @@ export default class FpmTarget extends Target {
const synopsis = options.synopsis
const args = [
"--architecture", toLinuxArchString(arch, target),
"--name", appInfo.linuxPackageName,
"--after-install", scripts[0],
"--after-remove", scripts[1],
"--description", smarten(target === "rpm" ? this.helper.getDescription(options)! : `${synopsis || ""}\n ${this.helper.getDescription(options)}`),
Expand Down
3 changes: 2 additions & 1 deletion packages/builder-util/src/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ export class Logger {
for (const name of fieldNames) {
let fieldValue = fields[name]
let valuePadding: string | null = null
// Remove unnecessary line breaks
if (fieldValue != null && typeof fieldValue === "string" && fieldValue.includes("\n")) {
valuePadding = " ".repeat(messagePadding + message.length + fieldPadding.length + 2)
fieldValue = "\n" + valuePadding + fieldValue.replace(/\n/g, `\n${valuePadding}`)
fieldValue = fieldValue.replace(/\n\s*\n/g, `\n${valuePadding}`)
}
else if (Array.isArray(fieldValue)) {
fieldValue = JSON.stringify(fieldValue)
Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ function handleProcess(event: string, childProcess: ChildProcess, command: strin
}
}
else {
reject(new ExecError(command, code, formatOut(out, "Output"), formatOut(errorOut, "Error output")))
reject(new ExecError(command, code, out, errorOut))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function wrap(task: (args: any) => Promise<any>) {
log.error(null, error.message)
}
else if (!(error instanceof ExecError) || !error.alreadyLogged) {
log.error({stackTrace: error.stack}, error.message)
log.error( { failedTask: task.name, stackTrace: error.stack }, error.message)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion test/snapshots/BuildTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ Object {
"size": 1069,
},
"abi_registry.json": Object {
"size": 1620,
"size": 1742,
},
"index.js": Object {
"size": 6099,
Expand Down
47 changes: 47 additions & 0 deletions test/snapshots/mac/macPackagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,50 @@ Array [
"en.lproj",
]
`;

exports[`two-package 6`] = `
Object {
"CFBundleDisplayName": "TestApp",
"CFBundleExecutable": "TestApp",
"CFBundleIconFile": "TestApp.icns",
"CFBundleIdentifier": "org.electron-builder.testApp",
"CFBundleInfoDictionaryVersion": "6.0",
"CFBundleName": "TestApp",
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": "1.1.0",
"LSApplicationCategoryType": "your.app.category.type",
"LSRequiresNativeExecution": true,
"NSAppTransportSecurity": Object {
"NSAllowsLocalNetworking": true,
"NSExceptionDomains": Object {
"127.0.0.1": Object {
"NSIncludesSubdomains": false,
"NSTemporaryExceptionAllowsInsecureHTTPLoads": true,
"NSTemporaryExceptionAllowsInsecureHTTPSLoads": false,
"NSTemporaryExceptionMinimumTLSVersion": "1.0",
"NSTemporaryExceptionRequiresForwardSecrecy": false,
},
"localhost": Object {
"NSIncludesSubdomains": false,
"NSTemporaryExceptionAllowsInsecureHTTPLoads": true,
"NSTemporaryExceptionAllowsInsecureHTTPSLoads": false,
"NSTemporaryExceptionMinimumTLSVersion": "1.0",
"NSTemporaryExceptionRequiresForwardSecrecy": false,
},
},
},
"NSHighResolutionCapable": true,
"NSPrincipalClass": "AtomApplication",
"NSSupportsAutomaticGraphicsSwitching": true,
}
`;

exports[`two-package 7`] = `
Array [
"TestApp.icns",
"app-update.yml",
"app.asar",
"bn.lproj",
"en.lproj",
]
`;
2 changes: 1 addition & 1 deletion test/src/helpers/packTester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ async function packAndCheck(packagerOptions: PackagerOptions, checkOptions: Asse

const objectToCompare: any = {}
for (const platform of packagerOptions.targets!!.keys()) {
objectToCompare[platform.buildConfigurationKey] = await Promise.all((artifacts.get(platform) || []).sort((a, b) => sortKey(a).localeCompare(sortKey(b))).map(async it => {
objectToCompare[platform.buildConfigurationKey] = await Promise.all((artifacts.get(platform) || []).sort((a, b) => sortKey(a).localeCompare(sortKey(b), 'en')).map(async it => {
const result: any = {...it}
const file = result.file
if (file != null) {
Expand Down

0 comments on commit 301cef1

Please sign in to comment.