BUILD.gn 40 KB

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