1 Star 0 Fork 0

麻本法 / electron

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
BUILD.gn 36.98 KB
一键复制 编辑 原始数据 按行查看 历史
Jeremy Apthorp 提交于 2020-02-12 16:39 . feat: enable pdf viewer (#21794)
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295
import("//build/config/locales.gni")
import("//build/config/ui.gni")
import("//build/config/win/manifest.gni")
import("//components/spellcheck/spellcheck_build_features.gni")
import("//content/public/app/mac_helpers.gni")
import("//pdf/features.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni")
import("//testing/test.gni")
import("//third_party/ffmpeg/ffmpeg_options.gni")
import("//tools/generate_library_loader/generate_library_loader.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//v8/gni/snapshot_toolchain.gni")
import("build/asar.gni")
import("build/extract_symbols.gni")
import("build/npm.gni")
import("build/templated_file.gni")
import("build/tsc.gni")
import("build/webpack/webpack.gni")
import("buildflags/buildflags.gni")
import("electron_paks.gni")
import("filenames.auto.gni")
import("filenames.gni")
import("filenames.hunspell.gni")
if (is_mac) {
import("//build/config/mac/rules.gni")
import("//third_party/icu/config.gni")
import("//ui/gl/features.gni")
import("//v8/gni/v8.gni")
import("build/rules.gni")
}
if (is_linux) {
import("//build/config/linux/pkg_config.gni")
pkg_config("gio_unix") {
packages = [ "gio-unix-2.0" ]
}
pkg_config("libnotify_config") {
packages = [
"glib-2.0",
"gdk-pixbuf-2.0",
]
}
}
branding = read_file("shell/app/BRANDING.json", "json")
electron_project_name = branding.project_name
electron_product_name = branding.product_name
electron_mac_bundle_id = branding.mac_bundle_id
if (is_mas_build) {
assert(is_mac,
"It doesn't make sense to build a MAS build on a non-mac platform")
}
config("branding") {
defines = [
"ELECTRON_PRODUCT_NAME=\"$electron_product_name\"",
"ELECTRON_PROJECT_NAME=\"$electron_project_name\"",
]
}
config("electron_lib_config") {
include_dirs = [ "." ]
}
# We geneate the definitions twice here, once in //electron/electron.d.ts
# and once in $target_gen_dir
# The one in $target_gen_dir is used for the actual TSC build later one
# and the one in //electron/electron.d.ts is used by your IDE (vscode)
# for typescript prompting
npm_action("build_electron_definitions") {
script = "gn-typescript-definitions"
args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
inputs = auto_filenames.api_docs + [ "yarn.lock" ]
outputs = [ "$target_gen_dir/tsc/typings/electron.d.ts" ]
}
webpack_build("electron_browser_bundle") {
deps = [ ":build_electron_definitions" ]
inputs = auto_filenames.browser_bundle_deps
config_file = "//electron/build/webpack/webpack.config.browser.js"
out_file = "$target_gen_dir/js2c/browser_init.js"
}
webpack_build("electron_renderer_bundle") {
deps = [ ":build_electron_definitions" ]
inputs = auto_filenames.renderer_bundle_deps
config_file = "//electron/build/webpack/webpack.config.renderer.js"
out_file = "$target_gen_dir/js2c/renderer_init.js"
}
webpack_build("electron_worker_bundle") {
deps = [ ":build_electron_definitions" ]
inputs = auto_filenames.worker_bundle_deps
config_file = "//electron/build/webpack/webpack.config.worker.js"
out_file = "$target_gen_dir/js2c/worker_init.js"
}
webpack_build("electron_sandboxed_renderer_bundle") {
deps = [ ":build_electron_definitions" ]
inputs = auto_filenames.sandbox_bundle_deps
config_file = "//electron/build/webpack/webpack.config.sandboxed_renderer.js"
out_file = "$target_gen_dir/js2c/sandbox_bundle.js"
}
webpack_build("electron_isolated_renderer_bundle") {
deps = [ ":build_electron_definitions" ]
inputs = auto_filenames.isolated_bundle_deps
config_file = "//electron/build/webpack/webpack.config.isolated_renderer.js"
out_file = "$target_gen_dir/js2c/isolated_bundle.js"
}
webpack_build("electron_content_script_bundle") {
deps = [ ":build_electron_definitions" ]
inputs = auto_filenames.content_script_bundle_deps
config_file = "//electron/build/webpack/webpack.config.content_script.js"
out_file = "$target_gen_dir/js2c/content_script_bundle.js"
}
copy("electron_js2c_copy") {
sources = [
"lib/common/asar.js",
"lib/common/asar_init.js",
]
outputs = [ "$target_gen_dir/js2c/{{source_file_part}}" ]
}
action("electron_js2c") {
deps = [
":electron_browser_bundle",
":electron_content_script_bundle",
":electron_isolated_renderer_bundle",
":electron_js2c_copy",
":electron_renderer_bundle",
":electron_sandboxed_renderer_bundle",
":electron_worker_bundle",
]
webpack_sources = [
"$target_gen_dir/js2c/browser_init.js",
"$target_gen_dir/js2c/content_script_bundle.js",
"$target_gen_dir/js2c/isolated_bundle.js",
"$target_gen_dir/js2c/renderer_init.js",
"$target_gen_dir/js2c/sandbox_bundle.js",
"$target_gen_dir/js2c/worker_init.js",
]
sources = webpack_sources + [
"$target_gen_dir/js2c/asar.js",
"$target_gen_dir/js2c/asar_init.js",
]
inputs = sources + [ "//third_party/electron_node/tools/js2c.py" ]
outputs = [ "$root_gen_dir/electron_natives.cc" ]
script = "tools/js2c.py"
args = [ rebase_path("//third_party/electron_node") ] +
rebase_path(outputs, root_build_dir) +
rebase_path(sources, root_build_dir)
}
target_gen_default_app_js = "$target_gen_dir/js/default_app"
typescript_build("default_app_js") {
deps = [ ":build_electron_definitions" ]
type_root = rebase_path("$target_gen_dir/tsc/electron/typings")
sources = filenames.default_app_ts_sources
output_gen_dir = target_gen_default_app_js
output_dir_name = "default_app"
tsconfig = "tsconfig.default_app.json"
}
copy("default_app_static") {
sources = filenames.default_app_static_sources
outputs = [ "$target_gen_default_app_js/{{source}}" ]
}
copy("default_app_octicon_deps") {
sources = filenames.default_app_octicon_sources
outputs = [ "$target_gen_default_app_js/electron/default_app/octicon/{{source_file_part}}" ]
}
asar("default_app_asar") {
deps = [
":default_app_js",
":default_app_octicon_deps",
":default_app_static",
]
root = "$target_gen_default_app_js/electron/default_app"
sources = get_target_outputs(":default_app_js") +
get_target_outputs(":default_app_static") +
get_target_outputs(":default_app_octicon_deps")
outputs = [ "$root_out_dir/resources/default_app.asar" ]
}
grit("resources") {
source = "electron_resources.grd"
outputs = [
"grit/electron_resources.h",
"electron_resources.pak",
]
# Mojo manifest overlays are generated.
source_is_generated = true
grit_flags = [
"-E",
"target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir),
]
deps = [ ":copy_shell_devtools_discovery_page" ]
output_dir = "$target_gen_dir"
}
copy("copy_shell_devtools_discovery_page") {
sources = [ "//content/shell/resources/shell_devtools_discovery_page.html" ]
outputs = [ "$target_gen_dir/shell_devtools_discovery_page.html" ]
}
if (is_linux) {
generate_library_loader("libnotify_loader") {
name = "LibNotifyLoader"
output_h = "libnotify_loader.h"
output_cc = "libnotify_loader.cc"
header = "<libnotify/notify.h>"
config = ":libnotify_config"
functions = [
"notify_is_initted",
"notify_init",
"notify_get_server_caps",
"notify_get_server_info",
"notify_notification_new",
"notify_notification_add_action",
"notify_notification_set_image_from_pixbuf",
"notify_notification_set_timeout",
"notify_notification_set_urgency",
"notify_notification_set_hint_string",
"notify_notification_show",
"notify_notification_close",
]
}
}
source_set("manifests") {
sources = [
"//electron/shell/app/manifests.cc",
"//electron/shell/app/manifests.h",
]
include_dirs = [ "//electron" ]
deps = [
"//electron/shell/common/api:mojo",
"//printing/buildflags",
"//services/service_manager/public/cpp",
]
}
npm_action("electron_version_args") {
script = "generate-version-json"
outputs = [ "$target_gen_dir/electron_version.args" ]
args = rebase_path(outputs)
inputs = [
"ELECTRON_VERSION",
"script/generate-version-json.js",
]
}
templated_file("electron_version_header") {
deps = [ ":electron_version_args" ]
template = "build/templates/electron_version.tmpl"
output = "$target_gen_dir/electron_version.h"
args_files = get_target_outputs(":electron_version_args")
}
source_set("electron_lib") {
configs += [ "//v8:external_startup_data" ]
configs += [ "//third_party/electron_node:node_internals" ]
public_configs = [
":branding",
":electron_lib_config",
]
deps = [
":electron_js2c",
":electron_version_header",
":manifests",
":resources",
"buildflags",
"chromium_src:chrome",
"chromium_src:chrome_spellchecker",
"shell/common/api:mojo",
"//base:base_static",
"//base/allocator:buildflags",
"//chrome/app/resources:platform_locale_settings",
"//chrome/services/printing/public/mojom",
"//components/certificate_transparency",
"//components/language/core/browser",
"//components/net_log",
"//components/network_hints/browser",
"//components/network_hints/common:mojo_bindings",
"//components/network_hints/renderer",
"//components/network_session_configurator/common",
"//components/prefs",
"//components/viz/host",
"//components/viz/service",
"//content/public/browser",
"//content/public/child",
"//content/public/common:service_names",
"//content/public/gpu",
"//content/public/renderer",
"//content/public/utility",
"//device/bluetooth",
"//device/bluetooth/public/cpp",
"//gin",
"//media/capture/mojom:video_capture",
"//media/mojo/mojom",
"//net:extras",
"//net:net_resources",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/shared_impl",
"//printing/buildflags",
"//services/device/public/cpp/geolocation",
"//services/device/public/mojom",
"//services/proxy_resolver:lib",
"//services/video_capture/public/mojom:constants",
"//services/viz/privileged/mojom/compositing",
"//skia",
"//third_party/blink/public:blink",
"//third_party/boringssl",
"//third_party/electron_node:node_lib",
"//third_party/leveldatabase",
"//third_party/libyuv",
"//third_party/webrtc_overrides:webrtc_component",
"//third_party/widevine/cdm:headers",
"//ui/base/idle",
"//ui/events:dom_keycode_converter",
"//ui/gl",
"//ui/native_theme",
"//ui/shell_dialogs",
"//ui/views",
"//v8",
"//v8:v8_libplatform",
]
public_deps = [
"//base",
"//base:i18n",
"//content/public/app:both",
]
include_dirs = [
"chromium_src",
".",
"$target_gen_dir",
# TODO(nornagon): replace usage of SchemeRegistry by an actually exported
# API of blink, then remove this from the include_dirs.
"//third_party/blink/renderer",
]
defines = [ "V8_DEPRECATION_WARNINGS" ]
libs = []
if (is_linux) {
defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ]
}
extra_source_filters = []
if (!is_linux) {
extra_source_filters += [
"*\bx/*",
"*_x11.h",
"*_x11.cc",
"*_gtk.h",
"*_gtk.cc",
"*\blibrary_loaders/*",
]
}
if (!is_win) {
extra_source_filters += [
"*\bwin_*.h",
"*\bwin_*.cc",
]
}
if (!is_posix) {
extra_source_filters += [
"*_posix.cc",
"*_posix.h",
]
}
if (is_mac) {
extra_source_filters += [
"*_views.cc",
"*_views.h",
"*\bviews/*",
]
}
set_sources_assignment_filter(
sources_assignment_filter + extra_source_filters)
sources = filenames.lib_sources
set_sources_assignment_filter(sources_assignment_filter)
if (is_component_build) {
defines += [ "NODE_SHARED_MODE" ]
}
if (enable_fake_location_provider) {
sources += [
"shell/browser/fake_location_provider.cc",
"shell/browser/fake_location_provider.h",
]
}
if (is_mac) {
deps += [
"//components/remote_cocoa/app_shim",
"//content/common:mac_helpers",
"//ui/accelerated_widget_mac",
]
libs = [
"AVFoundation.framework",
"Carbon.framework",
"LocalAuthentication.framework",
"QuartzCore.framework",
"Quartz.framework",
"Security.framework",
"SecurityInterface.framework",
"ServiceManagement.framework",
"StoreKit.framework",
]
sources += [
"shell/browser/ui/views/autofill_popup_view.cc",
"shell/browser/ui/views/autofill_popup_view.h",
]
if (is_mas_build) {
sources += [ "shell/browser/api/electron_api_app_mas.mm" ]
sources -= [
"shell/browser/auto_updater_mac.mm",
"shell/common/crash_reporter/crash_reporter_mac.h",
"shell/common/crash_reporter/crash_reporter_mac.mm",
]
defines += [ "MAS_BUILD" ]
} else {
libs += [
"Squirrel.framework",
"ReactiveCocoa.framework",
"Mantle.framework",
]
cflags_objcc = [
"-F",
rebase_path("external_binaries", root_build_dir),
]
# ReactiveCocoa which is used by Squirrel requires using __weak.
cflags_objcc += [ "-fobjc-weak" ]
}
}
if (is_linux) {
deps += [
":libnotify_loader",
"//build/config/linux/gtk",
"//chrome/browser/ui/gtk",
"//dbus",
"//device/bluetooth",
"//third_party/breakpad:client",
"//ui/events/devices/x11",
"//ui/events/platform/x11",
"//ui/views/controls/webview",
"//ui/wm",
]
configs += [ ":gio_unix" ]
include_dirs += [ "//third_party/breakpad" ]
configs += [ "//build/config/linux:x11" ]
defines += [
# Disable warnings for g_settings_list_schemas.
"GLIB_DISABLE_DEPRECATION_WARNINGS",
]
sources += filenames.lib_sources_nss
sources += [
"shell/browser/ui/gtk_util.cc",
"shell/browser/ui/gtk_util.h",
]
}
if (is_win) {
libs += [ "dwmapi.lib" ]
deps += [
"//ui/native_theme:native_theme_browser",
"//ui/views/controls/webview",
"//ui/wm",
"//ui/wm/public",
]
public_deps += [
"//sandbox/win:sandbox",
"//third_party/crashpad/crashpad/handler",
]
}
if ((is_mac && !is_mas_build) || is_win) {
sources += [
"shell/common/crash_reporter/crash_reporter_crashpad.cc",
"shell/common/crash_reporter/crash_reporter_crashpad.h",
]
deps += [ "//third_party/crashpad/crashpad/client" ]
}
if (enable_plugins) {
deps += [ "chromium_src:plugins" ]
sources += [
"shell/renderer/pepper_helper.cc",
"shell/renderer/pepper_helper.h",
]
}
if (enable_run_as_node) {
sources += [
"shell/app/node_main.cc",
"shell/app/node_main.h",
]
}
if (enable_osr) {
sources += [
"shell/browser/osr/osr_host_display_client.cc",
"shell/browser/osr/osr_host_display_client.h",
"shell/browser/osr/osr_host_display_client_mac.mm",
"shell/browser/osr/osr_render_widget_host_view.cc",
"shell/browser/osr/osr_render_widget_host_view.h",
"shell/browser/osr/osr_video_consumer.cc",
"shell/browser/osr/osr_video_consumer.h",
"shell/browser/osr/osr_view_proxy.cc",
"shell/browser/osr/osr_view_proxy.h",
"shell/browser/osr/osr_web_contents_view.cc",
"shell/browser/osr/osr_web_contents_view.h",
"shell/browser/osr/osr_web_contents_view_mac.mm",
]
deps += [
"//components/viz/service",
"//services/viz/public/mojom",
"//ui/compositor",
]
}
if (enable_remote_module) {
sources += [
"shell/common/api/remote/object_life_monitor.cc",
"shell/common/api/remote/object_life_monitor.h",
"shell/common/api/remote/remote_callback_freer.cc",
"shell/common/api/remote/remote_callback_freer.h",
"shell/common/api/remote/remote_object_freer.cc",
"shell/common/api/remote/remote_object_freer.h",
]
}
if (enable_desktop_capturer) {
if (is_component_build && !is_linux) {
# On windows the implementation relies on unexported
# DxgiDuplicatorController class. On macOS the implementation
# relies on unexported webrtc::GetWindowOwnerPid method.
deps += [ "//third_party/webrtc/modules/desktop_capture" ]
}
sources += [
"shell/browser/api/electron_api_desktop_capturer.cc",
"shell/browser/api/electron_api_desktop_capturer.h",
]
}
if (enable_view_api) {
sources += [
"shell/browser/api/views/electron_api_box_layout.cc",
"shell/browser/api/views/electron_api_box_layout.h",
"shell/browser/api/views/electron_api_button.cc",
"shell/browser/api/views/electron_api_button.h",
"shell/browser/api/views/electron_api_label_button.cc",
"shell/browser/api/views/electron_api_label_button.h",
"shell/browser/api/views/electron_api_layout_manager.cc",
"shell/browser/api/views/electron_api_layout_manager.h",
"shell/browser/api/views/electron_api_md_text_button.cc",
"shell/browser/api/views/electron_api_md_text_button.h",
"shell/browser/api/views/electron_api_resize_area.cc",
"shell/browser/api/views/electron_api_resize_area.h",
"shell/browser/api/views/electron_api_text_field.cc",
"shell/browser/api/views/electron_api_text_field.h",
]
}
if (enable_basic_printing) {
sources += [
"shell/browser/printing/print_preview_message_handler.cc",
"shell/browser/printing/print_preview_message_handler.h",
"shell/renderer/printing/print_render_frame_helper_delegate.cc",
"shell/renderer/printing/print_render_frame_helper_delegate.h",
]
deps += [ "//components/printing/common:mojo_interfaces" ]
}
deps += [
"//components/pref_registry",
"//components/user_prefs",
"//extensions/browser",
"//extensions/browser:core_api_provider",
"//extensions/common",
"//extensions/common:core_api_provider",
"//extensions/renderer",
]
if (enable_electron_extensions) {
sources += filenames.lib_sources_extensions
deps += [
"shell/browser/extensions/api:api_registration",
"shell/common/extensions/api",
"shell/common/extensions/api:extensions_features",
"//chrome/browser/resources:component_extension_resources",
"//components/zoom",
]
}
if (enable_pdf) {
# Printing depends on some //pdf code, so it needs to be built even if the
# pdf viewer isn't enabled.
deps += [
"//pdf",
"//pdf:features",
]
}
if (enable_pdf_viewer) {
deps += [
"//components/pdf/browser",
"//components/pdf/renderer",
]
sources += [
"shell/browser/electron_pdf_web_contents_helper_client.cc",
"shell/browser/electron_pdf_web_contents_helper_client.h",
]
}
}
electron_paks("packed_resources") {
if (is_mac) {
output_dir = "$root_gen_dir/electron_repack"
copy_data_to_bundle = true
} else {
output_dir = root_out_dir
}
}
if (is_mac) {
electron_framework_name = "$electron_product_name Framework"
electron_helper_name = "$electron_product_name Helper"
electron_login_helper_name = "$electron_product_name Login Helper"
electron_framework_version = "A"
electron_version = read_file("ELECTRON_VERSION", "trim string")
mac_xib_bundle_data("electron_xibs") {
sources = [ "shell/common/resources/mac/MainMenu.xib" ]
}
bundle_data("electron_framework_resources") {
public_deps = [ ":packed_resources" ]
sources = []
if (icu_use_data_file) {
sources += [ "$root_out_dir/icudtl.dat" ]
public_deps += [ "//third_party/icu:icudata" ]
}
if (v8_use_external_startup_data) {
public_deps += [ "//v8" ]
if (use_v8_context_snapshot) {
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
public_deps += [ "//tools/v8_context_snapshot" ]
} else {
sources += [ "$root_out_dir/snapshot_blob.bin" ]
}
}
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
}
if (!is_component_build && is_component_ffmpeg) {
bundle_data("electron_framework_libraries") {
sources = []
public_deps = []
sources += [ "$root_out_dir/libffmpeg.dylib" ]
public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
}
} else {
group("electron_framework_libraries") {
}
}
if (use_egl) {
# Add the ANGLE .dylibs in the Libraries directory of the Framework.
bundle_data("electron_angle_binaries") {
sources = [
"$root_out_dir/egl_intermediates/libEGL.dylib",
"$root_out_dir/egl_intermediates/libGLESv2.dylib",
]
outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
public_deps = [ "//ui/gl:angle_library_copy" ]
}
# Add the SwiftShader .dylibs in the Libraries directory of the Framework.
bundle_data("electron_swiftshader_binaries") {
sources = [
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
"$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
]
outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
public_deps = [ "//ui/gl:swiftshader_library_copy" ]
}
}
group("electron_angle_library") {
if (use_egl) {
deps = [ ":electron_angle_binaries" ]
}
}
group("electron_swiftshader_library") {
if (use_egl) {
deps = [ ":electron_swiftshader_binaries" ]
}
}
bundle_data("electron_crashpad_helper") {
sources = [ "$root_out_dir/crashpad_handler" ]
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
public_deps = [ "//third_party/crashpad/crashpad/handler:crashpad_handler" ]
}
mac_framework_bundle("electron_framework") {
output_name = electron_framework_name
framework_version = electron_framework_version
framework_contents = [
"Resources",
"Libraries",
]
public_deps = [
":electron_framework_libraries",
":electron_lib",
]
deps = [
":electron_angle_library",
":electron_framework_libraries",
":electron_framework_resources",
":electron_swiftshader_library",
":electron_xibs",
]
if (!is_mas_build) {
deps += [ ":electron_crashpad_helper" ]
}
info_plist = "shell/common/resources/mac/Info.plist"
extra_substitutions = [
"ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.framework",
"ELECTRON_VERSION=$electron_version",
]
include_dirs = [ "." ]
sources = filenames.framework_sources
if (enable_osr) {
libs += [ "IOSurface.framework" ]
}
ldflags = [
"-F",
rebase_path("external_binaries", root_build_dir),
"-Wl,-install_name,@rpath/$output_name.framework/$output_name",
"-rpath",
"@loader_path/Libraries",
]
if (is_component_build) {
ldflags += [
"-rpath",
"@executable_path/../../../../../..",
]
}
}
template("electron_helper_app") {
mac_app_bundle(target_name) {
assert(defined(invoker.helper_name_suffix))
output_name = electron_helper_name + invoker.helper_name_suffix
deps = [ ":electron_framework+link" ]
if (!is_mas_build) {
deps += [ "//sandbox/mac:seatbelt" ]
}
defines = [ "HELPER_EXECUTABLE" ]
sources = filenames.app_sources
sources += [ "shell/common/electron_constants.cc" ]
include_dirs = [ "." ]
info_plist = "shell/renderer/resources/mac/Info.plist"
extra_substitutions =
[ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
ldflags = [
"-rpath",
"@executable_path/../../..",
]
if (is_component_build) {
ldflags += [
"-rpath",
"@executable_path/../../../../../..",
]
}
}
}
foreach(helper_params, content_mac_helpers) {
_helper_target = helper_params[0]
_helper_bundle_id = helper_params[1]
_helper_suffix = helper_params[2]
electron_helper_app("electron_helper_app_${_helper_target}") {
helper_name_suffix = _helper_suffix
}
}
bundle_data("electron_app_framework_bundle_data") {
sources = [ "$root_out_dir/$electron_framework_name.framework" ]
if (!is_mas_build) {
sources += [
"external_binaries/Mantle.framework",
"external_binaries/ReactiveCocoa.framework",
"external_binaries/Squirrel.framework",
]
}
outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
public_deps = [ ":electron_framework+link" ]
foreach(helper_params, content_mac_helpers) {
sources +=
[ "$root_out_dir/${electron_helper_name}${helper_params[2]}.app" ]
public_deps += [ ":electron_helper_app_${helper_params[0]}" ]
}
}
mac_app_bundle("electron_login_helper") {
output_name = electron_login_helper_name
sources = filenames.login_helper_sources
include_dirs = [ "." ]
libs = [ "AppKit.framework" ]
info_plist = "shell/app/resources/mac/loginhelper-Info.plist"
extra_substitutions =
[ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.loginhelper" ]
}
bundle_data("electron_login_helper_app") {
public_deps = [ ":electron_login_helper" ]
sources = [ "$root_out_dir/$electron_login_helper_name.app" ]
outputs =
[ "{{bundle_contents_dir}}/Library/LoginItems/{{source_file_part}}" ]
}
action("electron_app_lproj_dirs") {
outputs = []
foreach(locale, locales_as_mac_outputs) {
outputs += [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
}
script = "build/mac/make_locale_dirs.py"
args = rebase_path(outputs)
}
foreach(locale, locales_as_mac_outputs) {
bundle_data("electron_app_strings_${locale}_bundle_data") {
sources = [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
outputs = [ "{{bundle_resources_dir}}/$locale.lproj" ]
public_deps = [ ":electron_app_lproj_dirs" ]
}
}
group("electron_app_strings_bundle_data") {
public_deps = []
foreach(locale, locales_as_mac_outputs) {
public_deps += [ ":electron_app_strings_${locale}_bundle_data" ]
}
}
bundle_data("electron_app_resources") {
public_deps = [
":default_app_asar",
":electron_app_strings_bundle_data",
]
sources = [
"$root_out_dir/resources/default_app.asar",
"shell/browser/resources/mac/electron.icns",
]
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
}
mac_app_bundle("electron_app") {
output_name = electron_product_name
sources = filenames.app_sources
sources += [ "shell/common/electron_constants.cc" ]
include_dirs = [ "." ]
deps = [
":electron_app_framework_bundle_data",
":electron_app_resources",
]
if (is_mas_build) {
deps += [ ":electron_login_helper_app" ]
}
info_plist = "shell/browser/resources/mac/Info.plist"
extra_substitutions = [
"ELECTRON_BUNDLE_ID=$electron_mac_bundle_id",
"ELECTRON_VERSION=$electron_version",
]
ldflags = [
"-rpath",
"@executable_path/../Frameworks",
]
}
if (enable_dsyms) {
extract_symbols("electron_framework_syms") {
binary = "$root_out_dir/$electron_framework_name.framework/Versions/$electron_framework_version/$electron_framework_name"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/$electron_framework_name.dSYM/Contents/Resources/DWARF/$electron_framework_name"
deps = [ ":electron_framework" ]
}
foreach(helper_params, content_mac_helpers) {
_helper_target = helper_params[0]
_helper_bundle_id = helper_params[1]
_helper_suffix = helper_params[2]
extract_symbols("electron_helper_syms_${_helper_target}") {
binary = "$root_out_dir/$electron_helper_name${_helper_suffix}.app/Contents/MacOS/$electron_helper_name${_helper_suffix}"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/$electron_helper_name${_helper_suffix}.dSYM/Contents/Resources/DWARF/$electron_helper_name${_helper_suffix}"
deps = [ ":electron_helper_app_${_helper_target}" ]
}
}
extract_symbols("electron_app_syms") {
binary = "$root_out_dir/$electron_product_name.app/Contents/MacOS/$electron_product_name"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/$electron_product_name.dSYM/Contents/Resources/DWARF/$electron_product_name"
deps = [ ":electron_app" ]
}
extract_symbols("swiftshader_egl_syms") {
binary = "$root_out_dir/libswiftshader_libEGL.dylib"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/libswiftshader_libEGL.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libEGL.dylib"
deps =
[ "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL" ]
}
extract_symbols("swiftshader_gles_syms") {
binary = "$root_out_dir/libswiftshader_libGLESv2.dylib"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/libswiftshader_libGLESv2.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libGLESv2.dylib"
deps = [
"//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
]
}
extract_symbols("crashpad_handler_syms") {
binary = "$root_out_dir/crashpad_handler"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/crashpad_handler.dSYM/Contents/Resources/DWARF/crashpad_handler"
deps = [ "//third_party/crashpad/crashpad/handler:crashpad_handler" ]
}
group("electron_symbols") {
deps = [
":crashpad_handler_syms",
":electron_app_syms",
":electron_framework_syms",
":swiftshader_egl_syms",
":swiftshader_gles_syms",
]
foreach(helper_params, content_mac_helpers) {
_helper_target = helper_params[0]
deps += [ ":electron_helper_syms_${_helper_target}" ]
}
}
} else {
group("electron_symbols") {
}
}
} else {
windows_manifest("electron_app_manifest") {
sources = [
"shell/browser/resources/win/disable_window_filtering.manifest",
"shell/browser/resources/win/dpi_aware.manifest",
as_invoker_manifest,
common_controls_manifest,
default_compatibility_manifest,
]
}
executable("electron_app") {
output_name = electron_project_name
sources = filenames.app_sources
include_dirs = [ "." ]
deps = [
":default_app_asar",
":electron_app_manifest",
":electron_lib",
":packed_resources",
"//content:sandbox_helper_win",
"//electron/buildflags",
"//ui/strings",
]
data = []
data += [ "$root_out_dir/resources.pak" ]
data += [ "$root_out_dir/chrome_100_percent.pak" ]
if (enable_hidpi) {
data += [ "$root_out_dir/chrome_200_percent.pak" ]
}
foreach(locale, locales) {
data += [ "$root_out_dir/locales/$locale.pak" ]
}
if (!is_mac) {
data += [ "$root_out_dir/resources/default_app.asar" ]
}
public_deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
if (is_win) {
sources += [
# TODO: we should be generating our .rc files more like how chrome does
"shell/browser/resources/win/atom.rc",
"shell/browser/resources/win/resource.h",
]
libs = [
"comctl32.lib",
"uiautomationcore.lib",
"wtsapi32.lib",
]
configs += [ "//build/config/win:windowed" ]
ldflags = [
# Windows 7 doesn't have these DLLs.
# TODO: are there other DLLs we need to list here to be win7
# compatible?
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
]
# This is to support renaming of electron.exe. node-gyp has hard-coded
# executable names which it will recognise as node. This module definition
# file claims that the electron executable is in fact named "node.exe",
# which is one of the executable names that node-gyp recognizes.
# See https://github.com/nodejs/node-gyp/commit/52ceec3a6d15de3a8f385f43dbe5ecf5456ad07a
ldflags += [ "/DEF:" + rebase_path("build/electron.def", root_build_dir) ]
inputs = [
"shell/browser/resources/win/atom.ico",
"build/electron.def",
]
}
if (is_linux) {
ldflags = [ "-pie" ]
if (!is_component_build && is_component_ffmpeg) {
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
}
}
if (is_official_build) {
if (is_linux) {
_target_executable_suffix = ""
_target_shared_library_suffix = ".so"
} else if (is_win) {
_target_executable_suffix = ".exe"
_target_shared_library_suffix = ".dll"
}
extract_symbols("electron_app_symbols") {
binary = "$root_out_dir/$electron_project_name$_target_executable_suffix"
symbol_dir = "$root_out_dir/breakpad_symbols"
deps = [ ":electron_app" ]
}
extract_symbols("swiftshader_egl_symbols") {
binary = "$root_out_dir/swiftshader/libEGL$_target_shared_library_suffix"
symbol_dir = "$root_out_dir/breakpad_symbols"
deps =
[ "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL" ]
}
extract_symbols("swiftshader_gles_symbols") {
binary =
"$root_out_dir/swiftshader/libGLESv2$_target_shared_library_suffix"
symbol_dir = "$root_out_dir/breakpad_symbols"
deps = [
"//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
]
}
group("electron_symbols") {
deps = [
":electron_app_symbols",
":swiftshader_egl_symbols",
":swiftshader_gles_symbols",
]
}
}
}
test("shell_browser_ui_unittests") {
sources = [
"//electron/shell/browser/ui/accelerator_util_unittests.cc",
"//electron/shell/browser/ui/run_all_unittests.cc",
]
configs += [ ":electron_lib_config" ]
deps = [
":electron_lib",
"//base",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
"//ui/base",
"//ui/strings",
]
if (is_mac) {
# Resolve paths owing to different test executable locations
ldflags = [
"-F",
rebase_path("external_binaries", root_build_dir),
"-rpath",
"@loader_path",
"-rpath",
"@executable_path/" + rebase_path("external_binaries", root_build_dir),
]
}
}
template("dist_zip") {
_runtime_deps_target = "${target_name}__deps"
_runtime_deps_file =
"$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + "/" +
get_label_info(target_name, "name") + ".runtime_deps"
group(_runtime_deps_target) {
forward_variables_from(invoker,
[
"deps",
"data_deps",
"data",
"testonly",
])
write_runtime_deps = _runtime_deps_file
}
action(target_name) {
script = "//electron/build/zip.py"
deps = [ ":$_runtime_deps_target" ]
forward_variables_from(invoker,
[
"outputs",
"testonly",
])
flatten = false
if (defined(invoker.flatten)) {
flatten = invoker.flatten
}
args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
target_cpu,
target_os,
"$flatten",
]
}
}
copy("electron_license") {
sources = [ "LICENSE" ]
outputs = [ "$root_build_dir/{{source_file_part}}" ]
}
copy("chromium_licenses") {
deps = [ "//components/resources:about_credits" ]
sources = [ "$root_gen_dir/components/resources/about_credits.html" ]
outputs = [ "$root_build_dir/LICENSES.chromium.html" ]
}
group("licenses") {
data_deps = [
":chromium_licenses",
":electron_license",
]
}
copy("electron_version") {
sources = [ "ELECTRON_VERSION" ]
outputs = [ "$root_build_dir/version" ]
}
dist_zip("electron_dist_zip") {
data_deps = [
":electron_app",
":electron_version",
":licenses",
]
if (is_linux) {
data_deps += [ "//sandbox/linux:chrome_sandbox" ]
}
outputs = [ "$root_build_dir/dist.zip" ]
}
dist_zip("electron_ffmpeg_zip") {
data_deps = [ "//third_party/ffmpeg" ]
outputs = [ "$root_build_dir/ffmpeg.zip" ]
}
electron_chromedriver_deps = [
":licenses",
"//chrome/test/chromedriver",
"//electron/buildflags",
]
group("electron_chromedriver") {
testonly = true
public_deps = electron_chromedriver_deps
}
dist_zip("electron_chromedriver_zip") {
testonly = true
data_deps = electron_chromedriver_deps
outputs = [ "$root_build_dir/chromedriver.zip" ]
}
mksnapshot_deps = [
":licenses",
"//tools/v8_context_snapshot:v8_context_snapshot_generator",
"//v8:mksnapshot($v8_snapshot_toolchain)",
]
group("electron_mksnapshot") {
public_deps = mksnapshot_deps
}
dist_zip("electron_mksnapshot_zip") {
data_deps = mksnapshot_deps
outputs = [ "$root_build_dir/mksnapshot.zip" ]
}
copy("hunspell_dictionaries") {
sources = hunspell_dictionaries + hunspell_licenses
outputs = [ "$target_gen_dir/electron_hunspell/{{source_file_part}}" ]
}
dist_zip("hunspell_dictionaries_zip") {
data_deps = [ ":hunspell_dictionaries" ]
flatten = true
outputs = [ "$root_build_dir/hunspell_dictionaries.zip" ]
}
group("electron") {
public_deps = [ ":electron_app" ]
}
1
https://gitee.com/zinface/electron.git
git@gitee.com:zinface/electron.git
zinface
electron
electron
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891