To add a new BraveVpnService implementation based on Architecture 2.0, which must co-exist with Architecture 1.0 for quite a while, we need to split service's interface and implementation. All the external components will keep accessing VPN service via the BraveVpnService interface, but the implementation mostly goes into BraveVpnServiceImpl. This change finalizes the BraveVpnService Architecture 1.0 extraction based on GN flags. It also splits "components/brave_vpn/browser" targets in the BUILD.gn into two targets - a shared one and a V1 specific one. The factory is prepared to create different service implementations, and the V1 tests are ensured to run only when V1 architecture is enabled by a GN flag. Implements part of https://github.com/brave/brave-browser/issues/54597
806 lines
22 KiB
Plaintext
806 lines
22 KiB
Plaintext
# Copyright (c) 2017 The Brave Authors. All rights reserved.
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
import("//brave/build/config.gni")
|
|
import("//brave/build/redirect_cc.gni")
|
|
import("//brave/components/brave_vpn/common/buildflags/buildflags.gni")
|
|
import("//brave/tools/crates/build_crate.gni")
|
|
import("//build/config/locales.gni")
|
|
import("//build/config/zip.gni")
|
|
import("//chrome/browser/buildflags.gni")
|
|
import("//extensions/buildflags/buildflags.gni")
|
|
import("//media/media_options.gni")
|
|
import("//third_party/icu/config.gni")
|
|
import("//third_party/widevine/cdm/widevine.gni")
|
|
import("//tools/grit/repack.gni")
|
|
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
|
|
import("//ui/base/ui_features.gni")
|
|
|
|
if (enable_brave_vpn_v1) {
|
|
import(
|
|
"//brave/browser/brave_vpn/win/brave_vpn_wireguard_service/allowlist.gni")
|
|
}
|
|
|
|
if (enable_library_cdms) {
|
|
import("//media/cdm/library_cdm/cdm_paths.gni")
|
|
}
|
|
|
|
if (!is_ios) {
|
|
import("//brave/brave_paks.gni")
|
|
}
|
|
|
|
if (is_mac) {
|
|
import("//brave/build/mac/tweak_info_plist.gni")
|
|
import("//build/config/mac/rules.gni")
|
|
}
|
|
|
|
if (is_win) {
|
|
import("//brave/build/win/sign.gni")
|
|
}
|
|
|
|
if (is_linux) {
|
|
import("//brave/build/linux/channels.gni")
|
|
}
|
|
|
|
declare_args() {
|
|
audit_dev_deps = true
|
|
}
|
|
|
|
chromium_unit_tests_deps = [
|
|
"//base:base_unittests",
|
|
"//net:net_unittests",
|
|
]
|
|
if (!is_ios) {
|
|
chromium_unit_tests_deps += [ "//chrome/test:unit_tests" ]
|
|
}
|
|
if (use_blink && !is_android) {
|
|
# TODO(https://github.com/brave/brave-browser/issues/48062): Fix this target
|
|
# for android.
|
|
chromium_unit_tests_deps += [ "//content/test:content_unittests" ]
|
|
}
|
|
|
|
if (!is_android) {
|
|
# TODO(https://github.com/brave/brave-browser/issues/48062): Fix this target
|
|
# for android.
|
|
chromium_unit_tests_deps += [ "//components:components_unittests" ]
|
|
}
|
|
|
|
group("chromium_unit_tests") {
|
|
testonly = true
|
|
data_deps = chromium_unit_tests_deps
|
|
write_file("$root_out_dir/chromium_unit_tests.json",
|
|
chromium_unit_tests_deps,
|
|
"json")
|
|
}
|
|
|
|
# Only add tests to this list if you want them to run by default for
|
|
# brave_all_unit_tests.
|
|
brave_all_unit_tests_deps = [ "//brave/components:brave_components_unittests" ]
|
|
if (!is_ios) {
|
|
brave_all_unit_tests_deps += [ "//brave/test:brave_unit_tests" ]
|
|
} else {
|
|
brave_all_unit_tests_deps += [
|
|
"//brave/ios/testing:ios_brave_unit_tests",
|
|
"//brave/ios/web:ios_brave_web_inttests",
|
|
"//brave/ios/web:ios_brave_web_unittests",
|
|
]
|
|
}
|
|
if (!is_ios && !is_android) {
|
|
brave_all_unit_tests_deps += [ "//brave/test:brave_installer_unittests" ]
|
|
}
|
|
if (is_win || is_mac || is_linux) {
|
|
brave_all_unit_tests_deps += [ "//brave/updater:brave_updater_unittests" ]
|
|
}
|
|
|
|
if (is_win) {
|
|
# These tests are especially important while we are maintaining the delta
|
|
# update logic ourselves. See github.com/brave/brave-core/pull/31937.
|
|
brave_all_unit_tests_deps += [
|
|
"//chrome/installer/setup:setup_unittests",
|
|
"//chrome/installer/util:installer_util_unittests",
|
|
]
|
|
}
|
|
|
|
# This group is for unit tests that run as part of brave_all_unit_tests. Other
|
|
# tests that you only want to build should be added directly to `all` group
|
|
group("brave_all_unit_tests") {
|
|
testonly = true
|
|
data_deps = brave_all_unit_tests_deps
|
|
write_file("$root_out_dir/brave_all_unit_tests.json",
|
|
brave_all_unit_tests_deps,
|
|
"json")
|
|
}
|
|
|
|
# This target serves as a canonical place to define all code that has to be
|
|
# buildable in all platforms in a single build run.
|
|
group("all") {
|
|
testonly = true
|
|
deps = [
|
|
":brave_all_unit_tests",
|
|
":chromium_unit_tests",
|
|
"//brave",
|
|
]
|
|
|
|
if (!is_android && !is_ios) {
|
|
deps += [
|
|
"//brave/test:brave_interactive_ui_tests",
|
|
"//brave/test:brave_network_audit_tests",
|
|
"//chrome/test:browser_tests",
|
|
]
|
|
}
|
|
|
|
if (toolkit_views) {
|
|
deps += [ "//ui/views/examples:views_examples" ]
|
|
}
|
|
|
|
if (!is_ios) {
|
|
deps += [ "//brave/test:brave_browser_tests" ]
|
|
}
|
|
|
|
if (is_android) {
|
|
deps += [
|
|
"//brave/build/android:brave",
|
|
"//brave/test:brave_java_unit_tests",
|
|
"//brave/test:brave_junit_tests",
|
|
]
|
|
}
|
|
}
|
|
|
|
if (!is_ios) {
|
|
group("child_dependencies") {
|
|
deps = [
|
|
"common",
|
|
"//brave/renderer",
|
|
"//brave/utility",
|
|
]
|
|
}
|
|
|
|
group("browser_dependencies") {
|
|
deps = [
|
|
"browser",
|
|
"chromium_src/chrome/app",
|
|
"common",
|
|
"//components/omnibox/common",
|
|
"//services/device/public/cpp:device_features",
|
|
"//services/network/public/cpp",
|
|
]
|
|
|
|
data_deps = [ ":unpacked_resources" ]
|
|
|
|
if (!is_ios) {
|
|
deps += [ ":packed_resources" ]
|
|
}
|
|
}
|
|
|
|
group("storybook") {
|
|
deps = [ "//brave/.storybook:storybook" ]
|
|
}
|
|
}
|
|
|
|
if (is_win) {
|
|
packed_files_rc_file =
|
|
"$root_out_dir/gen/chrome/installer/mini_installer/packed_delta_files.rc"
|
|
action("delta_installer_archive") {
|
|
script = "//brave/tools/win/create_delta_archive.py"
|
|
if (skip_signing) {
|
|
setup_exe = "setup.exe"
|
|
} else {
|
|
setup_exe = "presigned_binaries/setup.exe"
|
|
}
|
|
inputs = [
|
|
# The original tool for delta archive generation was called "courgette".
|
|
# But it runs out of memory on recent Chromium / Brave revisions. Its
|
|
# drop-in replacement is Zucchini. We need to use its 64-bit version to
|
|
# again prevent out of memory errors.
|
|
"$root_out_dir/zucchini64.exe",
|
|
"$root_out_dir/chrome.7z",
|
|
"$root_out_dir/" + setup_exe,
|
|
]
|
|
outputs = [
|
|
"$root_out_dir/chrome_patch.diff",
|
|
"$root_out_dir/chrome_patch.packed.7z",
|
|
"$root_out_dir/setup_patch.diff",
|
|
"$root_out_dir/setup_patch.packed.7z",
|
|
packed_files_rc_file,
|
|
]
|
|
deps = [
|
|
"//chrome/installer/mini_installer:mini_installer_archive",
|
|
"//chrome/installer/setup",
|
|
"//components/zucchini:zucchini64",
|
|
]
|
|
if (!skip_signing) {
|
|
deps += [ ":signed_setup_exe" ]
|
|
}
|
|
args = [
|
|
"zucchini64.exe",
|
|
"$last_chrome_installer/chrome.7z",
|
|
"chrome.7z",
|
|
"$last_chrome_installer/setup.exe",
|
|
setup_exe,
|
|
"chrome_patch.diff",
|
|
"chrome_patch.packed.7z",
|
|
"setup_patch.diff",
|
|
"setup_patch.packed.7z",
|
|
rebase_path(packed_files_rc_file, root_build_dir),
|
|
]
|
|
if (is_component_build) {
|
|
args += [ "--is_component_build" ]
|
|
}
|
|
}
|
|
|
|
if (!skip_signing) {
|
|
sign("signed_setup_exe") {
|
|
sources = [ "$root_out_dir/setup.exe" ]
|
|
outputs = [ "$root_out_dir/presigned_binaries/setup.exe" ]
|
|
deps = [ "//chrome/installer/setup" ]
|
|
}
|
|
sign("signed_brave_exe") {
|
|
sources = [ "$root_out_dir/brave.exe" ]
|
|
outputs = [ "$root_out_dir/presigned_binaries/brave.exe" ]
|
|
deps = [ "//brave/build/win:copy_exe" ]
|
|
}
|
|
sign("signed_chrome_dll") {
|
|
sources = [ "$root_out_dir/chrome.dll" ]
|
|
outputs = [ "$root_out_dir/presigned_binaries/chrome.dll" ]
|
|
deps = [ "//chrome:chrome_dll" ]
|
|
}
|
|
}
|
|
|
|
group("mini_installer_dependencies") {
|
|
deps = [ ":brave" ]
|
|
if (!skip_signing) {
|
|
deps += [
|
|
":signed_brave_exe",
|
|
":signed_chrome_dll",
|
|
":signed_setup_exe",
|
|
]
|
|
if (enable_widevine && enable_cdm_host_verification) {
|
|
deps += [
|
|
"//brave/browser/widevine:brave_exe_sig",
|
|
"//brave/browser/widevine:chrome_dll_sig",
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
group("brave") {
|
|
deps = [ "build/$target_os:brave" ]
|
|
if (!is_android && !is_ios) {
|
|
deps += [
|
|
"//brave/components/version_info:generate_version",
|
|
"//chrome",
|
|
]
|
|
}
|
|
}
|
|
|
|
group("resources") {
|
|
public_deps = [
|
|
# TODO(bridiver)
|
|
# "//brave/browser:resources",
|
|
# "//brave/common:resources",
|
|
# "//brave/renderer:resources",
|
|
"//brave/components/resources",
|
|
]
|
|
|
|
data_deps = [ "//brave/components/resources:about_credits" ]
|
|
}
|
|
|
|
if (is_android) {
|
|
android_assets("brave_file_assets") {
|
|
sources = [
|
|
"//brave/LICENSE.html",
|
|
"//brave/android/java/org/chromium/chrome/browser/ntp/ntp_news_optin_icon_animation.json",
|
|
"//brave/android/java/org/chromium/chrome/browser/onboarding/animations/onboarding_ads.json",
|
|
"//brave/android/java/org/chromium/chrome/browser/onboarding/animations/onboarding_ads_notification.json",
|
|
"//brave/android/java/org/chromium/chrome/browser/onboarding/animations/onboarding_rewards.json",
|
|
"//brave/android/java/org/chromium/chrome/browser/onboarding/animations/privacy_protection.json",
|
|
"//brave/android/java/org/chromium/chrome/browser/onboarding/animations/save_data_and_battery.json",
|
|
"//brave/android/java/org/chromium/chrome/browser/onboarding/animations/website_loads_faster.json",
|
|
"//brave/android/java/org/chromium/chrome/browser/vpn/brave_vpn_confirm.json",
|
|
"//brave/browser/brave_shields/android/java/src/org/chromium/chrome/browser/brave_shields/brave_first_party_storage_clean_animation.json",
|
|
]
|
|
disable_compression = false
|
|
}
|
|
|
|
android_assets("brave_pak_assets") {
|
|
sources = [ "$root_out_dir/brave_resources.pak" ]
|
|
|
|
deps = [
|
|
"//brave:brave_file_assets",
|
|
"//brave:packed_resources_extra",
|
|
]
|
|
disable_compression = true
|
|
}
|
|
}
|
|
|
|
if (is_mac) {
|
|
group("framework_bundle_data") {
|
|
deps = [ "components/brave_extension/extension/brave_extension:brave_extension_framework_bundle_data" ]
|
|
}
|
|
}
|
|
|
|
group("unpacked_resources") {
|
|
if (!is_mac) {
|
|
deps = []
|
|
if (enable_extensions) {
|
|
deps = [
|
|
"//brave/components/brave_extension/extension/brave_extension:locales",
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|
|
#TODO(bridiver) - what to do
|
|
if (!is_ios) {
|
|
group("brave_tests") {
|
|
testonly = true
|
|
|
|
deps = [ "test:brave_unit_tests" ]
|
|
|
|
if (!is_android) {
|
|
deps += [
|
|
"test:brave_browser_tests",
|
|
"test:brave_interactive_ui_tests",
|
|
"test:brave_network_audit_tests",
|
|
]
|
|
}
|
|
if (use_libfuzzer) {
|
|
deps += [ "//brave/fuzzers:brave_fuzzers" ]
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!is_ios) {
|
|
brave_paks("packed_resources") {
|
|
if (is_mac) {
|
|
output_dir = "$root_gen_dir/repack"
|
|
copy_data_to_bundle = true
|
|
} else {
|
|
output_dir = root_out_dir
|
|
}
|
|
}
|
|
}
|
|
|
|
branding_dir = "//chrome/app/theme/$branding_path_component"
|
|
branding_dir_100 =
|
|
"//chrome/app/theme/default_100_percent/$branding_path_component"
|
|
copy("theme_files") {
|
|
visibility = [ ":*" ]
|
|
if (is_linux) {
|
|
sources = [
|
|
"$branding_dir/linux/product_logo_128_beta.png",
|
|
"$branding_dir/linux/product_logo_128_development.png",
|
|
"$branding_dir/linux/product_logo_128_nightly.png",
|
|
"$branding_dir/linux/product_logo_24_beta.png",
|
|
"$branding_dir/linux/product_logo_24_nightly.png",
|
|
"$branding_dir/linux/product_logo_256_beta.png",
|
|
"$branding_dir/linux/product_logo_256_nightly.png",
|
|
"$branding_dir/linux/product_logo_48_beta.png",
|
|
"$branding_dir/linux/product_logo_48_nightly.png",
|
|
"$branding_dir/linux/product_logo_64_beta.png",
|
|
"$branding_dir/linux/product_logo_64_nightly.png",
|
|
"$branding_dir_100/linux/product_logo_16_beta.png",
|
|
"$branding_dir_100/linux/product_logo_16_dev.png",
|
|
"$branding_dir_100/linux/product_logo_16_nightly.png",
|
|
"$branding_dir_100/linux/product_logo_32_beta.png",
|
|
"$branding_dir_100/linux/product_logo_32_dev.png",
|
|
"$branding_dir_100/linux/product_logo_32_nightly.png",
|
|
]
|
|
|
|
# Dev channel resources only exist for brave, not brave_origin
|
|
if (branding_path_component == "brave") {
|
|
sources += [
|
|
"$branding_dir/linux/product_logo_128_dev.png",
|
|
"$branding_dir/linux/product_logo_24_dev.png",
|
|
"$branding_dir/linux/product_logo_256_dev.png",
|
|
"$branding_dir/linux/product_logo_48_dev.png",
|
|
"$branding_dir/linux/product_logo_64_dev.png",
|
|
]
|
|
}
|
|
} else {
|
|
sources = [
|
|
"$branding_dir/product_logo_128_beta.png",
|
|
"$branding_dir/product_logo_128_development.png",
|
|
"$branding_dir/product_logo_128_nightly.png",
|
|
]
|
|
|
|
# Dev channel resources only exist for brave, not brave_origin
|
|
if (branding_path_component == "brave") {
|
|
sources += [ "$branding_dir/product_logo_128_dev.png" ]
|
|
}
|
|
}
|
|
outputs = [ "$root_out_dir/installer/theme/{{source_file_part}}" ]
|
|
}
|
|
|
|
group("create_dist") {
|
|
deps = []
|
|
if (is_android) {
|
|
if (android_aab_to_apk && target_cpu == "arm64") {
|
|
deps += [ "build/android:sign_app_convert_aab_to_apk" ]
|
|
} else {
|
|
deps += [ "build/android:sign_app" ]
|
|
}
|
|
} else {
|
|
deps += [ ":create_symbols_dist" ]
|
|
}
|
|
|
|
# for linux zip will be created along with installer
|
|
if (!is_linux) {
|
|
deps += [ ":create_dist_zips" ]
|
|
}
|
|
|
|
if (is_win) {
|
|
deps += [
|
|
"//brave/build/win:create_signed_installer",
|
|
"//brave/components/policy:pack_policy_templates",
|
|
]
|
|
|
|
if (build_omaha) {
|
|
deps += [ "//brave/vendor/omaha" ]
|
|
}
|
|
|
|
if (last_chrome_installer != "") {
|
|
deps += [ "//brave/build/win:signed_delta_installer" ]
|
|
}
|
|
}
|
|
if (is_mac) {
|
|
deps += [ "//brave/build/mac:create_dist_mac" ]
|
|
}
|
|
if (is_linux) {
|
|
deps += [
|
|
":theme_files",
|
|
"//brave/app/linux:dist_resources",
|
|
"//chrome/installer/linux:$linux_channel",
|
|
]
|
|
}
|
|
}
|
|
|
|
if (!is_mac && !is_android && !is_ios) {
|
|
copy("brave_locale_dist_resources") {
|
|
deps = [ "//chrome:packed_resources" ]
|
|
|
|
sources = []
|
|
foreach(locale, platform_pak_locales) {
|
|
sources += [ "$root_out_dir/locales/$locale.pak" ]
|
|
}
|
|
outputs = [ "$brave_dist_dir/locales/{{source_file_part}}" ]
|
|
}
|
|
|
|
if (enable_extensions) {
|
|
group("brave_extensions_locale_dist_resources") {
|
|
deps = [
|
|
"//brave/components/brave_extension/extension/brave_extension:locales",
|
|
]
|
|
|
|
public_deps = []
|
|
foreach(locale, platform_pak_locales) {
|
|
# public_deps is used intentionaly because ":create_dist_zip" needs the all dependency
|
|
# of all locale files.
|
|
public_deps += [ ":brave_shields_locales_${locale}" ]
|
|
}
|
|
}
|
|
|
|
foreach(locale, platform_pak_locales) {
|
|
copy("brave_shields_locales_${locale}") {
|
|
deps = [ "//brave/components/brave_extension/extension/brave_extension:locales_$locale" ]
|
|
|
|
locale = string_replace(locale, "-", "_")
|
|
sources = [ "$root_out_dir/resources/brave_extension/_locales/$locale/messages.json" ]
|
|
outputs = [ "$brave_dist_dir/resources/brave_extension/_locales/$locale/{{source_file_part}}" ]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
copy("brave_license_dist_resources") {
|
|
sources = [ "//brave/LICENSE" ]
|
|
|
|
outputs = [ "$brave_dist_dir/{{source_file_part}}" ]
|
|
}
|
|
|
|
if (!is_android && !is_ios) {
|
|
copy("brave_dist_resources") {
|
|
sources = [ "$root_out_dir/version" ]
|
|
|
|
deps = [
|
|
":brave",
|
|
":brave_license_dist_resources",
|
|
":packed_resources",
|
|
"build/$target_os:brave",
|
|
"//brave/components/version_info:generate_version",
|
|
"//chrome:packed_resources",
|
|
"//third_party/icu:icudata",
|
|
]
|
|
|
|
if (!is_mac) {
|
|
sources += [
|
|
"$root_out_dir/$brave_exe",
|
|
"$root_out_dir/brave_100_percent.pak",
|
|
"$root_out_dir/brave_200_percent.pak",
|
|
"$root_out_dir/brave_resources.pak",
|
|
"$root_out_dir/chrome_100_percent.pak",
|
|
"$root_out_dir/chrome_200_percent.pak",
|
|
"$root_out_dir/icudtl.dat",
|
|
"$root_out_dir/resources.pak",
|
|
]
|
|
|
|
if (v8_use_external_startup_data) {
|
|
deps += [ "//v8" ]
|
|
|
|
if (use_v8_context_snapshot) {
|
|
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
|
|
deps += [ "//tools/v8_context_snapshot" ]
|
|
} else {
|
|
sources += [ "$root_out_dir/snapshot_blob.bin" ]
|
|
}
|
|
}
|
|
}
|
|
|
|
outputs = [ "$brave_dist_dir/{{source_file_part}}" ]
|
|
}
|
|
}
|
|
|
|
if (target_cpu == "x86") {
|
|
target_arch = "ia32"
|
|
} else {
|
|
target_arch = target_cpu
|
|
}
|
|
|
|
template("create_dist_template") {
|
|
action(target_name) {
|
|
inputs = get_target_outputs(":brave_license_dist_resources")
|
|
|
|
file_inputs = []
|
|
foreach(input, inputs) {
|
|
file_inputs += [ rebase_path(input, brave_dist_dir) ]
|
|
}
|
|
|
|
rebase_base_dir = rebase_path(brave_dist_dir)
|
|
|
|
outputs = [ invoker.output ]
|
|
rebase_output = rebase_path(invoker.output)
|
|
|
|
dir_inputs = invoker.dir_inputs
|
|
|
|
script = "//brave/script/create-dist.py"
|
|
|
|
deps = [ ":brave_license_dist_resources" ]
|
|
if (defined(invoker.deps)) {
|
|
deps += invoker.deps
|
|
}
|
|
|
|
args = [
|
|
"--base-dir=$rebase_base_dir",
|
|
"--inputs=$file_inputs",
|
|
"--dir-inputs=$dir_inputs",
|
|
"--output=$rebase_output",
|
|
]
|
|
}
|
|
}
|
|
|
|
if (should_generate_symbols) {
|
|
create_dist_template("create_brave_symbols_dist") {
|
|
if (is_android) {
|
|
# TODO(https://github.com/brave/brave-browser/issues/51200)
|
|
# Cleanup Mono once cr144 reaches stable channel, CI also needs to be updated
|
|
output = "$brave_dist_dir/$brave_dist_name-v$brave_version-$brave_platform-mono-$target_cpu-symbols-$target_android_output_format.zip"
|
|
} else {
|
|
output = "$brave_dist_dir/$brave_dist_name-v$brave_version-$brave_platform-$target_arch-symbols.zip"
|
|
}
|
|
|
|
deps = [ "//brave/app/$current_os:symbol_dist_resources" ]
|
|
|
|
if (is_win) {
|
|
dir_inputs = [ "$brave_product_name.syms" ]
|
|
} else {
|
|
dir_inputs = [ "$brave_product_name.breakpad.syms" ]
|
|
}
|
|
}
|
|
|
|
if (is_mac) {
|
|
copy("create_native_symbols_dist") {
|
|
sources = [ "$root_out_dir/$chrome_product_full_name.dSYM.tar.bz2" ]
|
|
outputs = [ "$brave_dist_dir/$brave_dist_name-v$brave_version-$brave_platform-$target_arch-native-symbols.tar.bz2" ]
|
|
|
|
deps = [ "//chrome:chrome_dsym_archive" ]
|
|
}
|
|
} else {
|
|
group("create_native_symbols_dist") {
|
|
}
|
|
}
|
|
}
|
|
|
|
group("create_symbols_dist") {
|
|
# Currently on some platforms (Android, Linux) this target generate more
|
|
# than just symbols, so always depend on it.
|
|
public_deps = [ "//brave/app/$current_os:symbol_dist_resources" ]
|
|
|
|
if (should_generate_symbols) {
|
|
public_deps += [
|
|
":create_brave_symbols_dist",
|
|
":create_native_symbols_dist",
|
|
]
|
|
}
|
|
}
|
|
|
|
action("create_dist_zips") {
|
|
output = "$brave_dist_dir/$brave_dist_name-v$brave_version-$brave_platform-$target_arch.zip"
|
|
outputs = [ output ]
|
|
|
|
if (is_win) {
|
|
# Repack a Chrome release archive to the Brave format.
|
|
# Besides changing from 7z to zip, the directory structure is a bit different.
|
|
# TODO(atuchin): support other platforms.
|
|
|
|
script = "//brave/script/repack-archive.py"
|
|
deps = [ "//chrome/installer/mini_installer:mini_installer_archive" ]
|
|
|
|
input = "$root_out_dir/chrome.7z"
|
|
inputs = [ input ]
|
|
|
|
args = [
|
|
"--input=" + rebase_path(input),
|
|
"--output=" + rebase_path(output),
|
|
"--target_dir=Chrome-bin",
|
|
]
|
|
} else { # !is_win
|
|
script = "//brave/script/create-dist.py"
|
|
|
|
inputs = []
|
|
deps = [ "app/$current_os:dist_resources" ]
|
|
|
|
if (!is_mac) {
|
|
inputs += get_target_outputs(":brave_license_dist_resources")
|
|
deps += [ ":brave_license_dist_resources" ]
|
|
}
|
|
|
|
if (!is_mac && !is_android && !is_ios) {
|
|
inputs += get_target_outputs(":brave_dist_resources")
|
|
inputs += get_target_outputs(":brave_locale_dist_resources")
|
|
if (enable_extensions) {
|
|
foreach(locale, platform_pak_locales) {
|
|
inputs += get_target_outputs(":brave_shields_locales_${locale}")
|
|
}
|
|
}
|
|
}
|
|
|
|
file_inputs = []
|
|
foreach(input, inputs) {
|
|
file_inputs += [ rebase_path(input, brave_dist_dir) ]
|
|
}
|
|
|
|
dir_inputs = []
|
|
if (is_mac) {
|
|
dir_inputs += [ brave_exe ]
|
|
rebase_base_dir = rebase_path(root_out_dir)
|
|
deps += [ "//chrome:chrome_app" ]
|
|
} else {
|
|
rebase_base_dir = rebase_path(brave_dist_dir, root_out_dir)
|
|
}
|
|
|
|
if (!is_mac && !is_android && !is_ios) {
|
|
deps += [
|
|
":brave_dist_resources",
|
|
":brave_locale_dist_resources",
|
|
]
|
|
|
|
if (enable_extensions) {
|
|
deps += [ ":brave_extensions_locale_dist_resources" ]
|
|
}
|
|
}
|
|
|
|
rebase_output = rebase_path(output)
|
|
args = [
|
|
"--base-dir=$rebase_base_dir",
|
|
"--inputs=$file_inputs",
|
|
"--dir-inputs=$dir_inputs",
|
|
"--output=$rebase_output",
|
|
]
|
|
} # !is_win
|
|
}
|
|
|
|
if (is_mac) {
|
|
group("brave_app") {
|
|
deps = [ ":brave_app_plist" ]
|
|
}
|
|
|
|
brave_tweak_info_plist("brave_app_plist") {
|
|
info_plist = "$root_gen_dir/chrome/chrome_app_plist_tweaked.plist"
|
|
|
|
args = [
|
|
"--brave_channel=" + brave_channel,
|
|
"--brave_product_dir_name=" + brave_product_dir_name,
|
|
"--brave_version=" + brave_version,
|
|
"--brave_eddsa_key=" + sparkle_eddsa_public_key,
|
|
]
|
|
|
|
if (skip_signing) {
|
|
args += [ "--skip_signing" ]
|
|
}
|
|
|
|
if (enable_updater) {
|
|
args += [ "--enable_updater" ]
|
|
}
|
|
|
|
deps = [ "//chrome:chrome_app_plist" ]
|
|
}
|
|
|
|
brave_tweak_info_plist("brave_helper_plist") {
|
|
info_plist = "$root_gen_dir/chrome/chrome_helper_plist_tweaked.plist"
|
|
|
|
args = [
|
|
"--brave_channel=" + brave_channel,
|
|
"--brave_product_dir_name=" + brave_product_dir_name,
|
|
"--brave_version=" + brave_version,
|
|
]
|
|
|
|
deps = [ "//chrome:chrome_helper_plist" ]
|
|
}
|
|
}
|
|
|
|
if (current_toolchain == host_toolchain) {
|
|
action("audit_deps") {
|
|
script = "//brave/script/audit_deps.py"
|
|
output = "$target_gen_dir/audit_deps.json"
|
|
|
|
deps = [ "//brave/tools/crates:cargo-audit" ]
|
|
|
|
# Action must have outputs, and these outputs must be created, otherwise
|
|
# SISO will fail.
|
|
outputs = [ output ]
|
|
|
|
args = [
|
|
"--source_root=" + rebase_path("//brave"),
|
|
"--cargo_audit_exe=" +
|
|
rebase_path("$root_build_dir/cargo-audit$host_exe_suffix"),
|
|
"--output=" + rebase_path(output),
|
|
]
|
|
|
|
if (audit_dev_deps) {
|
|
args += [ "--audit_dev_deps" ]
|
|
}
|
|
}
|
|
}
|
|
|
|
if (is_redirect_cc_build) {
|
|
group("redirect_cc") {
|
|
deps = [ "//brave/tools/redirect_cc" ]
|
|
}
|
|
}
|
|
if (is_win && enable_resource_allowlist_generation) {
|
|
# Merge chrome_resource_allowlist and wireguard resources allowlist to keep
|
|
# wireguard resources in pak files. When VPN is disabled, just copy the chrome
|
|
# allowlist.
|
|
if (enable_brave_vpn_v1) {
|
|
action("merge_allowlists") {
|
|
deps = [
|
|
"//brave/browser/brave_vpn/win/brave_vpn_wireguard_service:wireguard_resource_allowlist",
|
|
"//chrome:resource_allowlist",
|
|
]
|
|
|
|
script = "//brave//resources/brave_allowlist.py"
|
|
source_allowlist = "$root_gen_dir/chrome/chrome_resource_allowlist.txt"
|
|
args = [
|
|
"--repack_allowlist",
|
|
rebase_path(source_allowlist, root_build_dir),
|
|
"--brave_allowlist",
|
|
rebase_path(wireguard_resource_allowlist_file, root_build_dir),
|
|
"--output",
|
|
rebase_path(brave_allowlist_file, root_build_dir),
|
|
]
|
|
|
|
outputs = [ brave_allowlist_file ]
|
|
}
|
|
} else {
|
|
# When VPN is disabled, just copy the chrome resource allowlist.
|
|
copy("merge_allowlists") {
|
|
deps = [ "//chrome:resource_allowlist" ]
|
|
sources = [ "$root_gen_dir/chrome/chrome_resource_allowlist.txt" ]
|
|
outputs = [ brave_allowlist_file ]
|
|
}
|
|
}
|
|
}
|