BUILD.gn 42 KB

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