enso/app/ide-desktop/lib/client/electron-builder-config.mjs
Michał Wawrzyniec Urbańczyk 6fc4947764
Bumped the build script (#3489)
* The bash entry point was renamed `run.sh` -> `run`. Thanks to that `./run` works both on Linux and Windows with PowerShell (sadly not on CMD). 
* Everyone's favorite checks for WASM size and program versions are back. These can be disabled through `--wasm-size-limit=0` and `--skip-version-check` respectively. WASM size limit is stored in `build-config.yaml`.
* Improved diagnostics for case when downloaded CI run artifact archive cannot be extracted. 
* Added GH API authentication to the build script calls on CI. This should fix the macOS build failures that were occurring from time to time. (Actually they were due to runner being GitHub-hosted, not really an OS-specific issue by itself.)
* If the GH API Personal Access Token is provided, it will be validated. Later on it is difficult to say, whether fail was caused by wrong PAT or other issue.
* Renamed `clean` to `git-clean` as per suggestion to reduce risk of user accidently deleting unstaged work. 
* Whitelisting dependabot from changelog checks, so PRs created by it are mergeable.
* Fixing issue where wasm-pack-action (third party) randomly failed to recognize the latest version of wasm-pack (macOS runners), leading to failed builds.
* Build logs can be filtered using `ENSO_BUILD_LOG` environment variable. See https://docs.rs/tracing-subscriber/0.3.11/tracing_subscriber/struct.EnvFilter.html#directives for the supported syntax.
* Improve help for ci-run source, to make clear that PAT token is required and what scope is expected there.

Also, JS parts were updated with some cleanups and fixes following the changes made when introducing the build script.
2022-06-01 13:44:40 +02:00

108 lines
4.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// This file cannot be made ES6 module due to: https://github.com/develar/read-config-file/issues/10
import path from 'node:path'
import fs from 'node:fs'
import { require_env } from '../../utils.mjs'
import { project_manager_bundle } from './paths.mjs'
import build from '../../build.json' assert { type: 'json' }
const dist = require_env('ENSO_BUILD_IDE')
const gui = require_env('ENSO_BUILD_GUI')
const icons = require_env('ENSO_BUILD_ICONS')
const project_manager = require_env('ENSO_BUILD_PROJECT_MANAGER')
const config = {
appId: 'org.enso',
productName: 'Enso',
extraMetadata: {
version: build.version,
},
copyright: 'Copyright © 2022 ${author}.',
artifactName: 'enso-${os}-${version}.${ext}',
mac: {
// We do not use compression as the build time is huge and file size saving is almost zero.
target: ['dmg'],
icon: `${icons}/icon.icns`,
category: 'public.app-category.developer-tools',
darkModeSupport: true,
type: 'distribution',
// The following settings are required for macOS signing and notarisation.
// The hardened runtime is required to be able to notarise the application.
hardenedRuntime: true,
// This is a custom check that is not working correctly, so we disable it. See for more
// details https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
gatekeeperAssess: false,
// Location of the entitlements files with the entitlements we need to run our application
// in the hardened runtime.
entitlements: './entitlements.mac.plist',
entitlementsInherit: './entitlements.mac.plist',
},
win: {
// We do not use compression as the build time is huge and file size saving is almost zero.
target: ['nsis'],
icon: `${icons}/icon.ico`,
},
linux: {
// We do not use compression as the build time is huge and file size saving is almost zero.
target: ['AppImage'],
icon: `${icons}/png`,
category: 'Development',
},
files: [
'!**/node_modules/**/*',
{ from: `${gui}/`, to: '.' },
{ from: `${dist}/client`, to: '.' },
],
extraResources: [
{
from: `${project_manager}/`,
to: project_manager_bundle,
filter: ['!**.tar.gz', '!**.zip'],
},
],
fileAssociations: [
{
ext: 'enso',
name: 'Enso Source File',
role: 'Editor',
},
],
directories: {
output: `${dist}`,
},
nsis: {
// Disables "block map" generation during electron building. Block maps
// can be used for incremental package update on client-side. However,
// their generation can take long time (even 30 mins), so we removed it
// for now. Moreover, we may probably never need them, as our updates
// are handled by us. More info:
// https://github.com/electron-userland/electron-builder/issues/2851
// https://github.com/electron-userland/electron-builder/issues/2900
differentialPackage: false,
},
dmg: {
// Disables "block map" generation during electron building. Block maps
// can be used for incremental package update on client-side. However,
// their generation can take long time (even 30 mins), so we removed it
// for now. Moreover, we may probably never need them, as our updates
// are handled by us. More info:
// https://github.com/electron-userland/electron-builder/issues/2851
// https://github.com/electron-userland/electron-builder/issues/2900
writeUpdateInfo: false,
// Disable code signing of the final dmg as this triggers an issue
// with Apples Gatekeeper. Since the DMG contains a signed and
// notarised application it will still be detected as trusted.
// For more details see step (4) at
// https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
sign: false,
},
afterAllArtifactBuild: path.join('tasks', 'computeHashes.cjs'),
// TODO [mwu]: Temporarily disabled, signing should be revised.
// In particular, engine should handle signing of its artifacts.
// afterPack: 'tasks/prepareToSign.js',
}
fs.writeFileSync('electron-builder-config.json', JSON.stringify(config, null, 2))