Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron updates #295672

Merged
merged 7 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/development/tools/electron/binary/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ let
++ optionals (versionAtLeast version "11.0.0") [ "aarch64-darwin" ]
++ optionals (versionOlder version "19.0.0") [ "i686-linux" ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
knownVulnerabilities = optional (versionOlder version "26.0.0") "Electron version ${version} is EOL";
knownVulnerabilities = optional (versionOlder version "27.0.0") "Electron version ${version} is EOL";
};

fetcher = vers: tag: hash: fetchurl {
Expand Down
48 changes: 29 additions & 19 deletions pkgs/development/tools/electron/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ let
opts = removeAttrs dep ["fetcher"];
in pkgs.${dep.fetcher} opts;

fetchedDeps = lib.mapAttrs (name: fetchdep) info.deps;

in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
packageName = "electron";
inherit (info) version;
Expand All @@ -31,11 +33,11 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
buildInputs = base.buildInputs ++ [ libnotify ];

electronOfflineCache = fetchYarnDeps {
yarnLock = (fetchdep info.deps."src/electron") + "/yarn.lock";
yarnLock = fetchedDeps."src/electron" + "/yarn.lock";
sha256 = info.electron_yarn_hash;
};
npmDeps = fetchNpmDeps rec {
src = fetchdep info.deps."src";
src = fetchedDeps."src";
# Assume that the fetcher always unpack the source,
# based on update.py
sourceRoot = "${src.name}/third_party/node";
Expand All @@ -44,10 +46,11 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {

src = null;

patches = base.patches ++ lib.optional (lib.versionOlder info.version "27")
patches = base.patches ++ lib.optional (lib.versionAtLeast info.version "29")
(substituteAll {
name = "version.patch";
src = ./version.patch;
# disable a component that requires CIPD blobs
name = "disable-screen-ai.patch";
src = ./disable-screen-ai.patch;
inherit (info) version;
})
;
Expand All @@ -57,9 +60,9 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
'' + (
lib.concatStrings (lib.mapAttrsToList (path: dep: ''
mkdir -p ${builtins.dirOf path}
cp -r ${fetchdep dep}/. ${path}
cp -r ${dep}/. ${path}
chmod u+w -R ${path}
'') info.deps)
'') fetchedDeps)
) + ''
sourceRoot=src
runHook postUnpack
Expand Down Expand Up @@ -117,13 +120,14 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
cd ..
PATH=$PATH:${lib.makeBinPath (with pkgsBuildHost; [ jq git ])}
config=src/electron/patches/config.json
for key in $(jq -r "keys[]" $config)
for entry in $(cat $config | jq -c ".[]")
do
value=$(jq -r ".\"$key\"" $config)
for patch in $(cat $key/.patches)
patch_dir=$(echo $entry | jq -r ".patch_dir")
repo=$(echo $entry | jq -r ".repo")
for patch in $(cat $patch_dir/.patches)
do
echo applying in $value: $patch
git apply -p1 --directory=$value --exclude='src/third_party/blink/web_tests/*' $key/$patch
echo applying in $repo: $patch
git apply -p1 --directory=$repo --exclude='src/third_party/blink/web_tests/*' $patch_dir/$patch
done
done
)
Expand All @@ -150,7 +154,6 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
v8_promise_internal_field_count = 1;
v8_embedder_string = "-electron.0";
v8_enable_snapshot_native_code_counters = false;
v8_scriptormodule_legacy_lifetime = true;
v8_enable_javascript_promise_hooks = true;
enable_cdm_host_verification = false;
proprietary_codecs = true;
Expand All @@ -163,11 +166,18 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
enable_cet_shadow_stack = false;
is_cfi = false;
use_qt = false;

enable_widevine = false;
use_perfetto_client_library = false;
enable_check_raw_ptr_fields = false;
} // lib.optionalAttrs (lib.versionAtLeast info.version "27") {
v8_builtins_profiling_log_file = "";
enable_dangling_raw_ptr_checks = false;
} // lib.optionalAttrs (lib.versionAtLeast info.version "28") {
dawn_use_built_dxc = false;
v8_enable_private_mapping_fork_optimization = true;
} // lib.optionalAttrs (lib.versionAtLeast info.version "29") {
v8_expose_public_symbols = true;
} // {

# other
enable_widevine = false;
override_electron_version = info.version;
};

Expand All @@ -183,11 +193,11 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
requiredSystemFeatures = [ "big-parallel" ];

passthru = {
inherit info;
inherit info fetchedDeps;
headers = stdenv.mkDerivation rec {
name = "node-v${info.node}-headers.tar.gz";
nativeBuildInputs = [ python3 ];
src = fetchdep info.deps."src/third_party/electron_node";
src = fetchedDeps."src/third_party/electron_node";
buildPhase = ''
runHook preBuild
make tar-headers
Expand Down
16 changes: 16 additions & 0 deletions pkgs/development/tools/electron/disable-screen-ai.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -3114,13 +3114,6 @@ if (!is_android && !is_fuchsia) {
"//pdf/loader",
]

- if (is_linux) {
- # Add a data dependency for pdf_extension_accessibility_test.cc to
- # notify testing builders that this test needs this library, which will
- # need to be downloaded from CIPD as defined in //DEPS.
- data_deps += [ "//third_party/screen-ai:screen_ai_linux" ]
- }
-
if (enable_printing) {
sources += [ "../browser/pdf/pdf_extension_printing_test.cc" ]

Loading
Loading