BUILD.gn 38 KB

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