From da8b0a0f2cba3dc0ed0a9748f169f7c7e47e83ba Mon Sep 17 00:00:00 2001 From: Simon Hong Date: Wed, 1 Aug 2018 14:49:46 +0900 Subject: [PATCH 1/2] Fix BraveAutocompleteController undefined reference error on debug build This error occurs when builds vr_common target. In C69, vr_common target is changed from static lib to shared lib. and vr_common depends on components/omnibox/browser target. To fix undefined reference to BraveAutocompleteController when builds vr_common shared lib, components/omnibox/browser should include brave/components/omnibox/browser. --- browser/BUILD.gn | 1 - components/omnibox/browser/BUILD.gn | 9 +++++---- patches/components-omnibox-browser-BUILD.gn.patch | 12 ++++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 patches/components-omnibox-browser-BUILD.gn.patch diff --git a/browser/BUILD.gn b/browser/BUILD.gn index 63846788ad4d..b375708580e0 100644 --- a/browser/BUILD.gn +++ b/browser/BUILD.gn @@ -101,7 +101,6 @@ source_set("browser") { deps = [ "//brave/components/brave_shields/browser:brave_shields", - "//brave/components/omnibox/browser:brave_autocomplete", "extensions", "net", ] diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn index 565f9cb07efc..b6a477bd41a1 100644 --- a/components/omnibox/browser/BUILD.gn +++ b/components/omnibox/browser/BUILD.gn @@ -1,4 +1,4 @@ -source_set("brave_autocomplete") { +source_set("browser") { sources = [ "brave_autocomplete_controller.cc", "brave_autocomplete_controller.h", @@ -7,9 +7,10 @@ source_set("brave_autocomplete") { "topsites_provider.h", ] + # Don't make this target depends on chrome layer. + # This target is compiled together with //components/omnibox/browser static lib. deps = [ - ] - public_deps = [ - "//chrome/common", + "//skia", + "//third_party/metrics_proto", ] } diff --git a/patches/components-omnibox-browser-BUILD.gn.patch b/patches/components-omnibox-browser-BUILD.gn.patch new file mode 100644 index 000000000000..aba0c1916c12 --- /dev/null +++ b/patches/components-omnibox-browser-BUILD.gn.patch @@ -0,0 +1,12 @@ +diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn +index c06139016ea7e4228c7442f4a1bd0ce0fc7c79bc..3b45fd207ba726dd6f1a23ac3992c83f6cf188e7 100644 +--- a/components/omnibox/browser/BUILD.gn ++++ b/components/omnibox/browser/BUILD.gn +@@ -194,6 +194,7 @@ static_library("browser") { + "//ui/gfx", + "//url", + ] ++ if (brave_chromium_build) { deps += [ "//brave/components/omnibox/browser" ] } + + if ((!is_android || enable_vr) && !is_ios) { + sources += get_target_outputs(":omnibox_vector_icons") From 723ce1cd2d34b05563e88d02feff8d3f1d62316b Mon Sep 17 00:00:00 2001 From: Simon Hong Date: Wed, 1 Aug 2018 16:16:31 +0900 Subject: [PATCH 2/2] Fix undefined brave::GetChannelImpl when builds vr_common shared lib In C69, vr_common target changed to shared lib. It has dependency chrome/common:channel_info and chrome/common:channel_info calls brave's code. To fix, our additional channel info implementation is added to chrome/common:channel_info target. --- .../chrome/common/channel_info_posix.cc | 4 ---- common/BUILD.gn | 17 +++++++++++++---- patches/chrome-common-BUILD.gn.patch | 12 ++++++++++++ 3 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 patches/chrome-common-BUILD.gn.patch diff --git a/chromium_src/chrome/common/channel_info_posix.cc b/chromium_src/chrome/common/channel_info_posix.cc index 85125d4f41f9..9be9cf37739d 100644 --- a/chromium_src/chrome/common/channel_info_posix.cc +++ b/chromium_src/chrome/common/channel_info_posix.cc @@ -9,10 +9,6 @@ #include "build/build_config.h" #include "components/version_info/version_info.h" -// Including here instead of build config because -// our brave/common BUILD config still gets linking errors. -#include "brave/common/brave_channel_info_posix.cc" - namespace chrome { std::string GetChannelName() { diff --git a/common/BUILD.gn b/common/BUILD.gn index fe58b656fdcf..d6ebbbcc46dc 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -1,3 +1,16 @@ +source_set("channel_info") { + if (is_linux) { + sources = [ + "brave_channel_info_posix.cc", + "brave_channel_info_posix.h", + ] + + configs += [ + "//brave/build/linux:linux_channel_names", + ] + } +} + source_set("common") { sources = [ "brave_paths.cc", @@ -45,10 +58,6 @@ source_set("common") { "importer/brave_importer_utils_linux.cc", "importer/chrome_importer_utils_linux.cc", ] - - configs += [ - "//brave/build/linux:linux_channel_names", - ] } if (is_win) { diff --git a/patches/chrome-common-BUILD.gn.patch b/patches/chrome-common-BUILD.gn.patch new file mode 100644 index 000000000000..0e9e22ec0ac6 --- /dev/null +++ b/patches/chrome-common-BUILD.gn.patch @@ -0,0 +1,12 @@ +diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn +index 9a21e268447a0ea984101132329073dca486f6ad..a916c8e70e8f19a52f2a0993fc78712f8cb15778 100644 +--- a/chrome/common/BUILD.gn ++++ b/chrome/common/BUILD.gn +@@ -77,6 +77,7 @@ source_set("channel_info") { + if (is_android) { + public_deps += [ "//components/version_info/android:channel_getter" ] + } ++ if (brave_chromium_build) { deps = [ "//brave/common:channel_info" ] } + } + + source_set("ini_parser") {