Skip to content

Commit

Permalink
feat: product name for AppImage file
Browse files Browse the repository at this point in the history
Close #1895, Close #3334
  • Loading branch information
develar committed Nov 16, 2018
1 parent e0dd818 commit 68e5573
Show file tree
Hide file tree
Showing 28 changed files with 132 additions and 112 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cache:
- '%LOCALAPPDATA%\electron-builder\cache'

environment:
TEST_FILES: ExtraBuildTest,BuildTest,extraMetadataTest,filesTest,globTest,nsisUpdaterTest,oneClickInstallerTest,installerTest,appxTest,msiTest
TEST_FILES: ExtraBuildTest,BuildTest,extraMetadataTest,filesTest,globTest,nsisUpdaterTest,oneClickInstallerTest,installerTest,appxTest,msiTest,protonTest

install:
- ps: Install-Product node 10 x64
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"source-map-support": "^0.5.9",
"stat-mode": "^0.2.2",
"sumchecker": "^2.0.2",
"temp-file": "^3.2.0",
"temp-file": "^3.3.2",
"tunnel-agent": "^0.6.0",
"update-notifier": "^2.5.0",
"yargs": "^12.0.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"semver": "^5.6.0",
"debug": "^4.1.0",
"lazy-val": "^1.0.3",
"temp-file": "^3.2.0",
"temp-file": "^3.3.2",
"ejs": "^2.6.1"
},
"typings": "./out/index.d.ts"
Expand Down
1 change: 1 addition & 0 deletions packages/app-builder-lib/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
throw new InvalidConfigurationError(`Cannot find valid "${certType}" identity to sign MAS installer, please see https://electron.build/code-signing`)
}

// mas uploaded to AppStore, so, use "-" instead of space for name
const artifactName = this.expandArtifactNamePattern(masOptions, "pkg")
const artifactPath = path.join(outDir!, artifactName)
await this.doFlat(appPath, artifactPath, masInstallerIdentity, keychainName)
Expand Down
5 changes: 5 additions & 0 deletions packages/app-builder-lib/src/platformPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,11 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
return this.computeArtifactName(pattern, ext, skipArchIfX64 && arch === Arch.x64 ? null : arch)
}

expandArtifactBeautyNamePattern(targetSpecificOptions: TargetSpecificOptions | null | undefined, ext: string, arch?: Arch | null): string {
// tslint:disable-next-line:no-invalid-template-strings
return this.expandArtifactNamePattern(targetSpecificOptions, ext, arch, "${productName} ${version} ${arch}.${ext}", true)
}

private computeArtifactName(pattern: any, ext: string, arch: Arch | null | undefined) {
let archName: string | null = arch == null ? null : Arch[arch]
if (arch === Arch.x64) {
Expand Down
8 changes: 4 additions & 4 deletions packages/app-builder-lib/src/remoteBuilder/builder-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ if (process.env.BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG == null) {
}

async function doBuild(data: BuildTask): Promise<void> {
if (process.env.ELECTRON_BUILDER_TMP_DIR == null) {
throw new Error("Env ELECTRON_BUILDER_TMP_DIR must be set for builder process")
if (process.env.APP_BUILDER_TMP_DIR == null) {
throw new Error("Env APP_BUILDER_TMP_DIR must be set for builder process")
}

const projectDir = process.env.PROJECT_DIR
Expand Down Expand Up @@ -86,13 +86,13 @@ async function doBuild(data: BuildTask): Promise<void> {
}, info.metadata, info.devMetadata, info.repositoryInfo)

// writeJson must be not used because it adds unwanted \n as last file symbol
await writeFile(path.join(process.env.ELECTRON_BUILDER_TMP_DIR!!, "__build-result.json"), JSON.stringify(artifacts))
await writeFile(path.join(process.env.APP_BUILDER_TMP_DIR!!, "__build-result.json"), JSON.stringify(artifacts))
}

doBuild(JSON.parse(process.argv[2]))
.catch(error => {
process.exitCode = 0
return writeFile(path.join(process.env.ELECTRON_BUILDER_TMP_DIR!!, "__build-result.json"), (error.stack || error).toString())
return writeFile(path.join(process.env.APP_BUILDER_TMP_DIR!!, "__build-result.json"), (error.stack || error).toString())
})

interface TargetInfo {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/targets/AppImageTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class AppImageTarget extends Target {
// https://github.com/electron-userland/electron-builder/issues/775
// https://github.com/electron-userland/electron-builder/issues/1726
// tslint:disable-next-line:no-invalid-template-strings
const artifactName = packager.expandArtifactNamePattern(options, "AppImage", arch, "${name}-${version}-${arch}.${ext}", false)
const artifactName = packager.expandArtifactBeautyNamePattern(options, "AppImage", arch)
const artifactPath = path.join(this.outDir, artifactName)
this.logBuilding("AppImage", artifactPath, arch)

Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/targets/AppxTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class AppXTarget extends Target {
// https://docs.microsoft.com/en-us/windows/uwp/packaging/create-app-package-with-makeappx-tool#mapping-files
async build(appOutDir: string, arch: Arch): Promise<any> {
const packager = this.packager
const artifactName = packager.expandArtifactNamePattern(this.options, "appx", arch)
const artifactName = packager.expandArtifactBeautyNamePattern(this.options, "appx", arch)
const artifactPath = path.join(this.outDir, artifactName)
this.logBuilding("AppX", artifactPath, arch)

Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/targets/MsiTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class MsiTarget extends Target {

async build(appOutDir: string, arch: Arch) {
const packager = this.packager
const artifactName = packager.expandArtifactNamePattern(this.options, "msi", arch)
const artifactName = packager.expandArtifactBeautyNamePattern(this.options, "msi", arch)
const artifactPath = path.join(this.outDir, artifactName)
this.logBuilding("MSI", artifactPath, arch)

Expand Down
1 change: 1 addition & 0 deletions packages/app-builder-lib/src/targets/pkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class PkgTarget extends Target {
const options = this.options
const appInfo = packager.appInfo

// pkg doesn't like not ASCII symbols (Could not open package to list files: /Volumes/test/t-gIjdGK/test-project-0/dist/Test App ßW-1.1.0.pkg)
const artifactName = packager.expandArtifactNamePattern(options, "pkg")
const artifactPath = path.join(this.outDir, artifactName)

Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"dependencies": {
"app-builder-bin": "2.5.1",
"temp-file": "^3.2.0",
"temp-file": "^3.3.2",
"fs-extra-p": "^7.0.0",
"is-ci": "^1.2.1",
"stat-mode": "^0.2.2",
Expand Down
4 changes: 3 additions & 1 deletion test/babel-jest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use strict"

const isCi = require("is-ci")

let babel
const crypto = require("crypto")
const fs = require("fs")
Expand Down Expand Up @@ -31,7 +33,7 @@ function createTransformer(options) {
.digest("hex")
},
process(src, filename, config, transformOptions) {
if (process.env.BABEL_JEST_SKIP === "true" || require("is-ci")) {
if (process.env.BABEL_JEST_SKIP === "true" || isCi) {
// precompiled on CI
return src
}
Expand Down
3 changes: 2 additions & 1 deletion test/out/__snapshots__/ExtraBuildTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand Down
3 changes: 2 additions & 1 deletion test/out/__snapshots__/PublishManagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand Down
3 changes: 2 additions & 1 deletion test/out/__snapshots__/configurationValidationTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand Down
3 changes: 2 additions & 1 deletion test/out/__snapshots__/protonTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "notepad-1.0.0-x86_64.AppImage",
"file": "notepad 1.0.0.AppImage",
"safeArtifactName": "notepad-1.0.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand Down
42 changes: 26 additions & 16 deletions test/out/linux/__snapshots__/linuxPackagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand All @@ -52,7 +53,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand All @@ -67,10 +69,10 @@ Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-x86_64.AppImage",
"url": "Test App ßW 1.1.0.AppImage",
},
],
"path": "TestApp-1.1.0-x86_64.AppImage",
"path": "Test App ßW 1.1.0.AppImage",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
Expand All @@ -85,7 +87,8 @@ Object {
"linux": Array [
Object {
"arch": "armv7l",
"file": "TestApp-1.1.0-armv7l.AppImage",
"file": "Test App ßW 1.1.0 armv7l.AppImage",
"safeArtifactName": "TestApp-1.1.0-armv7l.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand All @@ -100,10 +103,10 @@ Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-armv7l.AppImage",
"url": "Test App ßW 1.1.0 armv7l.AppImage",
},
],
"path": "TestApp-1.1.0-armv7l.AppImage",
"path": "Test App ßW 1.1.0 armv7l.AppImage",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
Expand All @@ -118,7 +121,8 @@ Object {
"linux": Array [
Object {
"arch": "ia32",
"file": "TestApp-1.1.0-i386.AppImage",
"file": "Test App ßW 1.1.0 i386.AppImage",
"safeArtifactName": "TestApp-1.1.0-i386.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand All @@ -133,10 +137,10 @@ Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-i386.AppImage",
"url": "Test App ßW 1.1.0 i386.AppImage",
},
],
"path": "TestApp-1.1.0-i386.AppImage",
"path": "Test App ßW 1.1.0 i386.AppImage",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
Expand All @@ -153,7 +157,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand All @@ -169,7 +174,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand All @@ -185,7 +191,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand All @@ -201,7 +208,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand All @@ -217,7 +225,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand All @@ -233,7 +242,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Expand Down
Loading

0 comments on commit 68e5573

Please sign in to comment.