BUILD.gn 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011
  1. import("build/asar.gni")
  2. import("build/npm.gni")
  3. import("buildflags/buildflags.gni")
  4. import("electron_paks.gni")
  5. import("filenames.gni")
  6. import("//build/config/locales.gni")
  7. import("//build/config/win/manifest.gni")
  8. import("//pdf/features.gni")
  9. import("//services/service_manager/public/service_manifest.gni")
  10. import("//third_party/ffmpeg/ffmpeg_options.gni")
  11. import("//tools/grit/grit_rule.gni")
  12. import("//tools/grit/repack.gni")
  13. import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
  14. import("//v8/snapshot_toolchain.gni")
  15. if (is_mac) {
  16. import("//build/config/mac/rules.gni")
  17. import("//third_party/icu/config.gni")
  18. import("//v8/gni/v8.gni")
  19. }
  20. if (is_linux) {
  21. import("//build/config/linux/pkg_config.gni")
  22. pkg_config("gio_unix") {
  23. packages = [ "gio-unix-2.0" ]
  24. }
  25. }
  26. branding = read_file("atom/app/BRANDING.json", "json")
  27. electron_project_name = branding.project_name
  28. electron_product_name = branding.product_name
  29. electron_mac_bundle_id = branding.mac_bundle_id
  30. if (is_mas_build) {
  31. assert(is_mac,
  32. "It doesn't make sense to build a MAS build on a non-mac platform")
  33. }
  34. config("branding") {
  35. defines = [
  36. "ATOM_PRODUCT_NAME=\"$electron_product_name\"",
  37. "ATOM_PROJECT_NAME=\"$electron_project_name\"",
  38. ]
  39. }
  40. npm_action("atom_browserify_sandbox") {
  41. deps = [
  42. ":atom_js2c_copy",
  43. ]
  44. sandbox_args = [
  45. "lib/sandboxed_renderer/init.js",
  46. "-r",
  47. "./lib/sandboxed_renderer/api/exports/electron.js:electron",
  48. "-r",
  49. "./lib/sandboxed_renderer/api/exports/fs.js:fs",
  50. "-r",
  51. "./lib/sandboxed_renderer/api/exports/os.js:os",
  52. "-r",
  53. "./lib/sandboxed_renderer/api/exports/path.js:path",
  54. "-r",
  55. "./lib/sandboxed_renderer/api/exports/child_process.js:child_process",
  56. "-t",
  57. "aliasify",
  58. ]
  59. inputs = [
  60. "lib/sandboxed_renderer/init.js",
  61. "lib/sandboxed_renderer/api/exports/electron.js",
  62. "lib/sandboxed_renderer/api/exports/fs.js",
  63. "lib/sandboxed_renderer/api/exports/os.js",
  64. "lib/sandboxed_renderer/api/exports/path.js",
  65. "lib/sandboxed_renderer/api/exports/child_process.js",
  66. ]
  67. outputs = [
  68. "$target_gen_dir/js2c/preload_bundle.js",
  69. ]
  70. script = "browserify"
  71. args = sandbox_args + [
  72. "-o",
  73. rebase_path(outputs[0]),
  74. ]
  75. }
  76. npm_action("atom_browserify_isolated") {
  77. deps = [
  78. ":atom_js2c_copy",
  79. ]
  80. inputs = [
  81. "lib/isolated_renderer/init.js",
  82. ]
  83. outputs = [
  84. "$target_gen_dir/js2c/isolated_bundle.js",
  85. ]
  86. script = "browserify"
  87. args = inputs + [
  88. "-t",
  89. "aliasify",
  90. "-o",
  91. rebase_path(outputs[0]),
  92. ]
  93. }
  94. copy("atom_js2c_copy") {
  95. sources = [
  96. "lib/common/asar.js",
  97. "lib/common/asar_init.js",
  98. ]
  99. outputs = [
  100. "$target_gen_dir/js2c/{{source_file_part}}",
  101. ]
  102. }
  103. action("atom_js2c") {
  104. deps = [
  105. ":atom_browserify_isolated",
  106. ":atom_browserify_sandbox",
  107. ":atom_js2c_copy",
  108. ]
  109. js2c_sources = filenames.js2c_sources
  110. browserify_sources = [
  111. "$target_gen_dir/js2c/isolated_bundle.js",
  112. "$target_gen_dir/js2c/preload_bundle.js",
  113. ]
  114. inputs = js2c_sources + browserify_sources
  115. outputs = [
  116. "$target_gen_dir/atom_natives.h",
  117. ]
  118. script = "tools/js2c.py"
  119. args = [ rebase_path("//third_party/electron_node") ] +
  120. rebase_path(outputs, root_build_dir) +
  121. [ rebase_path("$target_gen_dir/js2c", root_build_dir) ]
  122. }
  123. asar("js2asar") {
  124. sources = filenames.js_sources
  125. if (enable_desktop_capturer) {
  126. sources += [
  127. "lib/browser/desktop-capturer.js",
  128. "lib/renderer/api/desktop-capturer.js",
  129. ]
  130. }
  131. if (enable_view_api) {
  132. sources += [
  133. "lib/browser/api/views/box-layout.js",
  134. "lib/browser/api/views/button.js",
  135. "lib/browser/api/views/label-button.js",
  136. "lib/browser/api/views/layout-manager.js",
  137. "lib/browser/api/views/text-field.js",
  138. ]
  139. }
  140. outputs = [
  141. "$root_out_dir/resources/electron.asar",
  142. ]
  143. root = "lib"
  144. }
  145. asar("app2asar") {
  146. sources = filenames.default_app_sources
  147. outputs = [
  148. "$root_out_dir/resources/default_app.asar",
  149. ]
  150. root = "default_app"
  151. }
  152. grit("resources") {
  153. source = "electron_resources.grd"
  154. outputs = [
  155. "grit/electron_resources.h",
  156. "electron_resources.pak",
  157. ]
  158. grit_flags = [
  159. "-E",
  160. "target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir),
  161. ]
  162. deps = [
  163. ":electron_content_manifest_overlays",
  164. ]
  165. output_dir = "$target_gen_dir"
  166. }
  167. static_library("electron_lib") {
  168. configs += [ "//v8:external_startup_data" ]
  169. configs += [ "//third_party/electron_node:node_internals" ]
  170. public_configs = [ ":branding" ]
  171. deps = [
  172. ":atom_js2c",
  173. "brightray",
  174. "buildflags",
  175. "chromium_src:chrome",
  176. "native_mate",
  177. "//base",
  178. "//base:i18n",
  179. "//chrome/common",
  180. "//components/certificate_transparency",
  181. "//components/net_log",
  182. "//components/network_session_configurator/common",
  183. "//components/prefs",
  184. "//components/viz/service",
  185. "//content/public/app:both",
  186. "//content/public/child",
  187. "//content/public/common:service_names",
  188. "//gin",
  189. "//media/mojo/interfaces",
  190. "//net:net_resources",
  191. "//ppapi/host",
  192. "//ppapi/proxy",
  193. "//ppapi/shared_impl",
  194. "//services/proxy_resolver:lib",
  195. "//skia",
  196. "//third_party/blink/public:blink",
  197. "//third_party/boringssl",
  198. "//third_party/electron_node:node_lib",
  199. "//third_party/leveldatabase",
  200. "//third_party/libyuv",
  201. "//third_party/webrtc_overrides:init_webrtc",
  202. "//third_party/widevine/cdm:headers",
  203. "//ui/events:dom_keycode_converter",
  204. "//ui/gl",
  205. "//ui/views",
  206. "//v8",
  207. ]
  208. # TODO: this requires a visibility patch to chromium src. it would be better
  209. # to use the publicly-available API, which I think is mojo-based. Once
  210. # electron switches to using the public API, we can remove this from the deps
  211. # list and remove the visibility patch from chromium.
  212. deps += [ "//services/device/wake_lock/power_save_blocker" ]
  213. include_dirs = [
  214. "chromium_src",
  215. ".",
  216. "$target_gen_dir",
  217. # TODO(nornagon): replace usage of SchemeRegistry by an actually exported
  218. # API of blink, then remove this from the include_dirs.
  219. "//third_party/blink/renderer",
  220. ]
  221. defines = []
  222. libs = []
  223. extra_source_filters = []
  224. if (!is_linux) {
  225. extra_source_filters += [
  226. "*\bx/*",
  227. "*_x11.h",
  228. "*_x11.cc",
  229. "*_gtk.h",
  230. "*_gtk.cc",
  231. "*\blibrary_loaders/*",
  232. ]
  233. }
  234. if (!is_win) {
  235. extra_source_filters += [
  236. "*\bwin_*.h",
  237. "*\bwin_*.cc",
  238. ]
  239. }
  240. if (!is_posix) {
  241. extra_source_filters += [
  242. "*_posix.cc",
  243. "*_posix.h",
  244. ]
  245. }
  246. if (is_mac) {
  247. extra_source_filters += [
  248. "*_views.cc",
  249. "*_views.h",
  250. "*\bviews/*",
  251. "*/autofill_popup.cc",
  252. "*/autofill_popup.h",
  253. ]
  254. }
  255. set_sources_assignment_filter(
  256. sources_assignment_filter + extra_source_filters)
  257. sources = filenames.lib_sources
  258. set_sources_assignment_filter(sources_assignment_filter)
  259. sources += [ "$target_gen_dir/atom_natives.h" ]
  260. if (is_component_build) {
  261. defines += [ "NODE_SHARED_MODE" ]
  262. }
  263. if (enable_fake_location_provider) {
  264. sources += [
  265. "atom/browser/fake_location_provider.cc",
  266. "atom/browser/fake_location_provider.h",
  267. ]
  268. }
  269. if (is_mac) {
  270. deps += [
  271. "//third_party/crashpad/crashpad/client",
  272. "//ui/accelerated_widget_mac",
  273. ]
  274. include_dirs += [
  275. # NOTE(nornagon): other chromium files use the full path to include
  276. # crashpad; this is just here for compatibility between GN and GYP, so that
  277. # the #includes can be agnostic about where crashpad is vendored.
  278. "//third_party/crashpad",
  279. ]
  280. if (is_mas_build) {
  281. deps -= [ "//third_party/crashpad/crashpad/client" ]
  282. sources += [ "atom/browser/api/atom_api_app_mas.mm" ]
  283. sources -= [
  284. "atom/browser/auto_updater_mac.mm",
  285. "atom/common/crash_reporter/crash_reporter_mac.h",
  286. "atom/common/crash_reporter/crash_reporter_mac.mm",
  287. ]
  288. defines += [ "MAS_BUILD" ]
  289. } else {
  290. libs += [
  291. "Squirrel.framework",
  292. "ReactiveCocoa.framework",
  293. "Mantle.framework",
  294. ]
  295. cflags_objcc = [
  296. "-F",
  297. rebase_path("external_binaries", root_build_dir),
  298. ]
  299. # ReactiveCocoa which is used by Squirrel requires using __weak.
  300. cflags_objcc += [ "-fobjc-weak" ]
  301. }
  302. }
  303. if (is_linux) {
  304. deps += [
  305. "//build/config/linux/gtk",
  306. "//chrome/browser/ui/libgtkui",
  307. "//device/bluetooth",
  308. "//ui/events/devices/x11",
  309. "//ui/events/platform/x11",
  310. "//ui/native_theme",
  311. "//ui/views/controls/webview",
  312. "//ui/wm",
  313. ]
  314. configs += [ ":gio_unix" ]
  315. defines += [
  316. # Disable warnings for g_settings_list_schemas.
  317. "GLIB_DISABLE_DEPRECATION_WARNINGS",
  318. ]
  319. sources += filenames.lib_sources_nss
  320. }
  321. if (is_win) {
  322. libs += [ "dwmapi.lib" ]
  323. }
  324. if (is_linux || is_win) {
  325. deps += [ "//third_party/breakpad:client" ]
  326. include_dirs += [ "//third_party/breakpad" ]
  327. }
  328. if (enable_pdf) {
  329. deps += [ "//pdf" ]
  330. }
  331. if (enable_run_as_node) {
  332. sources += [
  333. "atom/app/node_main.cc",
  334. "atom/app/node_main.h",
  335. ]
  336. }
  337. if (enable_osr) {
  338. sources += [
  339. "atom/browser/api/atom_api_web_contents_osr.cc",
  340. "atom/browser/osr/osr_output_device.cc",
  341. "atom/browser/osr/osr_output_device.h",
  342. "atom/browser/osr/osr_render_widget_host_view.cc",
  343. "atom/browser/osr/osr_render_widget_host_view.h",
  344. "atom/browser/osr/osr_render_widget_host_view_mac.mm",
  345. "atom/browser/osr/osr_view_proxy.cc",
  346. "atom/browser/osr/osr_view_proxy.h",
  347. "atom/browser/osr/osr_web_contents_view.cc",
  348. "atom/browser/osr/osr_web_contents_view.h",
  349. "atom/browser/osr/osr_web_contents_view_mac.mm",
  350. ]
  351. deps += [
  352. "//components/viz/service",
  353. "//services/viz/public/interfaces",
  354. "//ui/compositor",
  355. ]
  356. }
  357. if (enable_desktop_capturer) {
  358. if (is_component_build && is_win) {
  359. # On windows the implementation relies on unexported
  360. # DxgiDuplicatorController class.
  361. deps += [ "//third_party/webrtc/modules/desktop_capture" ]
  362. }
  363. sources += [
  364. "atom/browser/api/atom_api_desktop_capturer.cc",
  365. "atom/browser/api/atom_api_desktop_capturer.h",
  366. ]
  367. }
  368. if (enable_view_api) {
  369. sources += [
  370. "atom/browser/api/views/atom_api_box_layout.cc",
  371. "atom/browser/api/views/atom_api_box_layout.h",
  372. "atom/browser/api/views/atom_api_button.cc",
  373. "atom/browser/api/views/atom_api_button.h",
  374. "atom/browser/api/views/atom_api_label_button.cc",
  375. "atom/browser/api/views/atom_api_label_button.h",
  376. "atom/browser/api/views/atom_api_layout_manager.cc",
  377. "atom/browser/api/views/atom_api_layout_manager.h",
  378. "atom/browser/api/views/atom_api_text_field.cc",
  379. "atom/browser/api/views/atom_api_text_field.h",
  380. ]
  381. }
  382. if (enable_basic_printing) {
  383. deps += [
  384. "//chrome/common:mojo_bindings",
  385. "//chrome/services/printing:lib",
  386. "//components/printing/browser",
  387. "//components/printing/common",
  388. "//components/printing/renderer",
  389. "//components/services/pdf_compositor/public/cpp:utils",
  390. "//components/services/pdf_compositor/public/interfaces",
  391. "//printing",
  392. ]
  393. sources += [
  394. "//chrome/browser/printing/print_job.cc",
  395. "//chrome/browser/printing/print_job.h",
  396. "//chrome/browser/printing/print_job_manager.cc",
  397. "//chrome/browser/printing/print_job_manager.h",
  398. "//chrome/browser/printing/print_job_worker.cc",
  399. "//chrome/browser/printing/print_job_worker.h",
  400. "//chrome/browser/printing/print_preview_message_handler.cc",
  401. "//chrome/browser/printing/print_preview_message_handler.h",
  402. "//chrome/browser/printing/print_view_manager_base.cc",
  403. "//chrome/browser/printing/print_view_manager_base.h",
  404. "//chrome/browser/printing/print_view_manager_basic.cc",
  405. "//chrome/browser/printing/print_view_manager_basic.h",
  406. "//chrome/browser/printing/print_view_manager_common.cc",
  407. "//chrome/browser/printing/print_view_manager_common.h",
  408. "//chrome/browser/printing/printer_manager_dialog.h",
  409. "//chrome/browser/printing/printer_manager_dialog_linux.cc",
  410. "//chrome/browser/printing/printer_manager_dialog_mac.mm",
  411. "//chrome/browser/printing/printer_manager_dialog_win.cc",
  412. "//chrome/browser/printing/printer_query.cc",
  413. "//chrome/browser/printing/printer_query.h",
  414. "//chrome/browser/printing/printing_message_filter.cc",
  415. "//chrome/browser/printing/printing_message_filter.h",
  416. "//chrome/renderer/prerender/prerender_dispatcher.cc",
  417. "//chrome/renderer/prerender/prerender_dispatcher.h",
  418. "//chrome/renderer/prerender/prerender_extra_data.cc",
  419. "//chrome/renderer/prerender/prerender_extra_data.h",
  420. "//chrome/renderer/prerender/prerender_helper.cc",
  421. "//chrome/renderer/prerender/prerender_helper.h",
  422. "//chrome/renderer/prerender/prerenderer_client.cc",
  423. "//chrome/renderer/prerender/prerenderer_client.h",
  424. "//chrome/renderer/printing/chrome_print_render_frame_helper_delegate.cc",
  425. "//chrome/renderer/printing/chrome_print_render_frame_helper_delegate.h",
  426. "//electron/atom/browser/atom_print_preview_message_handler.cc",
  427. "//electron/atom/browser/atom_print_preview_message_handler.h",
  428. ]
  429. if (is_win) {
  430. sources += [
  431. "//chrome/browser/printing/pdf_to_emf_converter.cc",
  432. "//chrome/browser/printing/pdf_to_emf_converter.h",
  433. "//chrome/utility/printing_handler.cc",
  434. "//chrome/utility/printing_handler.h",
  435. ]
  436. }
  437. }
  438. if (enable_pepper_flash) {
  439. deps += [ "components/pepper_flash" ]
  440. }
  441. }
  442. electron_paks("packed_resources") {
  443. if (is_mac) {
  444. output_dir = "$root_gen_dir/electron_repack"
  445. copy_data_to_bundle = true
  446. } else {
  447. output_dir = root_out_dir
  448. }
  449. }
  450. if (is_mac) {
  451. electron_framework_name = "$electron_product_name Framework"
  452. electron_helper_name = "$electron_product_name Helper"
  453. electron_login_helper_name = "$electron_product_name Login Helper"
  454. electron_framework_version = "A"
  455. mac_xib_bundle_data("electron_xibs") {
  456. sources = [
  457. "atom/common/resources/mac/MainMenu.xib",
  458. ]
  459. }
  460. bundle_data("electron_framework_resources") {
  461. public_deps = [
  462. ":packed_resources",
  463. ]
  464. sources = []
  465. if (icu_use_data_file) {
  466. sources += [ "$root_out_dir/icudtl.dat" ]
  467. public_deps += [ "//third_party/icu:icudata" ]
  468. }
  469. if (v8_use_external_startup_data) {
  470. sources += [ "$root_out_dir/natives_blob.bin" ]
  471. public_deps += [ "//v8" ]
  472. if (use_v8_context_snapshot) {
  473. sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
  474. public_deps += [ "//tools/v8_context_snapshot" ]
  475. } else {
  476. sources += [ "$root_out_dir/snapshot_blob.bin" ]
  477. }
  478. }
  479. outputs = [
  480. "{{bundle_resources_dir}}/{{source_file_part}}",
  481. ]
  482. }
  483. if (!is_component_build) {
  484. bundle_data("electron_framework_libraries") {
  485. sources = []
  486. public_deps = []
  487. if (is_component_ffmpeg) {
  488. sources += [ "$root_out_dir/libffmpeg.dylib" ]
  489. public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
  490. }
  491. outputs = [
  492. "{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
  493. ]
  494. }
  495. } else {
  496. group("electron_framework_libraries") {
  497. }
  498. }
  499. bundle_data("electron_crashpad_helper") {
  500. sources = [
  501. "$root_out_dir/crashpad_handler",
  502. ]
  503. outputs = [
  504. "{{bundle_resources_dir}}/{{source_file_part}}",
  505. ]
  506. public_deps = [
  507. "//third_party/crashpad/crashpad/handler:crashpad_handler",
  508. ]
  509. }
  510. mac_framework_bundle("electron_framework") {
  511. output_name = electron_framework_name
  512. framework_version = electron_framework_version
  513. framework_contents = [
  514. "Resources",
  515. "Libraries",
  516. ]
  517. public_deps = [
  518. ":electron_lib",
  519. ]
  520. deps = [
  521. ":electron_framework_libraries",
  522. ":electron_framework_resources",
  523. ":electron_xibs",
  524. ]
  525. if (!is_mas_build) {
  526. deps += [ ":electron_crashpad_helper" ]
  527. }
  528. info_plist = "atom/common/resources/mac/Info.plist"
  529. electron_version = read_file("VERSION", "trim string")
  530. extra_substitutions = [
  531. "ATOM_BUNDLE_ID=$electron_mac_bundle_id.framework",
  532. "ELECTRON_VERSION=$electron_version",
  533. ]
  534. include_dirs = [ "." ]
  535. sources = filenames.framework_sources
  536. libs = [
  537. "Carbon.framework",
  538. "QuartzCore.framework",
  539. "Quartz.framework",
  540. "Security.framework",
  541. "SecurityInterface.framework",
  542. "ServiceManagement.framework",
  543. "StoreKit.framework",
  544. ]
  545. ldflags = [
  546. "-F",
  547. rebase_path("external_binaries", root_build_dir),
  548. "-Wl,-install_name,@rpath/$output_name.framework/$output_name",
  549. "-rpath",
  550. "@loader_path/Libraries",
  551. ]
  552. if (is_component_build) {
  553. ldflags += [
  554. "-rpath",
  555. "@executable_path/../../../../../..",
  556. ]
  557. }
  558. }
  559. mac_app_bundle("electron_helper_app") {
  560. output_name = electron_helper_name
  561. deps = [
  562. ":electron_framework+link",
  563. ]
  564. sources = filenames.app_sources
  565. include_dirs = [ "." ]
  566. info_plist = "atom/renderer/resources/mac/Info.plist"
  567. extra_substitutions = [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
  568. ldflags = [
  569. "-rpath",
  570. "@executable_path/../../..",
  571. ]
  572. }
  573. bundle_data("electron_app_framework_bundle_data") {
  574. sources = [
  575. "$root_out_dir/$electron_framework_name.framework",
  576. "$root_out_dir/$electron_helper_name.app",
  577. ]
  578. if (!is_mas_build) {
  579. sources += [
  580. "external_binaries/Mantle.framework",
  581. "external_binaries/ReactiveCocoa.framework",
  582. "external_binaries/Squirrel.framework",
  583. ]
  584. }
  585. outputs = [
  586. "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
  587. ]
  588. public_deps = [
  589. ":electron_framework+link",
  590. ":electron_helper_app",
  591. ]
  592. }
  593. mac_app_bundle("electron_login_helper") {
  594. output_name = electron_login_helper_name
  595. sources = filenames.login_helper_sources
  596. include_dirs = [ "." ]
  597. libs = [ "AppKit.framework" ]
  598. info_plist = "atom/app/resources/mac/loginhelper-Info.plist"
  599. extra_substitutions =
  600. [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id.loginhelper" ]
  601. }
  602. bundle_data("electron_login_helper_app") {
  603. public_deps = [
  604. ":electron_login_helper",
  605. ]
  606. sources = [
  607. "$root_out_dir/$electron_login_helper_name.app",
  608. ]
  609. outputs = [
  610. "{{bundle_contents_dir}}/Library/LoginItems",
  611. ]
  612. }
  613. bundle_data("electron_app_resources") {
  614. public_deps = [
  615. ":app2asar",
  616. ":js2asar",
  617. ]
  618. sources = [
  619. "$root_out_dir/resources/default_app.asar",
  620. "$root_out_dir/resources/electron.asar",
  621. "atom/browser/resources/mac/electron.icns",
  622. ]
  623. outputs = [
  624. "{{bundle_resources_dir}}/{{source_file_part}}",
  625. ]
  626. }
  627. mac_app_bundle("electron_app") {
  628. output_name = electron_product_name
  629. sources = filenames.app_sources
  630. include_dirs = [ "." ]
  631. deps = [
  632. ":electron_app_framework_bundle_data",
  633. ":electron_app_resources",
  634. ]
  635. if (is_mas_build) {
  636. deps += [ ":electron_login_helper_app" ]
  637. }
  638. info_plist = "atom/browser/resources/mac/Info.plist"
  639. extra_substitutions = [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id" ]
  640. ldflags = [
  641. "-rpath",
  642. "@executable_path/../Frameworks",
  643. ]
  644. }
  645. } else {
  646. windows_manifest("electron_app_manifest") {
  647. sources = [
  648. "atom/browser/resources/win/disable_window_filtering.manifest",
  649. "atom/browser/resources/win/dpi_aware.manifest",
  650. as_invoker_manifest,
  651. common_controls_manifest,
  652. default_compatibility_manifest,
  653. ]
  654. }
  655. executable("electron_app") {
  656. output_name = electron_project_name
  657. sources = filenames.app_sources
  658. include_dirs = [ "." ]
  659. deps = [
  660. ":app2asar",
  661. ":electron_app_manifest",
  662. ":electron_lib",
  663. ":js2asar",
  664. ":packed_resources",
  665. "//content:sandbox_helper_win",
  666. "//ui/strings",
  667. ]
  668. data = []
  669. data += [ "$root_out_dir/resources.pak" ]
  670. data += [ "$root_out_dir/chrome_100_percent.pak" ]
  671. if (enable_hidpi) {
  672. data += [ "$root_out_dir/chrome_200_percent.pak" ]
  673. }
  674. foreach(locale, locales) {
  675. data += [ "$root_out_dir/locales/$locale.pak" ]
  676. }
  677. if (!is_mac) {
  678. data += [ "$root_out_dir/resources/default_app.asar" ]
  679. data += [ "$root_out_dir/resources/electron.asar" ]
  680. }
  681. public_deps = [
  682. "//tools/v8_context_snapshot:v8_context_snapshot",
  683. ]
  684. if (is_win) {
  685. sources += [
  686. # TODO: we should be generating our .rc files more like how chrome does
  687. "atom/browser/resources/win/atom.ico",
  688. "atom/browser/resources/win/atom.rc",
  689. "atom/browser/resources/win/resources.h",
  690. ]
  691. deps += [
  692. "//third_party/breakpad:breakpad_handler",
  693. "//third_party/breakpad:breakpad_sender",
  694. "//ui/native_theme:native_theme_browser",
  695. "//ui/shell_dialogs",
  696. "//ui/views/controls/webview",
  697. "//ui/wm",
  698. "//ui/wm/public",
  699. ]
  700. libs = [
  701. "comctl32.lib",
  702. "uiautomationcore.lib",
  703. "wtsapi32.lib",
  704. ]
  705. configs += [ "//build/config/win:windowed" ]
  706. ldflags = [
  707. # Windows 7 doesn't have these DLLs.
  708. # TODO: are there other DLLs we need to list here to be win7
  709. # compatible?
  710. "/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
  711. "/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
  712. ]
  713. # This is to support renaming of electron.exe. node-gyp has hard-coded
  714. # executable names which it will recognise as node. This module definition
  715. # file claims that the electron executable is in fact named "node.exe",
  716. # which is one of the executable names that node-gyp recognizes.
  717. # See https://github.com/nodejs/node-gyp/commit/52ceec3a6d15de3a8f385f43dbe5ecf5456ad07a
  718. ldflags += [ "/DEF:" + rebase_path("build/electron.def", root_build_dir) ]
  719. inputs = [
  720. "build/electron.def",
  721. ]
  722. }
  723. if (is_linux) {
  724. ldflags = [ "-pie" ]
  725. if (!is_component_build && is_component_ffmpeg) {
  726. configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
  727. }
  728. }
  729. }
  730. }
  731. group("electron_tests") {
  732. testonly = true
  733. deps = [
  734. ":chromium_browsertests",
  735. ":chromium_unittests",
  736. ]
  737. }
  738. group("chromium_unittests") {
  739. testonly = true
  740. deps = [
  741. "//base:base_unittests",
  742. "//cc:cc_unittests",
  743. "//content/test:content_unittests",
  744. "//crypto:crypto_unittests",
  745. "//device:device_unittests",
  746. "//gin:gin_unittests",
  747. "//gpu:gpu_unittests",
  748. "//ipc:ipc_tests",
  749. "//media:media_unittests",
  750. "//media/capture:capture_unittests",
  751. "//media/midi:midi_unittests",
  752. "//media/mojo:media_mojo_unittests",
  753. "//mojo:mojo_unittests",
  754. "//net:net_unittests",
  755. "//ppapi:ppapi_unittests",
  756. "//skia:skia_unittests",
  757. "//sql:sql_unittests",
  758. "//storage:storage_unittests",
  759. "//third_party/angle/src/tests:angle_unittests",
  760. "//third_party/blink/public:all_blink",
  761. "//third_party/blink/public:test_support",
  762. "//third_party/leveldatabase:env_chromium_unittests",
  763. "//ui/base:ui_base_unittests",
  764. "//ui/compositor:compositor_unittests",
  765. "//ui/display:display_unittests",
  766. "//ui/events:events_unittests",
  767. "//ui/gl:gl_unittests",
  768. "//url:url_unittests",
  769. "//url/ipc:url_ipc_unittests",
  770. "//v8/test/unittests:unittests",
  771. ]
  772. if (enable_basic_printing) {
  773. deps += [ "//printing:printing_unittests" ]
  774. }
  775. if (is_linux) {
  776. deps += [
  777. "//net:disk_cache_memory_test",
  778. "//sandbox/linux:sandbox_linux_unittests",
  779. ]
  780. if (use_dbus) {
  781. deps += [ "//dbus:dbus_unittests" ]
  782. }
  783. }
  784. }
  785. group("chromium_browsertests") {
  786. testonly = true
  787. deps = [
  788. "//content/test:content_browsertests",
  789. ]
  790. }
  791. template("dist_zip") {
  792. _runtime_deps_target = "${target_name}__deps"
  793. _runtime_deps_file =
  794. "$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + "/" +
  795. get_label_info(target_name, "name") + ".runtime_deps"
  796. group(_runtime_deps_target) {
  797. forward_variables_from(invoker,
  798. [
  799. "deps",
  800. "data_deps",
  801. "data",
  802. ])
  803. write_runtime_deps = _runtime_deps_file
  804. }
  805. action(target_name) {
  806. script = "//electron/build/zip.py"
  807. deps = [
  808. ":$_runtime_deps_target",
  809. ]
  810. forward_variables_from(invoker, [ "outputs" ])
  811. args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
  812. target_cpu,
  813. target_os,
  814. ]
  815. }
  816. }
  817. copy("electron_license") {
  818. sources = [
  819. "LICENSE",
  820. ]
  821. outputs = [
  822. "$root_build_dir/{{source_file_part}}",
  823. ]
  824. }
  825. copy("chromium_licenses") {
  826. deps = [
  827. "//components/resources:about_credits",
  828. ]
  829. sources = [
  830. "$root_gen_dir/components/resources/about_credits.html",
  831. ]
  832. outputs = [
  833. "$root_build_dir/LICENSES.chromium.html",
  834. ]
  835. }
  836. group("licenses") {
  837. data_deps = [
  838. ":electron_license",
  839. ":chromium_licenses",
  840. ]
  841. }
  842. copy("electron_version") {
  843. sources = [
  844. "VERSION",
  845. ]
  846. outputs = [
  847. "$root_build_dir/version",
  848. ]
  849. }
  850. dist_zip("electron_dist_zip") {
  851. data_deps = [
  852. ":electron_app",
  853. ":licenses",
  854. ":electron_version",
  855. ]
  856. outputs = [
  857. "$root_build_dir/dist.zip",
  858. ]
  859. }
  860. dist_zip("electron_ffmpeg_zip") {
  861. data_deps = [
  862. "//third_party/ffmpeg",
  863. ]
  864. outputs = [
  865. "$root_build_dir/ffmpeg.zip",
  866. ]
  867. }
  868. dist_zip("electron_chromedriver_zip") {
  869. data_deps = [
  870. "//chrome/test/chromedriver",
  871. ":licenses",
  872. ]
  873. outputs = [
  874. "$root_build_dir/chromedriver.zip",
  875. ]
  876. }
  877. dist_zip("electron_mksnapshot_zip") {
  878. data_deps = [
  879. "//v8:mksnapshot($v8_snapshot_toolchain)",
  880. ":licenses",
  881. ]
  882. outputs = [
  883. "$root_build_dir/mksnapshot.zip",
  884. ]
  885. }
  886. group("electron") {
  887. deps = [
  888. ":electron_app",
  889. ]
  890. }
  891. group("electron_content_manifest_overlays") {
  892. deps = [
  893. ":electron_content_browser_manifest_overlay",
  894. ":electron_content_packaged_services_manifest_overlay",
  895. ]
  896. }
  897. service_manifest("electron_content_packaged_services_manifest_overlay") {
  898. source = "//electron/manifests/electron_content_packaged_services_manifest_overlay.json"
  899. packaged_services = [ "//services/proxy_resolver:proxy_resolver_manifest" ]
  900. if (enable_basic_printing) {
  901. packaged_services += [ "//chrome/services/printing:manifest" ]
  902. }
  903. }
  904. service_manifest("electron_content_browser_manifest_overlay") {
  905. source = "//electron/manifests/electron_content_browser_manifest_overlay.json"
  906. }