BUILD.gn 46 KB

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