BUILD.gn 44 KB

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