Skip to content

Commit

Permalink
GN: Get //chrome/* mostly working on android
Browse files Browse the repository at this point in the history
This gets the //chrome subtree down to a fairly small number of build
errors on Android. Most of the changes are making features not enabled
on android like extensions and plugins properly guarded. This also adds
a few jni targets and fixes up some bitrotted bits.

R=brettw@chromium.org, cjhopman@chromium.org

Review URL: https://codereview.chromium.org/571863002

Cr-Commit-Position: refs/heads/master@{#295231}
  • Loading branch information
jamesr committed Sep 17, 2014
1 parent d3e622b commit 2ed4d69
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 59 deletions.
20 changes: 6 additions & 14 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@ group("root") {
"//cc/blink",
"//chrome/browser",
"//chrome/browser/devtools",
"//chrome/browser/ui",
"//chrome/browser/ui/views",
"//chrome/common",
"//chrome/plugin",
"//chrome/renderer",
"//chrome/service",
"//chrome/utility",
"//components:all_components",
"//content",
Expand Down Expand Up @@ -78,7 +75,6 @@ group("root") {
"//third_party/iccjpeg",
"//third_party/icu",
"//third_party/leveldatabase",
"//third_party/libaddressinput",
"//third_party/libphonenumber",
"//third_party/libjingle",
"//third_party/libpng",
Expand Down Expand Up @@ -183,15 +179,12 @@ group("root") {

deps -= [
"//apps", # Needs testing.
"//chrome/browser", # Blocked on content.
"//chrome/browser/devtools", # Blocked on content.
"//chrome/browser/ui", # Blocked on content.
"//chrome/browser/ui/views", # Blocked on content.
"//chrome/common", # Blocked on content.
"//chrome/plugin", # Blocked on content.
"//chrome/renderer", # Blocked on content.
"//chrome/service", # Blocked on content.
"//chrome/utility", # Blocked on content.
"//chrome/browser",
"//chrome/browser/devtools",
"//chrome/common",
"//chrome/plugin",
"//chrome/renderer",
"//chrome/utility",
"//content/shell:content_shell",
"//extensions/browser",
"//extensions/common",
Expand Down Expand Up @@ -222,7 +215,6 @@ group("root") {
"//remoting/client/plugin",
"//storage/browser",
"//third_party/cld_2",
"//third_party/libaddressinput",
"//third_party/ffmpeg",
"//ui/app_list",
"//ui/web_dialogs",
Expand Down
4 changes: 3 additions & 1 deletion build/config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ config("feature_flags") {
# TODO(brettw) most of these need to be parameterized.
defines = [
"CHROMIUM_BUILD",
"ENABLE_NOTIFICATIONS",
"ENABLE_EGLIMAGE=1",
"ENABLE_BACKGROUND=1",
"V8_DEPRECATION_WARNINGS", # Don't use deprecated V8 APIs anywhere.
Expand All @@ -43,6 +42,9 @@ config("feature_flags") {
if (enable_mdns) {
defines += [ "ENABLE_MDNS=1" ]
}
if (enable_notifications) {
defines += [ "ENABLE_NOTIFICATIONS" ]
}
if (enable_pepper_cdms) {
# TODO(brettw) should probably be "=1"
defines += [ "ENABLE_PEPPER_CDMS" ]
Expand Down
16 changes: 11 additions & 5 deletions chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import("//build/config/ui.gni")
import("//chrome/chrome_repack_locales.gni")
import("//chrome/version.gni")

if (!is_android) {

# TODO(GYP) for Windows need to the the reorder-imports step which probably
# means adding another target and renaming this to chrome_initial like in GYP.
executable("chrome") {
Expand Down Expand Up @@ -104,14 +106,16 @@ executable("chrome") {
}


if (!is_mac && !is_android) {
# On Mac this is done in chrome_dll.gypi. Android doesn't use pdfium.
if (!is_mac) {
# On Mac this is done in chrome_dll.gypi.
datadeps += [ "//pdf" ]

# TODO(GYP) pdf linux symbols
}
}

} # !is_android

shared_library("main_dll") {
configs += [ "//build/config/compiler:wexit_time_destructors" ]

Expand Down Expand Up @@ -372,16 +376,18 @@ repack("packed_extra_resources") {
"$root_gen_dir/blink/public/resources/blink_resources.pak",
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/extensions/extensions_renderer_resources.pak",
"$root_gen_dir/extensions/extensions_resources.pak",
]
}
if (is_chromeos) {
sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
deps += [ "//ui/file_manager:resources" ]
}
if (enable_extensions) {
sources += [ "$root_gen_dir/chrome/extensions_api_resources.pak" ]
sources += [
"$root_gen_dir/chrome/extensions_api_resources.pak",
"$root_gen_dir/extensions/extensions_renderer_resources.pak",
"$root_gen_dir/extensions/extensions_resources.pak",
]
deps += [ "//chrome/common:extensions_api_resources" ]
}

Expand Down
35 changes: 26 additions & 9 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//components/nacl/nacl_defines.gni")
import("//tools/grit/grit_rule.gni")
# //build/config/android/rules.gni imports //tools/grit/grit_rule.gni, which
# produces a conflict for the "grit" template so we have to only include one.
if (is_android) {
import("//build/config/android/rules.gni")
} else {
import("//tools/grit/grit_rule.gni")
}

about_credits_file = "$target_gen_dir/about_credits.html"
additional_modules_list_file =
Expand Down Expand Up @@ -69,7 +75,6 @@ static_library("browser") {
"//components/os_crypt",
"//components/password_manager/core/browser",
"//components/password_manager/core/common",
"//components/pdf/browser",
"//components/policy:policy_component",
"//components/precache/core",
"//components/query_parser",
Expand Down Expand Up @@ -263,7 +268,7 @@ static_library("browser") {
# ["debug_devtools==1", { TODO(GYP)
# "defines": [
# "DEBUG_DEVTOOLS=1",
# ],
# }],
if (enable_configuration_policy) {
sources += rebase_path(
gypi_values.chrome_browser_policy_shared_with_ios_sources,
Expand All @@ -286,10 +291,7 @@ static_library("browser") {
sources += rebase_path(gypi_values.chrome_browser_policy_desktop_sources,
".", "//chrome")
}
if (is_android || is_ios) {
sources += rebase_path(gypi_values.chrome_browser_mobile_sources,
".", "//chrome")
} else { # Non-mobile
if (!is_android && !is_ios) { # Non-mobile
deps += [
"//chrome/browser/policy:path_parser",
]
Expand All @@ -304,6 +306,7 @@ static_library("browser") {
sources += rebase_path(gypi_values.chrome_browser_plugins_sources,
".", "//chrome")
deps += [
"//components/pdf/browser",
"//ppapi:ppapi_ipc",
"//third_party/adobe/flash:flapper_version_h",
]
Expand Down Expand Up @@ -459,9 +462,9 @@ static_library("browser") {
sources += rebase_path(gypi_values.chrome_browser_android_sources,
".", "//chrome")
deps += [
":jni_headers",
"//components/cdm/browser",
#"../components/components.gyp:web_contents_delegate_android", TODO(GYP)
#"chrome_browser_jni_headers", TODO(GYP)
]
deps -= [
"//third_party/libaddressinput",
Expand Down Expand Up @@ -616,6 +619,15 @@ static_library("browser") {
}
}

if (is_android) {
# GYP version: chrome/chrome_browser.gypi:chrome_browser_jni_headers
generate_jni("jni_headers") {
sources = rebase_path(
gypi_values.chrome_browser_jni_sources, ".", "//chrome")
jni_package = "chrome"
}
}

# GYP version: chrome/chrome_resources.gyp:chrome_resources
# (generate_browser_resources action)
grit("resources") {
Expand Down Expand Up @@ -781,11 +793,16 @@ source_set("test_support") {
if (!is_ios) {
deps += [
"//components/sessions:test_support",
"//extensions:test_support",
"//google_apis:test_support",
]
}

if (enable_extensions) {
deps += [
"//extensions:test_support",
]
}

if (is_chromeos) {
sources += [
"chromeos/app_mode/fake_cws.cc",
Expand Down
6 changes: 4 additions & 2 deletions chrome/browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ static_library("ui") {
"//chrome/app/theme:theme_resources",
"//chrome/browser/history:in_memory_url_index_cache_proto",
"//chrome/browser/net:cert_logger_proto",
"//chrome/browser/ui/views",
"//chrome/common",
"//chrome/common/net",
"//components/auto_login_parser",
Expand Down Expand Up @@ -83,6 +82,7 @@ static_library("ui") {
".", "//chrome")
deps += [
"//chrome/browser/devtools",
"//chrome/browser/ui/views",
"//chrome/browser/ui/webui/omnibox:mojo_bindings",
"//chrome/common/extensions/api",
"//chrome/common/extensions/api:api_registration",
Expand Down Expand Up @@ -266,9 +266,9 @@ static_library("ui") {

if (is_android) {
deps += [
"//chrome/browser:jni_headers",
"//crypto:platform",
#'../components/components.gyp:web_contents_delegate_android', TODO(GYP)
#'chrome_browser_jni_headers', TODO(GYP)
]
deps -= [
"//chrome/browser/ui/views",
Expand All @@ -278,6 +278,8 @@ static_library("ui") {
]
sources += rebase_path(gypi_values.chrome_browser_ui_android_sources,
".", "//chrome")

defines += [ "CHROME_BUILD_ID=" + android_chrome_build_id ]
} else { # Non-Android.
sources += rebase_path(gypi_values.chrome_browser_ui_non_android_sources,
".", "//chrome")
Expand Down
10 changes: 5 additions & 5 deletions chrome/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ static_library("common") {
"//components/variations",
"//content/public/common",
"//crypto",
"//extensions:extensions_resources",
"//extensions/strings",
"//media/cast:net",
"//net",
"//skia",
Expand Down Expand Up @@ -91,8 +89,6 @@ static_library("common") {
"//components/password_manager/core/common",
"//components/signin/core/common",
"//components/translate/content/common",
"//extensions/common",
"//extensions/common/api",
"//ipc",
"//third_party/re2",
"//third_party/widevine/cdm:version_h",
Expand All @@ -106,6 +102,10 @@ static_library("common") {
deps += [
"//device/bluetooth",
"//device/usb",
"//extensions/common",
"//extensions/common/api",
"//extensions/strings",
"//extensions:extensions_resources",
]
}

Expand Down Expand Up @@ -235,7 +235,7 @@ static_library("common") {
}
}

if (is_linux) {
if (is_linux || is_android) {
# TODO(brettw) this duplicates "//chrome/common:version" which applies to
# Windows.
import("//chrome/version.gni")
Expand Down
10 changes: 6 additions & 4 deletions chrome/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ static_library("renderer") {
"//components/cdm/renderer",
"//components/data_reduction_proxy/common",
"//components/password_manager/content/renderer",
"//components/pdf/renderer",
"//components/plugins/renderer",
"//components/startup_metric_utils",
"//components/translate/content/renderer",
"//components/translate/core/common",
Expand All @@ -50,7 +48,6 @@ static_library("renderer") {
"//content/app/resources",
"//content/app/strings",
"//content/public/renderer",
"//extensions:extensions_resources",
"//media/cast:net",
"//media/cast:sender",
"//media/cast/logging/proto",
Expand Down Expand Up @@ -78,6 +75,8 @@ static_library("renderer") {
sources += rebase_path(gypi_values.chrome_renderer_plugin_sources,
".", "..")
deps += [
"//components/pdf/renderer",
"//components/plugins/renderer",
"//ppapi:ppapi_host",
"//ppapi:ppapi_ipc",
"//ppapi:ppapi_proxy",
Expand Down Expand Up @@ -107,7 +106,10 @@ static_library("renderer") {
if (enable_extensions) {
sources += rebase_path(gypi_values.chrome_renderer_extensions_sources,
".", "..")
deps += [ "//extensions/renderer" ]
deps += [
"//extensions:extensions_resources",
"//extensions/renderer",
]
}
if (enable_webrtc) {
sources += rebase_path(gypi_values.chrome_renderer_webrtc_sources,
Expand Down
2 changes: 1 addition & 1 deletion chrome/utility/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static_library("utility") {
}

if (use_openssl) {
if (!is_win && !is_mac) {
if (!is_win && !is_mac && !is_android) {
sources -= [ "importer/nss_decryptor.cc" ]
}
} else { # !use_openssl
Expand Down
8 changes: 0 additions & 8 deletions components/autofill/core/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@

static_library("common") {
sources = [
# TODO(brettw) why are these "browser" files in the "common" target?
"../browser/android/auxiliary_profile_loader_android.cc",
"../browser/android/auxiliary_profile_loader_android.h",
"../browser/android/auxiliary_profiles_android.cc",
"../browser/android/auxiliary_profiles_android.h",
"../browser/android/component_jni_registrar.cc",
"../browser/android/component_jni_registrar.h",
"../browser/android/personal_data_manager_android.cc",
"autofill_constants.cc",
"autofill_constants.h",
"autofill_data_validation.cc",
Expand Down
15 changes: 14 additions & 1 deletion components/dom_distiller/core/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static_library("core") {
]

if (is_android) {
#deps += [ ":dom_distiller_core_jni_headers" ] TODO(GYP)
deps += [ ":jni_headers" ]
}
}

Expand Down Expand Up @@ -114,3 +114,16 @@ source_set("unit_tests") {
"//testing/gtest",
]
}

if (is_android) {
import("//build/config/android/rules.gni")

generate_jni("jni_headers") {
sources = [
"../android/java/src/org/chromium/components/dom_distiller/core/DistilledPagePrefs.java",
"../android/java/src/org/chromium/components/dom_distiller/core/DomDistillerService.java",
"../android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java",
]
jni_package = "dom_distiller_core"
}
}
1 change: 1 addition & 0 deletions components/gcm_driver.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
'includes': [ '../build/java.gypi' ],
},
{
# GN version: //components/gcm_driver:jni_headers
'target_name': 'gcm_driver_jni_headers',
'type': 'none',
'sources': [
Expand Down
Loading

0 comments on commit 2ed4d69

Please sign in to comment.