BUILD.gn 39 KB

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