BUILD.gn 38 KB

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