BUILD.gn 42 KB

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