Bump electron-builder (#9884)

Now that #9815 has landed, we can finally bump electron-builder to the latest release. As this brings in python3 support out-of-the-box, workaround of the runtime-bump on macOS runners can be removed.
This commit is contained in:
Michał Wawrzyniec Urbańczyk 2024-05-08 15:20:48 +02:00 committed by GitHub
parent 78eb7f3efc
commit e859be7fe1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 1149 additions and 1397 deletions

View File

@ -410,12 +410,6 @@ jobs:
run: ./run git-clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: NPM install
run: npm install
- name: Uninstall old Electron Builder
run: npm uninstall --save --workspace enso electron-builder
- name: Install new Electron Builder
run: npm install --save-dev --workspace enso electron-builder@24.6.4
- run: ./run ide build --backend-source current-ci-run --gui-upload-artifact false
env:
APPLEID: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}

View File

@ -443,12 +443,6 @@ jobs:
run: ./run git-clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: NPM install
run: npm install
- name: Uninstall old Electron Builder
run: npm uninstall --save --workspace enso electron-builder
- name: Install new Electron Builder
run: npm install --save-dev --workspace enso electron-builder@24.6.4
- run: ./run ide upload --backend-source release --backend-release ${{env.ENSO_RELEASE_ID}}
env:
APPLEID: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
@ -517,12 +511,6 @@ jobs:
run: ./run git-clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: NPM install
run: npm install
- name: Uninstall old Electron Builder
run: npm uninstall --save --workspace enso electron-builder
- name: Install new Electron Builder
run: npm install --save-dev --workspace enso electron-builder@24.6.4
- run: ./run ide upload --backend-source release --backend-release ${{env.ENSO_RELEASE_ID}}
env:
APPLEID: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}

View File

@ -30,14 +30,11 @@
"tar": "^6.1.13",
"yargs": "17.6.2"
},
"comments": {
"electron-builder": "Cannot be updated to a newer version because of a NSIS installer issue: https://github.com/enso-org/enso/issues/5169"
},
"devDependencies": {
"@electron/notarize": "2.1.0",
"@types/node": "^20.10.5",
"electron": "25.7.0",
"electron-builder": "^22.14.13",
"electron-builder": "^24.13.3",
"enso-common": "^1.0.0",
"esbuild": "^0.19.3",
"fast-glob": "^3.2.12",

View File

@ -27,15 +27,6 @@ use ide_ci::cache::goodie::graalvm;
/// This should be kept as recent as possible.
///
/// macOS must use a recent version of Electron Builder to have Python 3 support. Otherwise, build
/// would fail due to Python 2 missing.
///
/// We keep old versions of Electron Builder for Windows to avoid NSIS installer bug:
/// https://github.com/electron-userland/electron-builder/issues/6865
const ELECTRON_BUILDER_MACOS_VERSION: Version = Version::new(24, 6, 4);
/// Target runners set (or just a single runner) for a job.
pub trait RunsOn: 'static + Debug {
/// A strategy that will be used for the job.
@ -398,40 +389,15 @@ pub fn expose_os_specific_signing_secret(os: OS, step: Step) -> Step {
}
}
/// The sequence of steps that bumps the version of the Electron-Builder to
/// [`ELECTRON_BUILDER_MACOS_VERSION`].
pub fn bump_electron_builder() -> Vec<Step> {
let npm_install =
Step { name: Some("NPM install".into()), run: Some("npm install".into()), ..default() };
let uninstall_old = Step {
name: Some("Uninstall old Electron Builder".into()),
run: Some("npm uninstall --save --workspace enso electron-builder".into()),
..default()
};
let command = format!(
"npm install --save-dev --workspace enso electron-builder@{ELECTRON_BUILDER_MACOS_VERSION}"
);
let install_new =
Step { name: Some("Install new Electron Builder".into()), run: Some(command), ..default() };
vec![npm_install, uninstall_old, install_new]
}
/// Prepares the packaging steps for the given OS.
///
/// This involves:
/// * exposing secrets necessary for code signing and notarization;
/// * exposing variables defining cloud environment for dashboard;
/// * (macOS only) bumping the version of the Electron Builder to
/// [`ELECTRON_BUILDER_MACOS_VERSION`].
/// * exposing variables defining cloud environment for dashboard.
pub fn prepare_packaging_steps(os: OS, step: Step) -> Vec<Step> {
let step = expose_gui_vars(step);
let step = expose_os_specific_signing_secret(os, step);
let mut steps = Vec::new();
if os == OS::MacOS {
steps.extend(bump_electron_builder());
}
steps.push(step);
steps
vec![step]
}
/// Convenience for [`prepare_packaging_steps`].

View File

@ -319,24 +319,6 @@ impl IdeDesktop {
let icons_build = self.build_icons(&icons_dist);
let icons = icons_build.await?;
let python_path = if TARGET_OS == OS::MacOS && !env::PYTHON_PATH.is_set() {
// On macOS electron-builder will fail during DMG creation if there is no python2
// installed. It is looked for in `/usr/bin/python` which is not valid place on newer
// MacOS versions.
// We can work around this by setting the `PYTHON_PATH` env variable. We attempt to
// locate `python2` in PATH which is enough to work on GitHub-hosted macOS
// runners.
ide_ci::program::lookup("python2")
.inspect_err(|e| {
// We do not fail, as this requirement might have been lifted by the
// electron-builder bump. As for now, we do best effort to support both cases.
warn!("Failed to locate python2 in PATH: {e}");
})
.ok()
} else {
None
};
let target_args = match target {
Some(target) => vec!["--target".to_string(), target],
None => vec![],
@ -348,7 +330,6 @@ impl IdeDesktop {
.set_env(env::ENSO_BUILD_GUI, gui.as_ref())?
.set_env(env::ENSO_BUILD_IDE, output_path)?
.set_env(env::ENSO_BUILD_PROJECT_MANAGER, project_manager.as_ref())?
.set_env_opt(env::PYTHON_PATH, python_path.as_ref())?
.set_env(enso_install_config::ENSO_BUILD_ELECTRON_BUILDER_CONFIG, &electron_config)?
.workspace(Workspaces::Enso)
// .args(["--loglevel", "verbose"])

View File

@ -38,9 +38,6 @@ define_env_var! {
/// appropriate identity from your keychain will be automatically used.
CSC_IDENTITY_AUTO_DISCOVERY, bool;
/// Path to the python2 executable, used by electron-builder on macOS to package DMG.
PYTHON_PATH, PathBuf;
/// Note that enabling CSC_FOR_PULL_REQUEST can pose serious security risks. Refer to the
/// [CircleCI documentation](https://circleci.com/docs/1.0/fork-pr-builds/) for more
/// information. If the project settings contain SSH keys, sensitive environment variables,

View File

@ -191,17 +191,6 @@ helper tools for that. We recommend:
**For users of M1 Mac**: installing GraalVM on M1 Mac requires manual actions,
please refer to a [dedicated documentation](./graalvm-m1-mac.md).
**For users of MacOS Monterey and later**: building desktop IDE currently
requires Python 2 installed in the system. It can be installed using the
following commands:
```sh
brew install pyenv
pyenv install 2.7.18
pyenv global 2.7.18
export PYTHON_PATH=$(pyenv root)/shims/python
```
### Getting the Sources
Given you've probably been reading this document on GitHub, you might have an
@ -398,22 +387,22 @@ Internally, most of the developers working on the Enso project use IntelliJ as
their primary IDE. To that end, what follows is a basic set of instructions for
getting the project into a working state in IntelliJ.
1. Clone the project sources.
2. Open IntelliJ
3. File -> New -> Project From Existing Sources.
4. Navigate to the directory into which you cloned the project sources. By
default this will be called `enso`. Select the directory, and not the
`build.sbt` file it contains.
5. In the 'Import Project' dialogue, select 'Import project from external
model' and choose 'sbt'.
6. Where it says 'Download:', ensure you check both 'Library Sources' and 'sbt
sources'.
7. In addition, check the boxes next to 'Use sbt shell:' such that it is used
both 'for imports' and 'for builds'.
8. Disallow the overriding of the sbt version.
9. Under the 'Project JDK' setting, please ensure that it is set up to use a
GraalVM version as described in [System requirements](#system-requirements).
You may need to add it using the 'New' button if it isn't already set up.
1. Clone the project sources.
2. Open IntelliJ
3. File -> New -> Project From Existing Sources.
4. Navigate to the directory into which you cloned the project sources. By
default this will be called `enso`. Select the directory, and not the
`build.sbt` file it contains.
5. In the 'Import Project' dialogue, select 'Import project from external model'
and choose 'sbt'.
6. Where it says 'Download:', ensure you check both 'Library Sources' and 'sbt
sources'.
7. In addition, check the boxes next to 'Use sbt shell:' such that it is used
both 'for imports' and 'for builds'.
8. Disallow the overriding of the sbt version.
9. Under the 'Project JDK' setting, please ensure that it is set up to use a
GraalVM version as described in [System requirements](#system-requirements).
You may need to add it using the 'New' button if it isn't already set up.
10. Click 'Finish'. This will prompt you as to whether you want to overwrite the
`project` folder. Select 'Yes' to continue. The Enso project will load up
with an open SBT shell, which can be interacted with as described above. You

2420
package-lock.json generated

File diff suppressed because it is too large Load Diff