BUILD.gn 42 KB

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