Skip to content

Commit ff8a436

Browse files
committed
fix(linux): report "Building ..."
1 parent 9edadb5 commit ff8a436

File tree

6 files changed

+36
-22
lines changed

6 files changed

+36
-22
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"path-sort": "^0.1.0",
115115
"ts-babel": "^1.1.4",
116116
"tslint": "^4.0.0-dev.1",
117-
"typescript": "^2.1.0-dev.20161101",
117+
"typescript": "^2.1.1",
118118
"validate-commit-msg": "^2.8.2",
119119
"whitespace": "^2.1.0"
120120
},

src/linuxPackager.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,24 @@ export class LinuxPackager extends PlatformPackager<LinuxBuildOptions> {
7575

7676
protected async packageInDistributableFormat(outDir: string, appOutDir: string, arch: Arch, targets: Array<Target>): Promise<any> {
7777
// todo fix fpm - if run in parallel, get strange tar errors
78+
// https://github.com/electron-userland/electron-builder/issues/460
79+
// for some reasons in parallel to fmp we cannot use tar
7880
for (let t of targets) {
79-
if (t instanceof TargetEx) {
81+
if (t instanceof TargetEx && !t.isAsyncSupported) {
8082
await t.build(appOutDir, arch)
8183
}
8284
}
8385

84-
const promises: Array<Promise<any>> = []
85-
// https://github.com/electron-userland/electron-builder/issues/460
86-
// for some reasons in parallel to fmp we cannot use tar
87-
for (let t of targets) {
88-
const target = t.name
86+
await BluebirdPromise.map(targets, it => {
87+
const target = it.name
8988
if (target === "zip" || target === "7z" || target.startsWith("tar.")) {
9089
const destination = path.join(outDir, this.generateName(target, arch, true))
91-
promises.push(this.archiveApp(target, appOutDir, destination)
92-
.then(() => this.dispatchArtifactCreated(destination)))
90+
return this.archiveApp(target, appOutDir, destination)
91+
.then(() => this.dispatchArtifactCreated(destination))
9392
}
94-
}
95-
96-
if (promises.length > 0) {
97-
await BluebirdPromise.all(promises)
98-
}
93+
else {
94+
return it instanceof TargetEx && it.isAsyncSupported ? it.build(appOutDir, arch) : null
95+
}
96+
})
9997
}
10098
}

src/platformPackager.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ export class Target {
8585
}
8686

8787
export abstract class TargetEx extends Target {
88+
constructor(name: string, public readonly isAsyncSupported: boolean = true) {
89+
super(name)
90+
}
91+
8892
abstract build(appOutDir: string, arch: Arch): Promise<any>
8993
}
9094

@@ -203,10 +207,12 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
203207
else {
204208
defaultMatcher.addPattern("package.json")
205209
}
206-
defaultMatcher.addPattern("!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme,test,__tests__,tests,powered-test,example,examples,*.d.ts}")
210+
defaultMatcher.addPattern("!**/node_modules/*/{CHANGELOG.md,ChangeLog,changelog.md,README.md,README,readme.md,readme,test,__tests__,tests,powered-test,example,examples,*.d.ts}")
207211
defaultMatcher.addPattern("!**/node_modules/.bin")
208212
defaultMatcher.addPattern("!**/*.{o,hprof,orig,pyc,pyo,rbc,swp}")
209213
defaultMatcher.addPattern("!**/._*")
214+
defaultMatcher.addPattern("!.idea")
215+
defaultMatcher.addPattern("!*.iml")
210216
//noinspection SpellCheckingInspection
211217
defaultMatcher.addPattern("!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,__pycache__,thumbs.db,.gitignore,.gitattributes,.editorconfig,.flowconfig,.yarn-metadata.json,.idea,appveyor.yml,.travis.yml,circle.yml,npm-debug.log,.nyc_output,yarn.lock,.yarn-integrity}")
212218

@@ -322,19 +328,22 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
322328
}
323329

324330
private getFileMatchers(name: "files" | "extraFiles" | "extraResources", defaultSrc: string, defaultDest: string, allowAdvancedMatching: boolean, fileMatchOptions: FileMatchOptions, customBuildOptions: DC): Array<FileMatcher> | n {
325-
let globalPatterns: Array<string | FilePattern> | string | n = (<any>this.devMetadata.build)[name]
331+
let globalPatterns: Array<string | FilePattern> | string | n | FilePattern = (<any>this.devMetadata.build)[name]
326332
let platformSpecificPatterns: Array<string | FilePattern> | string | n = (<any>customBuildOptions)[name]
327333

328334
const defaultMatcher = new FileMatcher(defaultSrc, defaultDest, fileMatchOptions)
329335
const fileMatchers: Array<FileMatcher> = []
330336

331-
function addPatterns(patterns: Array<string | FilePattern> | string | n) {
337+
function addPatterns(patterns: Array<string | FilePattern> | string | n | FilePattern) {
332338
if (patterns == null) {
333339
return
334340
}
335341
else if (!Array.isArray(patterns)) {
336-
defaultMatcher.addPattern(patterns)
337-
return
342+
if (typeof patterns === "string") {
343+
defaultMatcher.addPattern(patterns)
344+
return
345+
}
346+
patterns = [patterns]
338347
}
339348

340349
for (let i = 0; i < patterns.length; i++) {

src/targets/appImage.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { getBin } from "../util/binDownload"
88
import BluebirdPromise from "bluebird-lst-c"
99
import { v1 as uuid1 } from "uuid-1345"
1010
import { LinuxPackager } from "../linuxPackager"
11+
import { log } from "../util/log"
1112

1213
const appImageVersion = process.platform === "darwin" ? "AppImage-09-07-16-mac" : "AppImage-09-07-16-linux"
1314
//noinspection SpellCheckingInspection
@@ -31,6 +32,8 @@ export default class AppImageTarget extends TargetEx {
3132
}
3233

3334
async build(appOutDir: string, arch: Arch): Promise<any> {
35+
log(`Building AppImage`)
36+
3437
const packager = this.packager
3538

3639
// avoid spaces in the file name

src/targets/fpm.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { LinuxTargetHelper, installPrefix } from "./LinuxTargetHelper"
99
import * as errorMessages from "../errorMessages"
1010
import { TmpDir } from "../util/tmp"
1111
import { LinuxPackager } from "../linuxPackager"
12+
import { log } from "../util/log"
1213

1314
const template = require("lodash.template")
1415

@@ -64,6 +65,9 @@ export default class FpmTarget extends TargetEx {
6465

6566
async build(appOutDir: string, arch: Arch): Promise<any> {
6667
const target = this.name
68+
69+
log(`Building ${target}`)
70+
6771
const destination = path.join(this.outDir, this.packager.generateName(target, arch, true /* on Linux we use safe name — without space */))
6872

6973
const scripts = await this.scriptFiles

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,8 +2081,8 @@ glob@~5.0.0:
20812081
path-is-absolute "^1.0.0"
20822082

20832083
globals@^9.0.0:
2084-
version "9.12.0"
2085-
resolved "https://registry.yarnpkg.com/globals/-/globals-9.12.0.tgz#992ce90828c3a55fa8f16fada177adb64664cf9d"
2084+
version "9.13.0"
2085+
resolved "https://registry.yarnpkg.com/globals/-/globals-9.13.0.tgz#d97706b61600d8dbe94708c367d3fdcf48470b8f"
20862086

20872087
globby@^6.0.0:
20882088
version "6.1.0"
@@ -3986,7 +3986,7 @@ typedarray@~0.0.5:
39863986
version "0.0.6"
39873987
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
39883988

3989-
typescript@^2.1.0-dev.20161101:
3989+
typescript@^2.1.1:
39903990
version "2.1.1"
39913991
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.1.tgz#41c2b64472f529331b2055c0424862b44ce58d42"
39923992

0 commit comments

Comments
 (0)