BUILD.gn 44 KB

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