BUILD.gn 40 KB

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