BUILD.gn 47 KB

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