BUILD.gn 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375
  1. import("//build/config/locales.gni")
  2. import("//build/config/ui.gni")
  3. import("//build/config/win/manifest.gni")
  4. import("//components/spellcheck/spellcheck_build_features.gni")
  5. import("//content/public/app/mac_helpers.gni")
  6. import("//extensions/buildflags/buildflags.gni")
  7. import("//pdf/features.gni")
  8. import("//ppapi/buildflags/buildflags.gni")
  9. import("//printing/buildflags/buildflags.gni")
  10. import("//testing/test.gni")
  11. import("//third_party/ffmpeg/ffmpeg_options.gni")
  12. import("//tools/generate_library_loader/generate_library_loader.gni")
  13. import("//tools/grit/grit_rule.gni")
  14. import("//tools/grit/repack.gni")
  15. import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
  16. import("//v8/gni/snapshot_toolchain.gni")
  17. import("build/asar.gni")
  18. import("build/extract_symbols.gni")
  19. import("build/npm.gni")
  20. import("build/templated_file.gni")
  21. import("build/tsc.gni")
  22. import("build/webpack/webpack.gni")
  23. import("buildflags/buildflags.gni")
  24. import("electron_paks.gni")
  25. import("filenames.auto.gni")
  26. import("filenames.gni")
  27. import("filenames.hunspell.gni")
  28. if (is_mac) {
  29. import("//build/config/mac/rules.gni")
  30. import("//third_party/icu/config.gni")
  31. import("//ui/gl/features.gni")
  32. import("//v8/gni/v8.gni")
  33. import("build/rules.gni")
  34. }
  35. if (is_linux) {
  36. import("//build/config/linux/pkg_config.gni")
  37. pkg_config("gio_unix") {
  38. packages = [ "gio-unix-2.0" ]
  39. }
  40. pkg_config("libnotify_config") {
  41. packages = [
  42. "glib-2.0",
  43. "gdk-pixbuf-2.0",
  44. ]
  45. }
  46. }
  47. declare_args() {
  48. use_prebuilt_v8_context_snapshot = false
  49. }
  50. branding = read_file("shell/app/BRANDING.json", "json")
  51. electron_project_name = branding.project_name
  52. electron_product_name = branding.product_name
  53. electron_mac_bundle_id = branding.mac_bundle_id
  54. if (is_mas_build) {
  55. assert(is_mac,
  56. "It doesn't make sense to build a MAS build on a non-mac platform")
  57. }
  58. if (enable_pdf_viewer) {
  59. assert(enable_pdf, "PDF viewer support requires enable_pdf=true")
  60. assert(enable_electron_extensions,
  61. "PDF viewer support requires enable_electron_extensions=true")
  62. }
  63. if (enable_electron_extensions) {
  64. assert(enable_extensions,
  65. "Chrome extension support requires enable_extensions=true")
  66. }
  67. config("branding") {
  68. defines = [
  69. "ELECTRON_PRODUCT_NAME=\"$electron_product_name\"",
  70. "ELECTRON_PROJECT_NAME=\"$electron_project_name\"",
  71. ]
  72. }
  73. config("electron_lib_config") {
  74. include_dirs = [ "." ]
  75. }
  76. # We geneate the definitions twice here, once in //electron/electron.d.ts
  77. # and once in $target_gen_dir
  78. # The one in $target_gen_dir is used for the actual TSC build later one
  79. # and the one in //electron/electron.d.ts is used by your IDE (vscode)
  80. # for typescript prompting
  81. npm_action("build_electron_definitions") {
  82. script = "gn-typescript-definitions"
  83. args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
  84. inputs = auto_filenames.api_docs + [ "yarn.lock" ]
  85. outputs = [ "$target_gen_dir/tsc/typings/electron.d.ts" ]
  86. }
  87. webpack_build("electron_asar_bundle") {
  88. deps = [ ":build_electron_definitions" ]
  89. inputs = auto_filenames.asar_bundle_deps
  90. config_file = "//electron/build/webpack/webpack.config.asar.js"
  91. out_file = "$target_gen_dir/js2c/asar_bundle.js"
  92. }
  93. webpack_build("electron_browser_bundle") {
  94. deps = [ ":build_electron_definitions" ]
  95. inputs = auto_filenames.browser_bundle_deps
  96. config_file = "//electron/build/webpack/webpack.config.browser.js"
  97. out_file = "$target_gen_dir/js2c/browser_init.js"
  98. }
  99. webpack_build("electron_renderer_bundle") {
  100. deps = [ ":build_electron_definitions" ]
  101. inputs = auto_filenames.renderer_bundle_deps
  102. config_file = "//electron/build/webpack/webpack.config.renderer.js"
  103. out_file = "$target_gen_dir/js2c/renderer_init.js"
  104. }
  105. webpack_build("electron_worker_bundle") {
  106. deps = [ ":build_electron_definitions" ]
  107. inputs = auto_filenames.worker_bundle_deps
  108. config_file = "//electron/build/webpack/webpack.config.worker.js"
  109. out_file = "$target_gen_dir/js2c/worker_init.js"
  110. }
  111. webpack_build("electron_sandboxed_renderer_bundle") {
  112. deps = [ ":build_electron_definitions" ]
  113. inputs = auto_filenames.sandbox_bundle_deps
  114. config_file = "//electron/build/webpack/webpack.config.sandboxed_renderer.js"
  115. out_file = "$target_gen_dir/js2c/sandbox_bundle.js"
  116. }
  117. webpack_build("electron_isolated_renderer_bundle") {
  118. deps = [ ":build_electron_definitions" ]
  119. inputs = auto_filenames.isolated_bundle_deps
  120. config_file = "//electron/build/webpack/webpack.config.isolated_renderer.js"
  121. out_file = "$target_gen_dir/js2c/isolated_bundle.js"
  122. }
  123. action("electron_js2c") {
  124. deps = [
  125. ":electron_asar_bundle",
  126. ":electron_browser_bundle",
  127. ":electron_isolated_renderer_bundle",
  128. ":electron_renderer_bundle",
  129. ":electron_sandboxed_renderer_bundle",
  130. ":electron_worker_bundle",
  131. ]
  132. sources = [
  133. "$target_gen_dir/js2c/asar_bundle.js",
  134. "$target_gen_dir/js2c/browser_init.js",
  135. "$target_gen_dir/js2c/isolated_bundle.js",
  136. "$target_gen_dir/js2c/renderer_init.js",
  137. "$target_gen_dir/js2c/sandbox_bundle.js",
  138. "$target_gen_dir/js2c/worker_init.js",
  139. ]
  140. inputs = sources + [ "//third_party/electron_node/tools/js2c.py" ]
  141. outputs = [ "$root_gen_dir/electron_natives.cc" ]
  142. script = "build/js2c.py"
  143. args = [ rebase_path("//third_party/electron_node") ] +
  144. rebase_path(outputs, root_build_dir) +
  145. rebase_path(sources, root_build_dir)
  146. }
  147. target_gen_default_app_js = "$target_gen_dir/js/default_app"
  148. typescript_build("default_app_js") {
  149. deps = [ ":build_electron_definitions" ]
  150. sources = filenames.default_app_ts_sources
  151. output_gen_dir = target_gen_default_app_js
  152. output_dir_name = "default_app"
  153. tsconfig = "tsconfig.default_app.json"
  154. }
  155. copy("default_app_static") {
  156. sources = filenames.default_app_static_sources
  157. outputs = [ "$target_gen_default_app_js/{{source}}" ]
  158. }
  159. copy("default_app_octicon_deps") {
  160. sources = filenames.default_app_octicon_sources
  161. outputs = [ "$target_gen_default_app_js/electron/default_app/octicon/{{source_file_part}}" ]
  162. }
  163. asar("default_app_asar") {
  164. deps = [
  165. ":default_app_js",
  166. ":default_app_octicon_deps",
  167. ":default_app_static",
  168. ]
  169. root = "$target_gen_default_app_js/electron/default_app"
  170. sources = get_target_outputs(":default_app_js") +
  171. get_target_outputs(":default_app_static") +
  172. get_target_outputs(":default_app_octicon_deps")
  173. outputs = [ "$root_out_dir/resources/default_app.asar" ]
  174. }
  175. grit("resources") {
  176. source = "electron_resources.grd"
  177. outputs = [
  178. "grit/electron_resources.h",
  179. "electron_resources.pak",
  180. ]
  181. # Mojo manifest overlays are generated.
  182. grit_flags = [
  183. "-E",
  184. "target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir),
  185. ]
  186. deps = [ ":copy_shell_devtools_discovery_page" ]
  187. output_dir = "$target_gen_dir"
  188. }
  189. copy("copy_shell_devtools_discovery_page") {
  190. sources = [ "//content/shell/resources/shell_devtools_discovery_page.html" ]
  191. outputs = [ "$target_gen_dir/shell_devtools_discovery_page.html" ]
  192. }
  193. if (is_linux) {
  194. generate_library_loader("libnotify_loader") {
  195. name = "LibNotifyLoader"
  196. output_h = "libnotify_loader.h"
  197. output_cc = "libnotify_loader.cc"
  198. header = "<libnotify/notify.h>"
  199. config = ":libnotify_config"
  200. functions = [
  201. "notify_is_initted",
  202. "notify_init",
  203. "notify_get_server_caps",
  204. "notify_get_server_info",
  205. "notify_notification_new",
  206. "notify_notification_add_action",
  207. "notify_notification_set_image_from_pixbuf",
  208. "notify_notification_set_timeout",
  209. "notify_notification_set_urgency",
  210. "notify_notification_set_hint_string",
  211. "notify_notification_show",
  212. "notify_notification_close",
  213. ]
  214. }
  215. }
  216. source_set("manifests") {
  217. sources = [
  218. "//electron/shell/app/manifests.cc",
  219. "//electron/shell/app/manifests.h",
  220. ]
  221. include_dirs = [ "//electron" ]
  222. deps = [
  223. "//electron/shell/common/api:mojo",
  224. "//printing/buildflags",
  225. "//services/service_manager/public/cpp",
  226. ]
  227. }
  228. npm_action("electron_version_args") {
  229. script = "generate-version-json"
  230. outputs = [ "$target_gen_dir/electron_version.args" ]
  231. args = rebase_path(outputs)
  232. inputs = [
  233. "ELECTRON_VERSION",
  234. "script/generate-version-json.js",
  235. ]
  236. }
  237. templated_file("electron_version_header") {
  238. deps = [ ":electron_version_args" ]
  239. template = "build/templates/electron_version.tmpl"
  240. output = "$target_gen_dir/electron_version.h"
  241. args_files = get_target_outputs(":electron_version_args")
  242. }
  243. action("electron_fuses") {
  244. script = "build/fuses/build.py"
  245. inputs = [ "build/fuses/fuses.json" ]
  246. outputs = [
  247. "$target_gen_dir/fuses.h",
  248. "$target_gen_dir/fuses.cc",
  249. ]
  250. args = rebase_path(outputs)
  251. }
  252. source_set("electron_lib") {
  253. configs += [ "//v8:external_startup_data" ]
  254. configs += [ "//third_party/electron_node:node_internals" ]
  255. public_configs = [
  256. ":branding",
  257. ":electron_lib_config",
  258. ]
  259. deps = [
  260. ":electron_fuses",
  261. ":electron_js2c",
  262. ":electron_version_header",
  263. ":manifests",
  264. ":resources",
  265. "buildflags",
  266. "chromium_src:chrome",
  267. "chromium_src:chrome_spellchecker",
  268. "shell/common/api:mojo",
  269. "//base:base_static",
  270. "//base/allocator:buildflags",
  271. "//chrome/app:command_ids",
  272. "//chrome/app/resources:platform_locale_settings",
  273. "//chrome/services/printing/public/mojom",
  274. "//components/certificate_transparency",
  275. "//components/language/core/browser",
  276. "//components/net_log",
  277. "//components/network_hints/browser",
  278. "//components/network_hints/common:mojo_bindings",
  279. "//components/network_hints/renderer",
  280. "//components/network_session_configurator/common",
  281. "//components/pref_registry",
  282. "//components/prefs",
  283. "//components/upload_list",
  284. "//components/user_prefs",
  285. "//components/viz/host",
  286. "//components/viz/service",
  287. "//content/public/browser",
  288. "//content/public/child",
  289. "//content/public/common:service_names",
  290. "//content/public/gpu",
  291. "//content/public/renderer",
  292. "//content/public/utility",
  293. "//device/bluetooth",
  294. "//device/bluetooth/public/cpp",
  295. "//gin",
  296. "//media/blink:blink",
  297. "//media/capture/mojom:video_capture",
  298. "//media/mojo/mojom",
  299. "//net:extras",
  300. "//net:net_resources",
  301. "//ppapi/host",
  302. "//ppapi/proxy",
  303. "//ppapi/shared_impl",
  304. "//printing/buildflags",
  305. "//services/device/public/cpp/geolocation",
  306. "//services/device/public/mojom",
  307. "//services/proxy_resolver:lib",
  308. "//services/video_capture/public/mojom:constants",
  309. "//services/viz/privileged/mojom/compositing",
  310. "//skia",
  311. "//third_party/blink/public:blink",
  312. "//third_party/blink/public:blink_devtools_inspector_resources",
  313. "//third_party/boringssl",
  314. "//third_party/electron_node:node_lib",
  315. "//third_party/inspector_protocol:crdtp",
  316. "//third_party/leveldatabase",
  317. "//third_party/libyuv",
  318. "//third_party/webrtc_overrides:webrtc_component",
  319. "//third_party/widevine/cdm:headers",
  320. "//third_party/zlib/google:zip",
  321. "//ui/base/idle",
  322. "//ui/events:dom_keycode_converter",
  323. "//ui/gl",
  324. "//ui/native_theme",
  325. "//ui/shell_dialogs",
  326. "//ui/views",
  327. "//v8",
  328. "//v8:v8_libplatform",
  329. ]
  330. public_deps = [
  331. "//base",
  332. "//base:i18n",
  333. "//content/public/app",
  334. ]
  335. include_dirs = [
  336. "chromium_src",
  337. ".",
  338. "$target_gen_dir",
  339. # TODO(nornagon): replace usage of SchemeRegistry by an actually exported
  340. # API of blink, then remove this from the include_dirs.
  341. "//third_party/blink/renderer",
  342. ]
  343. defines = [ "V8_DEPRECATION_WARNINGS" ]
  344. libs = []
  345. if (is_linux) {
  346. defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ]
  347. }
  348. if (!is_mas_build) {
  349. deps += [ "//components/crash/core/app" ]
  350. }
  351. sources = filenames.lib_sources
  352. if (is_win) {
  353. sources += filenames.lib_sources_win
  354. }
  355. if (is_mac) {
  356. sources += filenames.lib_sources_mac
  357. }
  358. if (is_posix) {
  359. sources += filenames.lib_sources_posix
  360. }
  361. if (is_linux) {
  362. sources += filenames.lib_sources_linux
  363. }
  364. if (!is_mac) {
  365. sources += filenames.lib_sources_views
  366. }
  367. if (is_component_build) {
  368. defines += [ "NODE_SHARED_MODE" ]
  369. }
  370. if (enable_fake_location_provider) {
  371. sources += [
  372. "shell/browser/fake_location_provider.cc",
  373. "shell/browser/fake_location_provider.h",
  374. ]
  375. }
  376. if (is_linux) {
  377. deps += [ "//components/crash/content/browser" ]
  378. }
  379. if (is_mac) {
  380. deps += [
  381. "//components/remote_cocoa/app_shim",
  382. "//content/common:mac_helpers",
  383. "//ui/accelerated_widget_mac",
  384. ]
  385. if (!is_mas_build) {
  386. deps += [ "//third_party/crashpad/crashpad/client" ]
  387. }
  388. frameworks = [
  389. "AVFoundation.framework",
  390. "Carbon.framework",
  391. "LocalAuthentication.framework",
  392. "QuartzCore.framework",
  393. "Quartz.framework",
  394. "Security.framework",
  395. "SecurityInterface.framework",
  396. "ServiceManagement.framework",
  397. "StoreKit.framework",
  398. ]
  399. sources += [
  400. "shell/browser/ui/views/autofill_popup_view.cc",
  401. "shell/browser/ui/views/autofill_popup_view.h",
  402. ]
  403. if (is_mas_build) {
  404. sources += [ "shell/browser/api/electron_api_app_mas.mm" ]
  405. sources -= [ "shell/browser/auto_updater_mac.mm" ]
  406. defines += [ "MAS_BUILD" ]
  407. sources -= [
  408. "shell/app/electron_crash_reporter_client.cc",
  409. "shell/app/electron_crash_reporter_client.h",
  410. "shell/common/crash_keys.cc",
  411. "shell/common/crash_keys.h",
  412. ]
  413. } else {
  414. frameworks += [
  415. "Squirrel.framework",
  416. "ReactiveObjC.framework",
  417. "Mantle.framework",
  418. ]
  419. deps += [
  420. "//third_party/squirrel.mac:reactiveobjc_framework+link",
  421. "//third_party/squirrel.mac:squirrel_framework+link",
  422. ]
  423. # ReactiveObjC which is used by Squirrel requires using __weak.
  424. cflags_objcc = [ "-fobjc-weak" ]
  425. }
  426. }
  427. if (is_linux) {
  428. deps += [
  429. ":libnotify_loader",
  430. "//build/config/linux/gtk",
  431. "//dbus",
  432. "//device/bluetooth",
  433. "//ui/events/devices/x11",
  434. "//ui/events/platform/x11",
  435. "//ui/gtk",
  436. "//ui/views/controls/webview",
  437. "//ui/wm",
  438. ]
  439. if (use_x11) {
  440. sources += filenames.lib_sources_linux_x11
  441. deps += [
  442. "//ui/gfx/x",
  443. "//ui/gtk/x",
  444. ]
  445. }
  446. configs += [ ":gio_unix" ]
  447. defines += [
  448. # Disable warnings for g_settings_list_schemas.
  449. "GLIB_DISABLE_DEPRECATION_WARNINGS",
  450. ]
  451. sources += filenames.lib_sources_nss
  452. sources += [
  453. "shell/browser/ui/gtk/app_indicator_icon.cc",
  454. "shell/browser/ui/gtk/app_indicator_icon.h",
  455. "shell/browser/ui/gtk/app_indicator_icon_menu.cc",
  456. "shell/browser/ui/gtk/app_indicator_icon_menu.h",
  457. "shell/browser/ui/gtk/gtk_status_icon.cc",
  458. "shell/browser/ui/gtk/gtk_status_icon.h",
  459. "shell/browser/ui/gtk/menu_util.cc",
  460. "shell/browser/ui/gtk/menu_util.h",
  461. "shell/browser/ui/gtk/status_icon.cc",
  462. "shell/browser/ui/gtk/status_icon.h",
  463. "shell/browser/ui/gtk_util.cc",
  464. "shell/browser/ui/gtk_util.h",
  465. ]
  466. }
  467. if (is_win) {
  468. libs += [ "dwmapi.lib" ]
  469. deps += [
  470. "//components/crash/core/app:crash_export_thunks",
  471. "//ui/native_theme:native_theme_browser",
  472. "//ui/views/controls/webview",
  473. "//ui/wm",
  474. "//ui/wm/public",
  475. ]
  476. public_deps += [
  477. "//sandbox/win:sandbox",
  478. "//third_party/crashpad/crashpad/handler",
  479. ]
  480. }
  481. if (enable_plugins) {
  482. deps += [ "chromium_src:plugins" ]
  483. sources += [
  484. "shell/renderer/pepper_helper.cc",
  485. "shell/renderer/pepper_helper.h",
  486. ]
  487. }
  488. if (enable_run_as_node) {
  489. sources += [
  490. "shell/app/node_main.cc",
  491. "shell/app/node_main.h",
  492. ]
  493. }
  494. if (enable_osr) {
  495. sources += [
  496. "shell/browser/osr/osr_host_display_client.cc",
  497. "shell/browser/osr/osr_host_display_client.h",
  498. "shell/browser/osr/osr_render_widget_host_view.cc",
  499. "shell/browser/osr/osr_render_widget_host_view.h",
  500. "shell/browser/osr/osr_video_consumer.cc",
  501. "shell/browser/osr/osr_video_consumer.h",
  502. "shell/browser/osr/osr_view_proxy.cc",
  503. "shell/browser/osr/osr_view_proxy.h",
  504. "shell/browser/osr/osr_web_contents_view.cc",
  505. "shell/browser/osr/osr_web_contents_view.h",
  506. ]
  507. if (is_mac) {
  508. sources += [
  509. "shell/browser/osr/osr_host_display_client_mac.mm",
  510. "shell/browser/osr/osr_web_contents_view_mac.mm",
  511. ]
  512. }
  513. deps += [
  514. "//components/viz/service",
  515. "//services/viz/public/mojom",
  516. "//ui/compositor",
  517. ]
  518. }
  519. if (enable_desktop_capturer) {
  520. if (is_component_build && !is_linux) {
  521. # On windows the implementation relies on unexported
  522. # DxgiDuplicatorController class. On macOS the implementation
  523. # relies on unexported webrtc::GetWindowOwnerPid method.
  524. deps += [ "//third_party/webrtc/modules/desktop_capture" ]
  525. }
  526. sources += [
  527. "shell/browser/api/electron_api_desktop_capturer.cc",
  528. "shell/browser/api/electron_api_desktop_capturer.h",
  529. ]
  530. }
  531. if (enable_views_api) {
  532. sources += [
  533. "shell/browser/api/views/electron_api_image_view.cc",
  534. "shell/browser/api/views/electron_api_image_view.h",
  535. ]
  536. }
  537. if (enable_basic_printing) {
  538. sources += [
  539. "shell/browser/printing/print_preview_message_handler.cc",
  540. "shell/browser/printing/print_preview_message_handler.h",
  541. "shell/renderer/printing/print_render_frame_helper_delegate.cc",
  542. "shell/renderer/printing/print_render_frame_helper_delegate.h",
  543. ]
  544. deps += [ "//components/printing/common:mojo_interfaces" ]
  545. }
  546. if (enable_electron_extensions) {
  547. sources += filenames.lib_sources_extensions
  548. deps += [
  549. "shell/browser/extensions/api:api_registration",
  550. "shell/common/extensions/api",
  551. "shell/common/extensions/api:extensions_features",
  552. "//chrome/browser/resources:component_extension_resources",
  553. "//components/update_client:update_client",
  554. "//components/zoom",
  555. "//extensions/browser",
  556. "//extensions/browser:core_api_provider",
  557. "//extensions/common",
  558. "//extensions/common:core_api_provider",
  559. "//extensions/renderer",
  560. ]
  561. }
  562. if (enable_pdf) {
  563. # Printing depends on some //pdf code, so it needs to be built even if the
  564. # pdf viewer isn't enabled.
  565. deps += [
  566. "//pdf",
  567. "//pdf:features",
  568. ]
  569. }
  570. if (enable_pdf_viewer) {
  571. deps += [
  572. "//components/pdf/browser",
  573. "//components/pdf/renderer",
  574. "//pdf:pdf_ppapi",
  575. ]
  576. sources += [
  577. "shell/browser/electron_pdf_web_contents_helper_client.cc",
  578. "shell/browser/electron_pdf_web_contents_helper_client.h",
  579. ]
  580. }
  581. sources += get_target_outputs(":electron_fuses")
  582. }
  583. electron_paks("packed_resources") {
  584. if (is_mac) {
  585. output_dir = "$root_gen_dir/electron_repack"
  586. copy_data_to_bundle = true
  587. } else {
  588. output_dir = root_out_dir
  589. }
  590. }
  591. if (is_mac) {
  592. electron_framework_name = "$electron_product_name Framework"
  593. electron_helper_name = "$electron_product_name Helper"
  594. electron_login_helper_name = "$electron_product_name Login Helper"
  595. electron_framework_version = "A"
  596. electron_version = read_file("ELECTRON_VERSION", "trim string")
  597. mac_xib_bundle_data("electron_xibs") {
  598. sources = [ "shell/common/resources/mac/MainMenu.xib" ]
  599. }
  600. action("fake_v8_context_snapshot_generator") {
  601. script = "build/fake_v8_context_snapshot_generator.py"
  602. args = [
  603. rebase_path("$root_out_dir/$v8_context_snapshot_filename"),
  604. rebase_path("$root_out_dir/fake/$v8_context_snapshot_filename"),
  605. ]
  606. outputs = [ "$root_out_dir/fake/$v8_context_snapshot_filename" ]
  607. }
  608. bundle_data("electron_framework_resources") {
  609. public_deps = [ ":packed_resources" ]
  610. sources = []
  611. if (icu_use_data_file) {
  612. sources += [ "$root_out_dir/icudtl.dat" ]
  613. public_deps += [ "//third_party/icu:icudata" ]
  614. }
  615. if (v8_use_external_startup_data) {
  616. public_deps += [ "//v8" ]
  617. if (use_v8_context_snapshot) {
  618. if (use_prebuilt_v8_context_snapshot) {
  619. sources += [ "$root_out_dir/fake/$v8_context_snapshot_filename" ]
  620. public_deps += [ ":fake_v8_context_snapshot_generator" ]
  621. } else {
  622. sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
  623. public_deps += [ "//tools/v8_context_snapshot" ]
  624. }
  625. } else {
  626. sources += [ "$root_out_dir/snapshot_blob.bin" ]
  627. }
  628. }
  629. outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  630. }
  631. if (!is_component_build && is_component_ffmpeg) {
  632. bundle_data("electron_framework_libraries") {
  633. sources = []
  634. public_deps = []
  635. sources += [ "$root_out_dir/libffmpeg.dylib" ]
  636. public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
  637. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  638. }
  639. } else {
  640. group("electron_framework_libraries") {
  641. }
  642. }
  643. if (use_egl) {
  644. # Add the ANGLE .dylibs in the Libraries directory of the Framework.
  645. bundle_data("electron_angle_binaries") {
  646. sources = [
  647. "$root_out_dir/egl_intermediates/libEGL.dylib",
  648. "$root_out_dir/egl_intermediates/libGLESv2.dylib",
  649. ]
  650. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  651. public_deps = [ "//ui/gl:angle_library_copy" ]
  652. }
  653. # Add the SwiftShader .dylibs in the Libraries directory of the Framework.
  654. bundle_data("electron_swiftshader_binaries") {
  655. sources = [
  656. "$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
  657. "$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
  658. "$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
  659. "$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
  660. ]
  661. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  662. public_deps = [
  663. "//ui/gl:swiftshader_egl_library_copy",
  664. "//ui/gl:swiftshader_vk_library_copy",
  665. ]
  666. }
  667. }
  668. group("electron_angle_library") {
  669. if (use_egl) {
  670. deps = [ ":electron_angle_binaries" ]
  671. }
  672. }
  673. group("electron_swiftshader_library") {
  674. if (use_egl) {
  675. deps = [ ":electron_swiftshader_binaries" ]
  676. }
  677. }
  678. bundle_data("electron_crashpad_helper") {
  679. sources = [ "$root_out_dir/chrome_crashpad_handler" ]
  680. outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ]
  681. public_deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
  682. if (is_asan) {
  683. # crashpad_handler requires the ASan runtime at its @executable_path.
  684. sources += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ]
  685. public_deps += [ "//build/config/sanitizers:copy_asan_runtime" ]
  686. }
  687. }
  688. mac_framework_bundle("electron_framework") {
  689. output_name = electron_framework_name
  690. framework_version = electron_framework_version
  691. framework_contents = [
  692. "Resources",
  693. "Libraries",
  694. ]
  695. if (!is_mas_build) {
  696. framework_contents += [ "Helpers" ]
  697. }
  698. public_deps = [
  699. ":electron_framework_libraries",
  700. ":electron_lib",
  701. ]
  702. deps = [
  703. ":electron_angle_library",
  704. ":electron_framework_libraries",
  705. ":electron_framework_resources",
  706. ":electron_swiftshader_library",
  707. ":electron_xibs",
  708. ]
  709. if (!is_mas_build) {
  710. deps += [ ":electron_crashpad_helper" ]
  711. }
  712. info_plist = "shell/common/resources/mac/Info.plist"
  713. extra_substitutions = [
  714. "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.framework",
  715. "ELECTRON_VERSION=$electron_version",
  716. ]
  717. include_dirs = [ "." ]
  718. sources = filenames.framework_sources
  719. frameworks = []
  720. if (enable_osr) {
  721. frameworks += [ "IOSurface.framework" ]
  722. }
  723. ldflags = [
  724. "-Wl,-install_name,@rpath/$output_name.framework/$output_name",
  725. "-rpath",
  726. "@loader_path/Libraries",
  727. # Required for exporting all symbols of libuv.
  728. "-Wl,-force_load,obj/third_party/electron_node/deps/uv/libuv.a",
  729. ]
  730. if (is_component_build) {
  731. ldflags += [
  732. "-rpath",
  733. "@executable_path/../../../../../..",
  734. ]
  735. }
  736. }
  737. template("electron_helper_app") {
  738. mac_app_bundle(target_name) {
  739. assert(defined(invoker.helper_name_suffix))
  740. output_name = electron_helper_name + invoker.helper_name_suffix
  741. deps = [ ":electron_framework+link" ]
  742. if (!is_mas_build) {
  743. deps += [ "//sandbox/mac:seatbelt" ]
  744. }
  745. defines = [ "HELPER_EXECUTABLE" ]
  746. sources = filenames.app_sources
  747. sources += [ "shell/common/electron_constants.cc" ]
  748. include_dirs = [ "." ]
  749. info_plist = "shell/renderer/resources/mac/Info.plist"
  750. extra_substitutions =
  751. [ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
  752. ldflags = [
  753. "-rpath",
  754. "@executable_path/../../..",
  755. ]
  756. if (is_component_build) {
  757. ldflags += [
  758. "-rpath",
  759. "@executable_path/../../../../../..",
  760. ]
  761. }
  762. }
  763. }
  764. foreach(helper_params, content_mac_helpers) {
  765. _helper_target = helper_params[0]
  766. _helper_bundle_id = helper_params[1]
  767. _helper_suffix = helper_params[2]
  768. electron_helper_app("electron_helper_app_${_helper_target}") {
  769. helper_name_suffix = _helper_suffix
  770. }
  771. }
  772. template("stripped_framework") {
  773. action(target_name) {
  774. assert(defined(invoker.framework))
  775. script = "//electron/build/strip_framework.py"
  776. forward_variables_from(invoker, [ "deps" ])
  777. inputs = [ "$root_out_dir/" + invoker.framework ]
  778. outputs = [ "$target_out_dir/stripped_frameworks/" + invoker.framework ]
  779. args = rebase_path(inputs) + rebase_path(outputs)
  780. }
  781. }
  782. stripped_framework("stripped_mantle_framework") {
  783. framework = "Mantle.framework"
  784. deps = [ "//third_party/squirrel.mac:mantle_framework" ]
  785. }
  786. stripped_framework("stripped_reactiveobjc_framework") {
  787. framework = "ReactiveObjC.framework"
  788. deps = [ "//third_party/squirrel.mac:reactiveobjc_framework" ]
  789. }
  790. stripped_framework("stripped_squirrel_framework") {
  791. framework = "Squirrel.framework"
  792. deps = [ "//third_party/squirrel.mac:squirrel_framework" ]
  793. }
  794. bundle_data("electron_app_framework_bundle_data") {
  795. sources = [ "$root_out_dir/$electron_framework_name.framework" ]
  796. if (!is_mas_build) {
  797. sources += get_target_outputs(":stripped_mantle_framework") +
  798. get_target_outputs(":stripped_reactiveobjc_framework") +
  799. get_target_outputs(":stripped_squirrel_framework")
  800. }
  801. outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
  802. public_deps = [
  803. ":electron_framework+link",
  804. ":stripped_mantle_framework",
  805. ":stripped_reactiveobjc_framework",
  806. ":stripped_squirrel_framework",
  807. ]
  808. foreach(helper_params, content_mac_helpers) {
  809. sources +=
  810. [ "$root_out_dir/${electron_helper_name}${helper_params[2]}.app" ]
  811. public_deps += [ ":electron_helper_app_${helper_params[0]}" ]
  812. }
  813. }
  814. mac_app_bundle("electron_login_helper") {
  815. output_name = electron_login_helper_name
  816. sources = filenames.login_helper_sources
  817. include_dirs = [ "." ]
  818. frameworks = [ "AppKit.framework" ]
  819. info_plist = "shell/app/resources/mac/loginhelper-Info.plist"
  820. extra_substitutions =
  821. [ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.loginhelper" ]
  822. }
  823. bundle_data("electron_login_helper_app") {
  824. public_deps = [ ":electron_login_helper" ]
  825. sources = [ "$root_out_dir/$electron_login_helper_name.app" ]
  826. outputs =
  827. [ "{{bundle_contents_dir}}/Library/LoginItems/{{source_file_part}}" ]
  828. }
  829. action("electron_app_lproj_dirs") {
  830. outputs = []
  831. foreach(locale, locales_as_mac_outputs) {
  832. outputs += [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
  833. }
  834. script = "build/mac/make_locale_dirs.py"
  835. args = rebase_path(outputs)
  836. }
  837. foreach(locale, locales_as_mac_outputs) {
  838. bundle_data("electron_app_strings_${locale}_bundle_data") {
  839. sources = [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
  840. outputs = [ "{{bundle_resources_dir}}/$locale.lproj" ]
  841. public_deps = [ ":electron_app_lproj_dirs" ]
  842. }
  843. }
  844. group("electron_app_strings_bundle_data") {
  845. public_deps = []
  846. foreach(locale, locales_as_mac_outputs) {
  847. public_deps += [ ":electron_app_strings_${locale}_bundle_data" ]
  848. }
  849. }
  850. bundle_data("electron_app_resources") {
  851. public_deps = [
  852. ":default_app_asar",
  853. ":electron_app_strings_bundle_data",
  854. ]
  855. sources = [
  856. "$root_out_dir/resources/default_app.asar",
  857. "shell/browser/resources/mac/electron.icns",
  858. ]
  859. outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  860. }
  861. mac_app_bundle("electron_app") {
  862. output_name = electron_product_name
  863. sources = filenames.app_sources
  864. sources += [ "shell/common/electron_constants.cc" ]
  865. include_dirs = [ "." ]
  866. deps = [
  867. ":electron_app_framework_bundle_data",
  868. ":electron_app_resources",
  869. ]
  870. if (is_mas_build) {
  871. deps += [ ":electron_login_helper_app" ]
  872. }
  873. info_plist = "shell/browser/resources/mac/Info.plist"
  874. extra_substitutions = [
  875. "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id",
  876. "ELECTRON_VERSION=$electron_version",
  877. ]
  878. ldflags = [
  879. "-rpath",
  880. "@executable_path/../Frameworks",
  881. ]
  882. }
  883. if (enable_dsyms) {
  884. extract_symbols("electron_framework_syms") {
  885. binary = "$root_out_dir/$electron_framework_name.framework/Versions/$electron_framework_version/$electron_framework_name"
  886. symbol_dir = "$root_out_dir/breakpad_symbols"
  887. dsym_file = "$root_out_dir/$electron_framework_name.dSYM/Contents/Resources/DWARF/$electron_framework_name"
  888. deps = [ ":electron_framework" ]
  889. }
  890. foreach(helper_params, content_mac_helpers) {
  891. _helper_target = helper_params[0]
  892. _helper_bundle_id = helper_params[1]
  893. _helper_suffix = helper_params[2]
  894. extract_symbols("electron_helper_syms_${_helper_target}") {
  895. binary = "$root_out_dir/$electron_helper_name${_helper_suffix}.app/Contents/MacOS/$electron_helper_name${_helper_suffix}"
  896. symbol_dir = "$root_out_dir/breakpad_symbols"
  897. dsym_file = "$root_out_dir/$electron_helper_name${_helper_suffix}.dSYM/Contents/Resources/DWARF/$electron_helper_name${_helper_suffix}"
  898. deps = [ ":electron_helper_app_${_helper_target}" ]
  899. }
  900. }
  901. extract_symbols("electron_app_syms") {
  902. binary = "$root_out_dir/$electron_product_name.app/Contents/MacOS/$electron_product_name"
  903. symbol_dir = "$root_out_dir/breakpad_symbols"
  904. dsym_file = "$root_out_dir/$electron_product_name.dSYM/Contents/Resources/DWARF/$electron_product_name"
  905. deps = [ ":electron_app" ]
  906. }
  907. extract_symbols("swiftshader_egl_syms") {
  908. binary = "$root_out_dir/libswiftshader_libEGL.dylib"
  909. symbol_dir = "$root_out_dir/breakpad_symbols"
  910. dsym_file = "$root_out_dir/libswiftshader_libEGL.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libEGL.dylib"
  911. deps =
  912. [ "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL" ]
  913. }
  914. extract_symbols("swiftshader_gles_syms") {
  915. binary = "$root_out_dir/libswiftshader_libGLESv2.dylib"
  916. symbol_dir = "$root_out_dir/breakpad_symbols"
  917. dsym_file = "$root_out_dir/libswiftshader_libGLESv2.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libGLESv2.dylib"
  918. deps = [
  919. "//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
  920. ]
  921. }
  922. extract_symbols("crashpad_handler_syms") {
  923. binary = "$root_out_dir/chrome_crashpad_handler"
  924. symbol_dir = "$root_out_dir/breakpad_symbols"
  925. dsym_file = "$root_out_dir/chrome_crashpad_handler.dSYM/Contents/Resources/DWARF/chrome_crashpad_handler"
  926. deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
  927. }
  928. group("electron_symbols") {
  929. deps = [
  930. ":electron_app_syms",
  931. ":electron_framework_syms",
  932. ":swiftshader_egl_syms",
  933. ":swiftshader_gles_syms",
  934. ]
  935. if (!is_mas_build) {
  936. deps += [ ":crashpad_handler_syms" ]
  937. }
  938. foreach(helper_params, content_mac_helpers) {
  939. _helper_target = helper_params[0]
  940. deps += [ ":electron_helper_syms_${_helper_target}" ]
  941. }
  942. }
  943. } else {
  944. group("electron_symbols") {
  945. }
  946. }
  947. } else {
  948. windows_manifest("electron_app_manifest") {
  949. sources = [
  950. "shell/browser/resources/win/disable_window_filtering.manifest",
  951. "shell/browser/resources/win/dpi_aware.manifest",
  952. as_invoker_manifest,
  953. common_controls_manifest,
  954. default_compatibility_manifest,
  955. ]
  956. }
  957. executable("electron_app") {
  958. output_name = electron_project_name
  959. sources = filenames.app_sources
  960. include_dirs = [ "." ]
  961. deps = [
  962. ":default_app_asar",
  963. ":electron_app_manifest",
  964. ":electron_lib",
  965. ":packed_resources",
  966. "//components/crash/core/app",
  967. "//content:sandbox_helper_win",
  968. "//electron/buildflags",
  969. "//ui/strings",
  970. ]
  971. data = []
  972. data += [ "$root_out_dir/resources.pak" ]
  973. data += [ "$root_out_dir/chrome_100_percent.pak" ]
  974. if (enable_hidpi) {
  975. data += [ "$root_out_dir/chrome_200_percent.pak" ]
  976. }
  977. foreach(locale, locales) {
  978. data += [ "$root_out_dir/locales/$locale.pak" ]
  979. }
  980. if (!is_mac) {
  981. data += [ "$root_out_dir/resources/default_app.asar" ]
  982. }
  983. if (use_v8_context_snapshot) {
  984. public_deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
  985. }
  986. if (is_win) {
  987. sources += [
  988. # TODO: we should be generating our .rc files more like how chrome does
  989. "shell/browser/resources/win/electron.rc",
  990. "shell/browser/resources/win/resource.h",
  991. ]
  992. deps += [
  993. "//components/browser_watcher:browser_watcher_client",
  994. "//components/crash/core/app:run_as_crashpad_handler",
  995. ]
  996. ldflags = []
  997. libs = [
  998. "comctl32.lib",
  999. "uiautomationcore.lib",
  1000. "wtsapi32.lib",
  1001. ]
  1002. configs -= [ "//build/config/win:console" ]
  1003. configs += [
  1004. "//build/config/win:windowed",
  1005. "//build/config/win:delayloads",
  1006. ]
  1007. if (target_cpu == "arm64") {
  1008. configs -= [ "//build/config/win:cfi_linker" ]
  1009. ldflags += [ "/guard:cf,nolongjmp" ]
  1010. }
  1011. # This is to support renaming of electron.exe. node-gyp has hard-coded
  1012. # executable names which it will recognise as node. This module definition
  1013. # file claims that the electron executable is in fact named "node.exe",
  1014. # which is one of the executable names that node-gyp recognizes.
  1015. # See https://github.com/nodejs/node-gyp/commit/52ceec3a6d15de3a8f385f43dbe5ecf5456ad07a
  1016. ldflags += [ "/DEF:" + rebase_path("build/electron.def", root_build_dir) ]
  1017. inputs = [
  1018. "shell/browser/resources/win/electron.ico",
  1019. "build/electron.def",
  1020. ]
  1021. }
  1022. if (is_linux) {
  1023. ldflags = [
  1024. "-pie",
  1025. # Required for exporting all symbols of libuv.
  1026. "-Wl,--whole-archive",
  1027. "obj/third_party/electron_node/deps/uv/libuv.a",
  1028. "-Wl,--no-whole-archive",
  1029. ]
  1030. if (!is_component_build && is_component_ffmpeg) {
  1031. configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
  1032. }
  1033. }
  1034. }
  1035. if (is_official_build) {
  1036. if (is_linux) {
  1037. _target_executable_suffix = ""
  1038. _target_shared_library_suffix = ".so"
  1039. } else if (is_win) {
  1040. _target_executable_suffix = ".exe"
  1041. _target_shared_library_suffix = ".dll"
  1042. }
  1043. extract_symbols("electron_app_symbols") {
  1044. binary = "$root_out_dir/$electron_project_name$_target_executable_suffix"
  1045. symbol_dir = "$root_out_dir/breakpad_symbols"
  1046. deps = [ ":electron_app" ]
  1047. }
  1048. extract_symbols("swiftshader_egl_symbols") {
  1049. binary = "$root_out_dir/swiftshader/libEGL$_target_shared_library_suffix"
  1050. symbol_dir = "$root_out_dir/breakpad_symbols"
  1051. deps =
  1052. [ "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL" ]
  1053. }
  1054. extract_symbols("swiftshader_gles_symbols") {
  1055. binary =
  1056. "$root_out_dir/swiftshader/libGLESv2$_target_shared_library_suffix"
  1057. symbol_dir = "$root_out_dir/breakpad_symbols"
  1058. deps = [
  1059. "//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
  1060. ]
  1061. }
  1062. group("electron_symbols") {
  1063. deps = [
  1064. ":electron_app_symbols",
  1065. ":swiftshader_egl_symbols",
  1066. ":swiftshader_gles_symbols",
  1067. ]
  1068. }
  1069. }
  1070. }
  1071. test("shell_browser_ui_unittests") {
  1072. sources = [
  1073. "//electron/shell/browser/ui/accelerator_util_unittests.cc",
  1074. "//electron/shell/browser/ui/run_all_unittests.cc",
  1075. ]
  1076. configs += [ ":electron_lib_config" ]
  1077. deps = [
  1078. ":electron_lib",
  1079. "//base",
  1080. "//base/test:test_support",
  1081. "//testing/gmock",
  1082. "//testing/gtest",
  1083. "//ui/base",
  1084. "//ui/strings",
  1085. ]
  1086. }
  1087. template("dist_zip") {
  1088. _runtime_deps_target = "${target_name}__deps"
  1089. _runtime_deps_file =
  1090. "$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + "/" +
  1091. get_label_info(target_name, "name") + ".runtime_deps"
  1092. group(_runtime_deps_target) {
  1093. forward_variables_from(invoker,
  1094. [
  1095. "deps",
  1096. "data_deps",
  1097. "data",
  1098. "testonly",
  1099. ])
  1100. write_runtime_deps = _runtime_deps_file
  1101. }
  1102. action(target_name) {
  1103. script = "//electron/build/zip.py"
  1104. deps = [ ":$_runtime_deps_target" ]
  1105. forward_variables_from(invoker,
  1106. [
  1107. "outputs",
  1108. "testonly",
  1109. ])
  1110. flatten = false
  1111. if (defined(invoker.flatten)) {
  1112. flatten = invoker.flatten
  1113. }
  1114. args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
  1115. target_cpu,
  1116. target_os,
  1117. "$flatten",
  1118. ]
  1119. }
  1120. }
  1121. copy("electron_license") {
  1122. sources = [ "LICENSE" ]
  1123. outputs = [ "$root_build_dir/{{source_file_part}}" ]
  1124. }
  1125. copy("chromium_licenses") {
  1126. deps = [ "//components/resources:about_credits" ]
  1127. sources = [ "$root_gen_dir/components/resources/about_credits.html" ]
  1128. outputs = [ "$root_build_dir/LICENSES.chromium.html" ]
  1129. }
  1130. group("licenses") {
  1131. data_deps = [
  1132. ":chromium_licenses",
  1133. ":electron_license",
  1134. ]
  1135. }
  1136. copy("electron_version") {
  1137. sources = [ "ELECTRON_VERSION" ]
  1138. outputs = [ "$root_build_dir/version" ]
  1139. }
  1140. dist_zip("electron_dist_zip") {
  1141. data_deps = [
  1142. ":electron_app",
  1143. ":electron_version",
  1144. ":licenses",
  1145. ]
  1146. if (is_linux) {
  1147. data_deps += [ "//sandbox/linux:chrome_sandbox" ]
  1148. }
  1149. outputs = [ "$root_build_dir/dist.zip" ]
  1150. }
  1151. dist_zip("electron_ffmpeg_zip") {
  1152. data_deps = [ "//third_party/ffmpeg" ]
  1153. outputs = [ "$root_build_dir/ffmpeg.zip" ]
  1154. }
  1155. electron_chromedriver_deps = [
  1156. ":licenses",
  1157. "//chrome/test/chromedriver",
  1158. "//electron/buildflags",
  1159. ]
  1160. group("electron_chromedriver") {
  1161. testonly = true
  1162. public_deps = electron_chromedriver_deps
  1163. }
  1164. dist_zip("electron_chromedriver_zip") {
  1165. testonly = true
  1166. data_deps = electron_chromedriver_deps
  1167. outputs = [ "$root_build_dir/chromedriver.zip" ]
  1168. }
  1169. mksnapshot_deps = [
  1170. ":licenses",
  1171. "//v8:mksnapshot($v8_snapshot_toolchain)",
  1172. ]
  1173. if (use_v8_context_snapshot) {
  1174. mksnapshot_deps += [ "//tools/v8_context_snapshot:v8_context_snapshot_generator($v8_snapshot_toolchain)" ]
  1175. }
  1176. group("electron_mksnapshot") {
  1177. public_deps = mksnapshot_deps
  1178. }
  1179. dist_zip("electron_mksnapshot_zip") {
  1180. data_deps = mksnapshot_deps
  1181. outputs = [ "$root_build_dir/mksnapshot.zip" ]
  1182. }
  1183. copy("hunspell_dictionaries") {
  1184. sources = hunspell_dictionaries + hunspell_licenses
  1185. outputs = [ "$target_gen_dir/electron_hunspell/{{source_file_part}}" ]
  1186. }
  1187. dist_zip("hunspell_dictionaries_zip") {
  1188. data_deps = [ ":hunspell_dictionaries" ]
  1189. flatten = true
  1190. outputs = [ "$root_build_dir/hunspell_dictionaries.zip" ]
  1191. }
  1192. group("electron") {
  1193. public_deps = [ ":electron_app" ]
  1194. }