Skip to content

Commit

Permalink
fix: build command should accept arg --arm64
Browse files Browse the repository at this point in the history
Close #2801
  • Loading branch information
develar committed May 3, 2018
1 parent 8474d7d commit 4bcdcad
Show file tree
Hide file tree
Showing 20 changed files with 113 additions and 82 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- deps-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- v-1.8.4-electron
- v-2.0.0-electron
- run:
command: yarn --frozen-lockfile
- run:
Expand All @@ -23,7 +23,7 @@ jobs:
- run:
command: node ./test/out/helpers/downloadElectron.js
- save_cache:
key: v-1.8.4-electron
key: v-2.0.0-electron
paths:
- ~/.cache/electron

Expand All @@ -41,7 +41,7 @@ jobs:
- deps-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- v-1.8.4-electron
- v-2.0.0-electron
# because in the build job we use circleci docker image and circleci restores cache to original user home
- run:
command: |
Expand Down
4 changes: 2 additions & 2 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ RUN curl -L https://yarnpkg.com/latest.tar.gz | tar xvz && mv yarn-* /yarn && ln
# python for node-gyp
# rpm is required for FPM to build rpm package
# libsecret-1-0 and libgnome-keyring-dev are required even for prebuild keytar
# libgtk2.0-dev for snap desktop-gtk2 sudo (see https://github.com/ubuntu/snapcraft-desktop-helpers/blob/master/snapcraft.yaml#L248)
# sudo for snapcraft (install build packages)
apt-get -qq install --no-install-recommends git qtbase5-dev bsdtar build-essential autoconf libssl-dev gcc-multilib g++-multilib lzip rpm python libcurl3 git git-lfs ssh unzip \
libsecret-1-dev libgnome-keyring-dev \
libopenjp2-tools \
libgtk2.0-dev && \
# for snap desktop-gtk3 sudo (see https://github.com/ubuntu/snapcraft-desktop-helpers/blob/master/snapcraft.yaml#L189)
libxkbcommon0 ttf-ubuntu-font-family dmz-cursor-theme light-themes adwaita-icon-theme gnome-themes-standard shared-mime-info libgtk-3-0 libgdk-pixbuf2.0-0 libglib2.0-bin libgtk-3-bin unity-gtk3-module libappindicator3-1 locales-all xdg-user-dirs ibus-gtk3 libibus-1.0-5 && \
# git-lfs
git lfs install && \
# snap
Expand Down
8 changes: 3 additions & 5 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/usr/bin/env bash
set -e

docker build -t electronuserland/builder:base -t electronuserland/builder:base-03.18 docker/base
docker build -t electronuserland/builder:base -t electronuserland/builder:base-05.18 docker/base

docker build -t electronuserland/builder:9 -t electronuserland/builder:latest -t electronuserland/builder:9-03.18 docker/9
docker build -t electronuserland/builder:10 -t electronuserland/builder:latest -t electronuserland/builder:10-05.18 docker/10

docker build -t electronuserland/builder:wine docker/wine
docker build -t electronuserland/builder:wine-mono docker/wine-mono
docker build -t electronuserland/builder:wine-chrome docker/wine-chrome

docker build -t electronuserland/snapcraft-electron:2 docker/snapcraft-electron2
docker build -t electronuserland/builder:wine-chrome docker/wine-chrome
5 changes: 0 additions & 5 deletions docker/snapcraft-electron2/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion packages/builder-util/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export { TmpDir } from "temp-file"
export { log, debug } from "./log"
export { isMacOsSierra, isCanSignDmg } from "./macosVersion"
export { execWine, prepareWindowsExecutableArgs } from "./wine"
export { Arch, toLinuxArchString, getArchSuffix, ArchType, archFromString } from "./arch"
export { Arch, getArchCliNames, toLinuxArchString, getArchSuffix, ArchType, archFromString } from "./arch"
export { AsyncTaskManager } from "./asyncTaskManager"
export { DebugLogger } from "./DebugLogger"

Expand Down
13 changes: 11 additions & 2 deletions packages/electron-builder/src/builder.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { addValue, Arch, archFromString, InvalidConfigurationError, log, deepAssign } from "builder-util"
import { addValue, Arch, archFromString, InvalidConfigurationError, log, deepAssign, getArchCliNames } from "builder-util"
import chalk from "chalk"
import { Packager, build as _build, Configuration, DIR_TARGET, PackagerOptions, Platform } from "electron-builder-lib"
import { PublishOptions } from "electron-publish"
import BluebirdPromise from "bluebird-lst"
import { getArchCliNames } from "builder-util/out/arch"

/** @internal */
export interface BuildOptions extends PackagerOptions, PublishOptions {
Expand All @@ -15,6 +14,7 @@ export interface CliOptions extends PackagerOptions, PublishOptions {
x64?: boolean
ia32?: boolean
armv7l?: boolean
arm64?: boolean

dir?: boolean

Expand Down Expand Up @@ -50,6 +50,9 @@ export function normalizeOptions(args: CliOptions): BuildOptions {
if (args.armv7l) {
result.push(Arch.armv7l)
}
if (args.arm64) {
result.push(Arch.arm64)
}
if (args.ia32) {
result.push(Arch.ia32)
}
Expand Down Expand Up @@ -138,6 +141,7 @@ export function normalizeOptions(args: CliOptions): BuildOptions {
delete result.ia32
delete result.x64
delete result.armv7l
delete result.arm64

let config = result.config

Expand Down Expand Up @@ -273,6 +277,11 @@ export function configureBuildCommand(yargs: yargs.Yargs): yargs.Yargs {
description: "Build for armv7l",
type: "boolean",
})
.option("arm64", {
group: buildGroup,
description: "Build for arm64",
type: "boolean",
})
.option("dir", {
group: buildGroup,
description: "Build unpacked dir. Useful to test.",
Expand Down
3 changes: 1 addition & 2 deletions packages/electron-builder/src/cli/install-app-deps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env node

import { log, use, } from "builder-util"
import { log, use, getArchCliNames } from "builder-util"
import { printErrorAndExit } from "builder-util/out/promise"
import { computeDefaultAppDirectory, getConfig } from "electron-builder-lib/out/util/config"
import { getElectronVersion } from "electron-builder-lib/out/electron/electronVersion"
Expand All @@ -11,7 +11,6 @@ import { Lazy } from "lazy-val"
import * as path from "path"
import { orNullIfFileNotExist } from "read-config-file"
import yargs from "yargs"
import { getArchCliNames } from "builder-util/out/arch"

declare const PACKAGE_VERSION: string

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/test-app-build-sub/electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
electronVersion: 1.8.4
electronVersion: 2.0.0
appId: org.electron-builder.testApp
compression: store
npmRebuild: false
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/test-app-one/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"author": "Foo Bar <[email protected]>",
"license": "MIT",
"build": {
"electronVersion": "1.8.4",
"electronVersion": "2.0.0",
"appId": "org.electron-builder.testApp",
"compression": "store",
"npmRebuild": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "Foo Bar <[email protected]>",
"license": "MIT",
"build": {
"electronVersion": "1.8.4",
"electronVersion": "2.0.0",
"appId": "org.electron-builder.testApp",
"compression": "store",
"npmRebuild": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "Foo Bar <[email protected]>",
"license": "MIT",
"build": {
"electronVersion": "1.8.4",
"electronVersion": "2.0.0",
"appId": "org.electron-builder.testApp",
"compression": "store",
"npmRebuild": false,
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/test-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"build": {
"electronVersion": "1.8.4",
"electronVersion": "2.0.0",
"appId": "org.electron-builder.testApp",
"compression": "store",
"npmRebuild": false,
Expand Down
81 changes: 81 additions & 0 deletions test/out/linux/__snapshots__/debTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
exports[`arm 1`] = `
Object {
"linux": Array [
Object {
"arch": "arm64",
"file": "TestApp_1.1.0_arm64.deb",
},
Object {
"arch": "armv7l",
"file": "TestApp_1.1.0_armv7l.deb",
Expand Down Expand Up @@ -88,6 +92,83 @@ Object {

exports[`arm 4`] = `"Test Application (test quite “ #378)"`;

exports[`arm 5`] = `
Array [
"/",
"/opt/",
"/usr/",
"/opt/Test App ßW/",
"/opt/Test App ßW/blink_image_resources_200_percent.pak",
"/opt/Test App ßW/content_resources_200_percent.pak",
"/opt/Test App ßW/content_shell.pak",
"/opt/Test App ßW/icudtl.dat",
"/opt/Test App ßW/libffmpeg.so",
"/opt/Test App ßW/libnode.so",
"/opt/Test App ßW/LICENSE.electron.txt",
"/opt/Test App ßW/LICENSES.chromium.html",
"/opt/Test App ßW/natives_blob.bin",
"/opt/Test App ßW/pdf_viewer_resources.pak",
"/opt/Test App ßW/snapshot_blob.bin",
"/opt/Test App ßW/testapp",
"/opt/Test App ßW/ui_resources_200_percent.pak",
"/opt/Test App ßW/views_resources_200_percent.pak",
"/usr/share/",
"/opt/Test App ßW/resources/",
"/opt/Test App ßW/resources/app.asar",
"/opt/Test App ßW/resources/electron.asar",
"/usr/share/applications/",
"/usr/share/applications/testapp.desktop",
"/usr/share/doc/",
"/usr/share/icons/",
"/usr/share/doc/testapp/",
"/usr/share/doc/testapp/changelog.gz",
"/usr/share/icons/hicolor/",
"/usr/share/icons/hicolor/128x128/",
"/usr/share/icons/hicolor/16x16/",
"/usr/share/icons/hicolor/24x24/",
"/usr/share/icons/hicolor/256x256/",
"/usr/share/icons/hicolor/32x32/",
"/usr/share/icons/hicolor/48x48/",
"/usr/share/icons/hicolor/512x512/",
"/usr/share/icons/hicolor/64x64/",
"/usr/share/icons/hicolor/96x96/",
"/usr/share/icons/hicolor/128x128/apps/",
"/usr/share/icons/hicolor/128x128/apps/testapp.png",
"/usr/share/icons/hicolor/16x16/apps/",
"/usr/share/icons/hicolor/16x16/apps/testapp.png",
"/usr/share/icons/hicolor/24x24/apps/",
"/usr/share/icons/hicolor/24x24/apps/testapp.png",
"/usr/share/icons/hicolor/256x256/apps/",
"/usr/share/icons/hicolor/256x256/apps/testapp.png",
"/usr/share/icons/hicolor/32x32/apps/",
"/usr/share/icons/hicolor/32x32/apps/testapp.png",
"/usr/share/icons/hicolor/48x48/apps/",
"/usr/share/icons/hicolor/48x48/apps/testapp.png",
"/usr/share/icons/hicolor/512x512/apps/",
"/usr/share/icons/hicolor/512x512/apps/testapp.png",
"/usr/share/icons/hicolor/64x64/apps/",
"/usr/share/icons/hicolor/64x64/apps/testapp.png",
"/usr/share/icons/hicolor/96x96/apps/",
"/usr/share/icons/hicolor/96x96/apps/testapp.png",
]
`;

exports[`arm 6`] = `
Object {
"Architecture": "armv7l",
"Depends": "gconf2, gconf-service, libnotify4, libappindicator1, libxtst6, libnss3, libxss1",
"Homepage": "http://foo.example.com",
"License": "MIT",
"Maintainer": "Foo Bar <[email protected]>",
"Package": "testapp",
"Priority": "extra",
"Section": "devel",
"Vendor": "Foo Bar <[email protected]>",
}
`;

exports[`arm 7`] = `"Test Application (test quite “ #378)"`;

exports[`custom depends 1`] = `
"[Desktop Entry]
Name=Test App ßW
Expand Down
22 changes: 0 additions & 22 deletions test/out/linux/__snapshots__/snapTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -721,17 +721,6 @@ Object {
}
`;
exports[`snap electron 2 1`] = `
Object {
"linux": Array [
Object {
"arch": "x64",
"file": "sep-electron2_v1.1.0.snap",
},
],
}
`;
exports[`snap full 1`] = `
Object {
"linux": Array [
Expand All @@ -742,14 +731,3 @@ Object {
],
}
`;
exports[`snap full electron 2 1`] = `
Object {
"linux": Array [
Object {
"arch": "x64",
"file": "se-electron2_1.1.0_amd64.snap",
},
],
}
`;
2 changes: 0 additions & 2 deletions test/out/mac/__snapshots__/macPackagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ Object {
"CFBundleShortVersionString": "1.1.0",
"DTSDKBuild": "14D125",
"DTSDKName": "macosx10.1010.10",
"DTXcode": "0821",
"DTXcodeBuild": "8C1002",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.12.0",
"LSUIElement": true,
Expand Down
2 changes: 1 addition & 1 deletion test/src/helpers/downloadElectron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function downloadAllRequiredElectronVersions(): Promise<any> {

const versions: Array<any> = []
for (const platform of platforms) {
const archs = (platform === "mas" || platform === "darwin") ? ["x64"] : (platform === "win32" ? ["ia32", "x64"] : ["ia32", "x64", "armv7l"])
const archs = (platform === "mas" || platform === "darwin") ? ["x64"] : (platform === "win32" ? ["ia32", "x64"] : require(`${path.join(__dirname, "../../..")}/packages/builder-util/out/util`).getArchCliNames())
for (const arch of archs) {
versions.push({
version: ELECTRON_VERSION,
Expand Down
2 changes: 1 addition & 1 deletion test/src/helpers/testConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
docker: Error response from daemon: Mounts denied: o Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
*/
export const ELECTRON_VERSION = "1.8.4"
export const ELECTRON_VERSION = "2.0.0"
2 changes: 1 addition & 1 deletion test/src/linux/debTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test.ifNotWindows("deb", app({
targets: Platform.LINUX.createTarget("deb"),
}))

test.ifNotWindows("arm", app({targets: Platform.LINUX.createTarget("deb", Arch.armv7l)}))
test.ifNotWindows("arm", app({targets: Platform.LINUX.createTarget("deb", Arch.armv7l, Arch.arm64)}))

test.ifNotWindows("custom depends", app({
targets: Platform.LINUX.createTarget("deb"),
Expand Down
31 changes: 1 addition & 30 deletions test/src/linux/snapTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,8 @@ test.ifAll.ifDevOrLinuxCi("snap", app({
},
}))

test.ifAll.ifDevOrLinuxCi("snap electron 2", app({
targets: snapTarget,
config: {
extraMetadata: {
name: "sep-electron2",
},
linux: {
//tslint:disable-next-line:no-invalid-template-strings
artifactName: "${name}_v${version}.${ext}",
},
productName: "Sep Electron 2",
electronVersion: "2.0.0-beta.7",
},
}))

// very slow
test.skip("snap full", app({
test("snap full", app({
targets: snapTarget,
config: {
extraMetadata: {
Expand All @@ -48,20 +33,6 @@ test.skip("snap full", app({
},
}))

test.skip("snap full electron 2", app({
targets: snapTarget,
config: {
extraMetadata: {
name: "se-electron2",
},
electronVersion: "2.0.0-beta.7",
productName: "Snap Electron 2 App (full build)",
snap: {
useTemplateApp: false,
},
},
}))

test.ifAll.ifDevOrLinuxCi("default stagePackages", async () => {
for (const p of [["default"], ["default", "custom"], ["custom", "default"], ["foo1", "default", "foo2"]]) {
await assertPack("test-app-one", {
Expand Down
2 changes: 2 additions & 0 deletions test/src/mac/macPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ test.ifMac("one-package", app({
copyOrLinkFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "someFoo.icns")),
]),
checkMacApp: async (appDir, info) => {
delete info.DTXcode
delete info.DTXcodeBuild
expect(info).toMatchSnapshot()
await assertThat(path.join(appDir, "Contents", "Resources", "foo.icns")).isFile()
await assertThat(path.join(appDir, "Contents", "Resources", "someFoo.icns")).isFile()
Expand Down

0 comments on commit 4bcdcad

Please sign in to comment.