From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <sattard@slack-corp.com>
Date: Thu, 27 May 2021 17:21:07 -0700
Subject: build: do not depend on packed_resource_integrity

This ensures we do not depend on a target that does not exist when
building Electron, electron generates its own .pak files via
electron_repack and therefore this integrity target which is generated
by the chrome_paks target does not exist.  This can not be upstreamed,
if we ever align our .pak file generation with Chrome we can remove this
patch.

diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index 884bccba58c66861b43b3b50a7535cba543302e2..82e7bf534aa6b998cee8df53be3ca7db450f38c0 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -202,11 +202,16 @@ if (!is_android && !is_mac) {
           "common/crash_keys.h",
         ]
 
+        if (!is_electron_build) {
+          deps = [
+            ":packed_resources_integrity",
+          ]
+        }
+
         deps += [
           ":chrome_dll",
           ":chrome_exe_version",
           ":copy_first_run",
-          ":packed_resources_integrity",
           ":visual_elements_resources",
           "//base",
           "//build:branding_buildflags",
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index c7ff5942d379b068f13c470677c83845b960858a..cd9fd963dc720f7394b656afe6ec032b10136d6b 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -4606,7 +4606,7 @@ static_library("browser") {
 
     # On Windows, the hashes are embedded in //chrome:chrome_initial rather
     # than here in :chrome_dll.
-    if (!is_win) {
+    if (!is_win && !is_electron_build) {
       deps += [ "//chrome:packed_resources_integrity" ]
       sources += [ "certificate_viewer_stub.cc" ]
     }
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 8d51f9ff0067aab05b4b31b9938575d9e84027be..c0c9d6a1da12d24bc61e4b5a3e26e6be02c4255f 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -6581,7 +6581,6 @@ test("unit_tests") {
 
     deps += [
       "//chrome:other_version",
-      "//chrome:packed_resources_integrity",
       "//chrome//services/util_win:unit_tests",
       "//chrome/app:chrome_dll_resources",
       "//chrome/app:win_unit_tests",
@@ -6607,6 +6606,10 @@ test("unit_tests") {
       "//ui/resources",
     ]
 
+    if (!is_electron_build) {
+      deps += [ "//chrome:packed_resources_integrity" ]
+    }
+
     ldflags = [
       "/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
       "/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
@@ -7531,7 +7534,6 @@ test("unit_tests") {
     }
 
     deps += [
-      "//chrome:packed_resources_integrity_hash",
       "//chrome/browser/apps:icon_standardizer",
       "//chrome/browser/apps/app_service",
       "//chrome/browser/apps/app_service:test_support",
@@ -7617,6 +7619,10 @@ test("unit_tests") {
       "//ui/webui/resources/js/browser_command:mojo_bindings",
     ]
 
+    if (!is_electron_build) {
+      deps += [ "//chrome:packed_resources_integrity_hash" ]
+    }
+
     data += [ "//ash/components/arc/test/data/icons/" ]
 
     if (include_js_tests) {
