From 11a68cbf1df1110ebac0b649edf2aef22682387e Mon Sep 17 00:00:00 2001 From: cjhopman Date: Mon, 13 Oct 2014 15:47:54 -0700 Subject: [PATCH] Make chrome_shell_apk build This mostly just adds the chrome_shell_apk build definition and those of a whole bunch of targets. Adds a simple check that when DEPRECATED_java_in_dir is used, it actually includes the "src" at the end (GYP just assumes that you really meant that java files are in <(java_in_dir)/src). Makes the call to process_resources only generate R.java for extra packages when being run as part of the apk step (otherwise, for example, both chrome resources and content resources would contain an R.java for net resources and compilation would fail). Depends on https://codereview.chromium.org/581273004/ Adds the following targets -- and enables ~300 more (550 counting template-generated inner targets): //chrome:chrome_android_core //chrome/android:chrome_strings_grd //chrome/android:chrome_java //chrome/android:activity_type_ids_javagen //chrome/android:app_banner_metrics_ids_javagen //chrome/android:resource_id_javagen //chrome/android:profile_account_management_metrics_javagen //chrome/android:profile_sync_service_model_type_selection_javagen //chrome/android:toolbar_model_security_levels_javagen //chrome/android:tab_load_status_javagen //chrome/android:chrome_shell_base //chrome/android:chrome_shell //chrome/android:chrome_sync_shell //chrome/android:chrome_shell_resources //chrome/android:chrome_shell_java //chrome/android:chrome_shell_assets //chrome/android:chrome_shell_apk //chrome/android:chrome_sync_shell_apk //components/bookmarks:bookmarks_java //components/bookmarks:bookmarks_jni_headers //components/bookmarks:bookmark_type_javagen //components/dom_distiller/android:dom_distiller_core_java //components/dom_distiller/android:dom_distiller_core_font_family_javagen //components/dom_distiller/android:dom_distiller_core_theme_javagen //components/enhanced_bookmarks:jni_headers //components/enhanced_bookmarks/android:enhanced_bookmarks_java //components/gcm_driver:gcm_driver_java //components/gcm_driver:jni_headers //components/navigation_interception/android:navigation_interception_java //components/variations:variations_java //components/web_contents_delegate_android:web_contents_delegate_android //components/web_contents_delegate_android:web_contents_delegate_android_java //components/web_contents_delegate_android:web_contents_delegate_android_jni_headers //printing:printing_java //sync:fake_server_jni //sync:sync_java_test_support //sync:test_support_sync_fake_server_android //sync:sync_unit_tests_apk //sync/android:sync_java //sync/android:sync_javatests BUG=359249 TBR=ben Review URL: https://codereview.chromium.org/570203002 Cr-Commit-Position: refs/heads/master@{#299381} --- BUILD.gn | 1 + build/android/gyp/write_build_config.py | 3 + build/config/android/config.gni | 1 + build/config/android/internal_rules.gni | 37 +- build/config/android/rules.gni | 18 +- chrome/BUILD.gn | 51 ++- chrome/android/BUILD.gn | 409 +++++++++++++++++++++ .../chromium/chrome/shell/ChromeShellActivity.java | 79 ++-- chrome/browser/ui/BUILD.gn | 7 +- chrome/chrome.gyp | 4 +- chrome/chrome_android.gypi | 2 + chrome/chrome_browser.gypi | 8 + chrome/chrome_shell.gypi | 7 + chrome/common/BUILD.gn | 5 +- components/bookmarks.gypi | 3 + components/bookmarks/common/android/BUILD.gn | 35 ++ components/dom_distiller.gypi | 4 + components/dom_distiller/android/BUILD.gn | 42 +++ components/enhanced_bookmarks.gypi | 2 + components/enhanced_bookmarks/BUILD.gn | 2 + components/gcm_driver.gypi | 3 +- components/gcm_driver/BUILD.gn | 15 +- components/gcm_driver/android/BUILD.gn | 26 ++ components/invalidation/BUILD.gn | 64 ++-- components/navigation_interception.gypi | 1 + components/navigation_interception/BUILD.gn | 3 +- .../navigation_interception/android/BUILD.gn | 12 + components/variations.gypi | 3 +- components/variations/BUILD.gn | 1 + components/variations/android/BUILD.gn | 14 + components/web_contents_delegate_android.gypi | 3 + components/web_contents_delegate_android/BUILD.gn | 52 +++ content/public/test/android/BUILD.gn | 2 +- device/usb/BUILD.gn | 2 + extensions/BUILD.gn | 15 +- printing/BUILD.gn | 20 +- printing/printing.gyp | 8 +- sync/BUILD.gn | 49 ++- sync/android/BUILD.gn | 31 ++ sync/sync_android.gypi | 1 + sync/sync_tests.gypi | 9 +- third_party/libusb/BUILD.gn | 2 + 42 files changed, 922 insertions(+), 134 deletions(-) create mode 100644 chrome/android/BUILD.gn create mode 100644 components/bookmarks/common/android/BUILD.gn create mode 100644 components/dom_distiller/android/BUILD.gn create mode 100644 components/gcm_driver/android/BUILD.gn create mode 100644 components/navigation_interception/android/BUILD.gn create mode 100644 components/variations/android/BUILD.gn create mode 100644 components/web_contents_delegate_android/BUILD.gn create mode 100644 sync/android/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn index f9c011078990..dcd15641b1b1 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -168,6 +168,7 @@ group("root") { deps += [ "//third_party/openmax_dl/dl", "//content/shell/android:content_shell_apk", + "//chrome/android:chrome_shell_apk", "//ui/android:ui_java", "//third_party/android_tools:android_gcm_java", "//third_party/android_tools:uiautomator_java", diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py index ab70a79056bf..722d18cfa8bc 100755 --- a/build/android/gyp/write_build_config.py +++ b/build/android/gyp/write_build_config.py @@ -171,6 +171,9 @@ def main(argv): config['resources'] = {} config['resources']['dependency_zips'] = [ c['resources_zip'] for c in all_resources_deps] + config['resources']['extra_package_names'] = [] + + if options.type == 'android_apk': config['resources']['extra_package_names'] = [ c['package_name'] for c in all_resources_deps if 'package_name' in c] diff --git a/build/config/android/config.gni b/build/config/android/config.gni index 760328095fc8..a8701fb9ae1e 100644 --- a/build/config/android/config.gni +++ b/build/config/android/config.gni @@ -63,6 +63,7 @@ if (is_android) { # Path to the Android NDK and SDK. android_ndk_root = "//third_party/android_tools/ndk" + android_ndk_include_dir = "$android_ndk_root/usr/include" android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}" diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index da77f38f5e0b..abd971128393 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni @@ -85,11 +85,6 @@ template("write_build_config") { deps += invoker.deps } - outputs = [ - depfile, - build_config - ] - possible_deps_configs = [] foreach(d, deps) { dep_gen_dir = get_label_info(d, "target_gen_dir") @@ -98,6 +93,11 @@ template("write_build_config") { } rebase_possible_deps_configs = rebase_path(possible_deps_configs) + outputs = [ + depfile, + build_config + ] + args = [ "--type", type, "--depfile", rebase_path(depfile, root_build_dir), @@ -565,6 +565,14 @@ template("android_java_library") { if (defined(invoker.java_files)) { _java_files = invoker.java_files } else if (defined(invoker.DEPRECATED_java_in_dir)) { + _src_dir = invoker.DEPRECATED_java_in_dir + "/src" + _src_dir_exists = exec_script("//build/dir_exists.py", + [ rebase_path(_src_dir, root_build_dir) ], + "string") + assert(_src_dir_exists == "False", + "In GN, java_in_dir should be the fully specified java directory " + + "(i.e. including the trailing \"/src\")") + _java_files_build_rel = exec_script( "//build/android/gyp/find.py", [ @@ -718,10 +726,9 @@ template("copy_ex") { action(target_name) { script = "//build/android/gyp/copy_ex.py" - depfile = "$target_gen_dir/$target_name.d" - outputs = [ - depfile, - ] + + if (defined(invoker.deps)) { deps = invoker.deps } + sources = [] if (defined(invoker.sources)) { sources += invoker.sources @@ -732,18 +739,24 @@ template("copy_ex") { inputs += invoker.inputs } + depfile = "$target_gen_dir/$target_name.d" + outputs = [ + depfile, + ] + args = [ "--depfile", rebase_path(depfile, root_build_dir), "--dest", rebase_path(invoker.dest, root_build_dir), ] - if (defined(invoker.args)) { - args += invoker.args - } rebased_sources = rebase_path(sources, root_build_dir) args += [ "--files=$rebased_sources" ] if (defined(invoker.clear_dir) && invoker.clear_dir) { args += ["--clear"] } + + if (defined(invoker.args)) { + args += invoker.args + } } } diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index 3849899192b1..0c9dbf221110 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni @@ -34,8 +34,9 @@ template("generate_jni") { assert(defined(invoker.sources)) assert(defined(invoker.jni_package)) jni_package = invoker.jni_package - base_output_dir = "${root_gen_dir}/${target_name}/${jni_package}" - jni_output_dir = "${base_output_dir}/jni" + base_output_dir = "${target_gen_dir}/${target_name}" + package_output_dir = "${base_output_dir}/${jni_package}" + jni_output_dir = "${package_output_dir}/jni" jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h" @@ -66,7 +67,13 @@ template("generate_jni") { } config("jni_includes_${target_name}") { - include_dirs = [ base_output_dir ] + # TODO(cjhopman): #includes should probably all be relative to + # base_output_dir. Remove that from this config once the includes are + # updated. + include_dirs = [ + base_output_dir, + package_output_dir, + ] } group(target_name) { @@ -79,6 +86,8 @@ template("generate_jni") { if (defined(invoker.public_deps)) { public_deps = invoker.public_deps } + + if (defined(invoker.visibility)) { visibility = invoker.visibility } } } @@ -982,8 +991,9 @@ template("unittest_apk") { android_manifest = "//testing/android/java/AndroidManifest.xml" unittests_outputs = [ unittests_binary ] native_libs = [unittests_outputs[0]] + deps = [ "//base:base_java" ] if (defined(invoker.deps)) { - deps = invoker.deps + deps += invoker.deps } datadeps = [ "//tools/android/md5sum", diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index 4bf0a5d60f5e..f57535907ccb 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn @@ -8,6 +8,10 @@ import("//build/config/ui.gni") import("//chrome/chrome_repack_locales.gni") import("//chrome/version.gni") +if (is_android) { + import("//build/config/android/rules.gni") +} + if (!is_android) { # TODO(GYP) for Windows need to the the reorder-imports step which probably @@ -322,7 +326,7 @@ group("packed_resources") { } repack("packed_extra_resources") { - visibility = [ ":*" ] + visibility = [ "./*" ] sources = [ "$root_gen_dir/chrome/browser_resources.pak", "$root_gen_dir/chrome/chrome_unscaled_resources.pak", @@ -522,3 +526,48 @@ group("strings") { "//chrome/app/resources:locale_settings", ] } + +if (is_android) { + +# GYP: //chrome/chrome.gyp:page_info_connection_type_java +java_cpp_enum("page_info_connection_type_javagen") { + sources = [ + "browser/ui/android/website_settings_popup_android.h" + ] + outputs = [ + "org/chromium/chrome/browser/PageInfoConnectionType.java", + ] +} + +# GYP: //chrome/chrome_android.gypi:chrome_android_core +static_library("chrome_android_core") { + sources = [ + "app/android/chrome_android_initializer.cc", + "app/android/chrome_android_initializer.h", + "app/android/chrome_main_delegate_android.cc", + "app/android/chrome_main_delegate_android.h", + "app/chrome_main_delegate.cc", + "app/chrome_main_delegate.h", + ] + + include_dirs = [ + android_ndk_include_dir, + ] + + libs = [ + "android", + "jnigraphics", + ] + + deps = [ + "//chrome/browser", + "//chrome/browser/ui", + "//chrome/plugin", + "//chrome/renderer", + "//chrome/utility", + "//components/enhanced_bookmarks", + "//content/public/app:browser", + ] +} + +} diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn new file mode 100644 index 000000000000..202fcd39be40 --- /dev/null +++ b/chrome/android/BUILD.gn @@ -0,0 +1,409 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/config.gni") +import("//build/config/android/rules.gni") +import("//chrome/version.gni") +import("//third_party/icu/config.gni") + + +# GYP: //chrome/chrome.gyp:chrome_java (resources part) +android_resources("chrome_java_resources") { + resource_dirs = [ + "java/res", + ] + deps = [ + ":chrome_strings_grd", + "//content/public/android:content_java_resources", + "//chrome/app:java_strings_grd", + "//third_party/android_tools:android_support_v7_appcompat_resources", + ] + custom_package = "org.chromium.chrome" +} + +# GYP: //chrome/chrome.gyp:chrome_strings_grd +java_strings_grd("chrome_strings_grd") { + grd_file = "java/strings/android_chrome_strings.grd" + outputs = [ + "values-am/android_chrome_strings.xml", + "values-ar/android_chrome_strings.xml", + "values-bg/android_chrome_strings.xml", + "values-ca/android_chrome_strings.xml", + "values-cs/android_chrome_strings.xml", + "values-da/android_chrome_strings.xml", + "values-de/android_chrome_strings.xml", + "values-el/android_chrome_strings.xml", + "values/android_chrome_strings.xml", + "values-en-rGB/android_chrome_strings.xml", + "values-es/android_chrome_strings.xml", + "values-es-rUS/android_chrome_strings.xml", + "values-fa/android_chrome_strings.xml", + "values-fi/android_chrome_strings.xml", + "values-tl/android_chrome_strings.xml", + "values-fr/android_chrome_strings.xml", + "values-hi/android_chrome_strings.xml", + "values-hr/android_chrome_strings.xml", + "values-hu/android_chrome_strings.xml", + "values-in/android_chrome_strings.xml", + "values-it/android_chrome_strings.xml", + "values-iw/android_chrome_strings.xml", + "values-ja/android_chrome_strings.xml", + "values-ko/android_chrome_strings.xml", + "values-lt/android_chrome_strings.xml", + "values-lv/android_chrome_strings.xml", + "values-nl/android_chrome_strings.xml", + "values-nb/android_chrome_strings.xml", + "values-pl/android_chrome_strings.xml", + "values-pt-rBR/android_chrome_strings.xml", + "values-pt-rPT/android_chrome_strings.xml", + "values-ro/android_chrome_strings.xml", + "values-ru/android_chrome_strings.xml", + "values-sk/android_chrome_strings.xml", + "values-sl/android_chrome_strings.xml", + "values-sr/android_chrome_strings.xml", + "values-sv/android_chrome_strings.xml", + "values-sw/android_chrome_strings.xml", + "values-th/android_chrome_strings.xml", + "values-tr/android_chrome_strings.xml", + "values-uk/android_chrome_strings.xml", + "values-vi/android_chrome_strings.xml", + "values-zh-rCN/android_chrome_strings.xml", + "values-zh-rTW/android_chrome_strings.xml", + ] +} + +# GYP: //chrome/chrome.gyp:chrome_java +android_library("chrome_java") { + deps = [ + ":chrome_java_resources", + "//base:base_java", + "//net/android:net_java", + "//components/bookmarks/common/android:bookmarks_java", + "//components/dom_distiller/android:dom_distiller_core_java", + "//components/gcm_driver/android:gcm_driver_java", + "//components/invalidation:java", + "//components/navigation_interception/android:navigation_interception_java", + "//components/variations/android:variations_java", + "//components/web_contents_delegate_android:web_contents_delegate_android_java", + "//content/public/android:content_java", + "//printing:printing_java", + "//sync/android:sync_java", + "//third_party/android_tools:android_support_v13_java", + "//third_party/android_tools:android_support_v7_appcompat_java", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + "//third_party/cacheinvalidation:cacheinvalidation_proto_java", + "//third_party/jsr-305:jsr_305_javalib", + "//ui/android:ui_java", + "//ui/android:ui_java_resources", + ] + + srcjar_deps = [ + ":activity_type_ids_javagen", + ":app_banner_metrics_ids_javagen", + ":profile_account_management_metrics_javagen", + ":profile_sync_service_model_type_selection_javagen", + ":resource_id_javagen", + ":toolbar_model_security_levels_javagen", + ":tab_load_status_javagen", + ":chrome_version_srcjar", + "//chrome:page_info_connection_type_javagen", + ] + + DEPRECATED_java_in_dir = "java/src" +} + +# GYP: //chrome/chrome_browser.gypi:activity_type_ids_java +java_cpp_template("activity_type_ids_javagen") { + sources = [ + "java/ActivityTypeIds.template", + ] + package_name = "org/chromium/chrome/browser" + inputs = [ + "../browser/android/activity_type_id_list.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:app_banner_metrics_ids_java +java_cpp_template("app_banner_metrics_ids_javagen") { + sources = [ + "java/AppBannerMetricsIds.template", + ] + package_name = "org/chromium/chrome/browser/banners" + inputs = [ + "../browser/android/banners/app_banner_metrics_id_list.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:resource_id_java +java_cpp_template("resource_id_javagen") { + sources = [ + "java/ResourceId.template", + ] + package_name = "org/chromium/chrome/browser" + inputs = [ + "../browser/android/resource_id.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java +java_cpp_template("profile_account_management_metrics_javagen") { + sources = [ + "java/ProfileAccountManagementMetrics.template", + ] + package_name = "org/chromium/chrome/browser/profiles" + inputs = [ + "../browser/profiles/profile_metrics_list.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:profile_sync_service_model_type_selection_java +java_cpp_template("profile_sync_service_model_type_selection_javagen") { + sources = [ + "java/ModelTypeSelection.template", + ] + package_name = "org/chromium/chrome/browser/sync" + inputs = [ + "../browser/sync/profile_sync_service_model_type_selection_android.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:toolbar_model_security_levels_java +java_cpp_template("toolbar_model_security_levels_javagen") { + sources = [ + "java/ToolbarModelSecurityLevel.template", + ] + package_name = "org/chromium/chrome/browser/ui/toolbar" + inputs = [ + "../browser/ui/toolbar/toolbar_model_security_level_list.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:tab_load_status_java +java_cpp_template("tab_load_status_javagen") { + sources = [ + "java/TabLoadStatus.template", + ] + package_name = "org/chromium/chrome/browser" + inputs = [ + "../browser/android/tab_load_status.h" + ] +} + +# GYP: //chrome/chrome_shell.gypi:libchromeshell_base +static_library("chrome_shell_base") { + sources = [ + "shell/chrome_shell_google_location_settings_helper.cc", + "shell/chrome_shell_google_location_settings_helper.h", + ] + + deps = [ + "//chrome/browser/ui", + "//chrome:chrome_android_core", + "//base", + "//base/allocator", + "//content/public/app:browser", + "//skia", + ] + + # TODO(GYP): + #[ 'order_profiling!=0', { + #'conditions': [ + #[ 'OS=="android"', { + #'dependencies': [ '../tools/cygprofile/cygprofile.gyp:cygprofile', ], + #}], + #], + #}], +} + +# TODO(GYP, cjhopman): make chrome_shell_base actually link and then move it to +# deps. Also, actually compile the main delegates at that point. +# GYP: //chrome/chrome_browser.gypi:libchromeshell +shared_library("chrome_shell") { + testonly = true + sources = [ + # This file must always be included in the shared_library step to ensure + # JNI_OnLoad is exported. +#"//chrome/app/android/chrome_jni_onload.cc", +#"shell/chrome_main_delegate_chrome_shell_android.cc", +#"shell/chrome_main_delegate_chrome_shell_android.h", + ] + deps = [ +#":chrome_shell_base", + ] + deps = [ ":chrome_java" ] + datadeps = [ + ":chrome_shell_base" + ] +} + +# GYP: //chrome/chrome_browser.gypi:libchromesyncshell +shared_library("chrome_sync_shell") { + testonly = true + sources = [ + # This file must always be included in the shared_library step to ensure + # JNI_OnLoad is exported. +#"//chrome/app/android/chrome_jni_onload.cc", +#"sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc", +#"sync_shell/chrome_main_delegate_chrome_sync_shell_android.h", + ] + deps = [ + "//sync:test_support_sync_fake_server_android", + ] + datadeps = [ + ":chrome_shell_base", + ] +} + +# GYP: N/A +android_resources("chrome_shell_resources") { + deps = [ + ":chrome_java_resources", + ] + testonly = true + resource_dirs = [ "shell/res" ] + custom_package = "org.chromium.chrome.shell" +} + +# GYP: N/A +android_library("chrome_shell_java") { + testonly = true + deps = [ + ":chrome_shell_resources", + ":chrome_java", + "//base:base_java", + "//content/public/android:content_java", + "//components/dom_distiller/android:dom_distiller_core_java", + "//components/web_contents_delegate_android:web_contents_delegate_android_java", + "//printing:printing_java", + "//net/android:net_java", + "//sync/android:sync_java", + "//ui/android:ui_java", + ] + DEPRECATED_java_in_dir = "shell/java/src" +} + +chrome_shell_assets_dir = "$root_build_dir/chrome_shell/assets" + +# GYP: N/A +copy_ex("chrome_shell_assets") { + clear_dir = true + dest = chrome_shell_assets_dir + sources = [ + "$root_build_dir/resources.pak", + "$root_build_dir/chrome_100_percent.pak", + "$root_build_dir/locales/am.pak", + "$root_build_dir/locales/ar.pak", + "$root_build_dir/locales/bg.pak", + "$root_build_dir/locales/ca.pak", + "$root_build_dir/locales/cs.pak", + "$root_build_dir/locales/da.pak", + "$root_build_dir/locales/de.pak", + "$root_build_dir/locales/el.pak", + "$root_build_dir/locales/en-GB.pak", + "$root_build_dir/locales/en-US.pak", + "$root_build_dir/locales/es.pak", + "$root_build_dir/locales/es-419.pak", + "$root_build_dir/locales/fa.pak", + "$root_build_dir/locales/fi.pak", + "$root_build_dir/locales/fil.pak", + "$root_build_dir/locales/fr.pak", + "$root_build_dir/locales/he.pak", + "$root_build_dir/locales/hi.pak", + "$root_build_dir/locales/hr.pak", + "$root_build_dir/locales/hu.pak", + "$root_build_dir/locales/id.pak", + "$root_build_dir/locales/it.pak", + "$root_build_dir/locales/ja.pak", + "$root_build_dir/locales/ko.pak", + "$root_build_dir/locales/lt.pak", + "$root_build_dir/locales/lv.pak", + "$root_build_dir/locales/nb.pak", + "$root_build_dir/locales/nl.pak", + "$root_build_dir/locales/pl.pak", + "$root_build_dir/locales/pt-BR.pak", + "$root_build_dir/locales/pt-PT.pak", + "$root_build_dir/locales/ro.pak", + "$root_build_dir/locales/ru.pak", + "$root_build_dir/locales/sk.pak", + "$root_build_dir/locales/sl.pak", + "$root_build_dir/locales/sr.pak", + "$root_build_dir/locales/sv.pak", + "$root_build_dir/locales/sw.pak", + "$root_build_dir/locales/th.pak", + "$root_build_dir/locales/tr.pak", + "$root_build_dir/locales/uk.pak", + "$root_build_dir/locales/vi.pak", + "$root_build_dir/locales/zh-CN.pak", + "$root_build_dir/locales/zh-TW.pak", + ] + deps = [ + "//chrome:packed_resources", + "//chrome:packed_extra_resources", + ] + + if (icu_use_data_file) { + sources += [ + "$root_build_dir/icudtl.dat" + ] + } +} + +#TODO(GYP): +#'variables': { +#'conditions': [ +#['component != "shared_library" and target_arch != "arm64" and target_arch != "x64" and profiling_full_stack_frames != 1', { +## Only enable the chromium linker on regular builds, since the +## component build crashes on Android 4.4. See b/11379966 +#'use_chromium_linker': '1', +#}], +#], +#}, + +# GYP: //chrome/chrome_browser.gypi:chrome_shell_apk +android_apk("chrome_shell_apk") { + testonly = true + deps = [ + ":chrome_shell_resources", + ":chrome_shell_java", + ":chrome_shell_assets", + ":chrome_shell", + ] + apk_name = "ChromeShell" + android_manifest = "shell/java/AndroidManifest.xml" + native_libs = [ + "$root_build_dir/lib.stripped/libchrome_shell.so" + ] + asset_location = chrome_shell_assets_dir +} + +# GYP: //chrome/chrome_browser.gypi:chrome_sync_shell_apk +android_apk("chrome_sync_shell_apk") { + testonly = true + deps = [ + ":chrome_shell_resources", + ":chrome_shell_java", + ":chrome_shell_assets", + ":chrome_sync_shell", + ] + apk_name = "ChromeSyncShell" + android_manifest = "sync_shell/java/AndroidManifest.xml" + native_libs = [ + "$root_build_dir/lib.stripped/libchrome_sync_shell.so" + ] + asset_location = chrome_shell_assets_dir +} + +# GYP: //chrome/chrome_android.gypi:chrome_version_java +chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java" +chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java" +process_version("chrome_version_java") { + source = "java/ChromeVersionConstants.java.version" + output = chrome_version_java_file +} + +zip("chrome_version_srcjar") { + inputs = [ chrome_version_java_file ] + output = "$target_gen_dir/$target_name.srcjar" + base_dir = chrome_version_java_dir +} diff --git a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java index aa0ece9a8c98..b751a29826dd 100644 --- a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java +++ b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java @@ -306,46 +306,45 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe containerView.requestFocus(); } } - switch (item.getItemId()) { - case R.id.signin: - if (ChromeSigninController.get(this).isSignedIn()) { - SyncController.openSignOutDialog(getFragmentManager()); - } else if (AccountManagerHelper.get(this).hasGoogleAccounts()) { - SyncController.openSigninDialog(getFragmentManager()); - } else { - Toast.makeText(this, R.string.signin_no_account, Toast.LENGTH_SHORT).show(); - } - return true; - case R.id.print: - if (activeTab != null) { - mPrintingController.startPrint(new TabPrinter(activeTab), - new PrintManagerDelegateImpl(this)); - } - return true; - case R.id.distill_page: - if (activeTab != null) { - DomDistillerTabUtils.distillCurrentPageAndView( - activeTab.getContentViewCore().getWebContents()); - } - return true; - case R.id.back_menu_id: - if (activeTab != null && activeTab.canGoBack()) { - activeTab.goBack(); - } - return true; - case R.id.forward_menu_id: - if (activeTab != null && activeTab.canGoForward()) { - activeTab.goForward(); - } - return true; - case R.id.share_menu_id: - case R.id.direct_share_menu_id: - ShareHelper.share(item.getItemId() == R.id.direct_share_menu_id, this, - activeTab.getTitle(), activeTab.getUrl(), null, - Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); - return true; - default: - return super.onOptionsItemSelected(item); + int id = item.getItemId(); + if (id == R.id.signin) { + if (ChromeSigninController.get(this).isSignedIn()) { + SyncController.openSignOutDialog(getFragmentManager()); + } else if (AccountManagerHelper.get(this).hasGoogleAccounts()) { + SyncController.openSigninDialog(getFragmentManager()); + } else { + Toast.makeText(this, R.string.signin_no_account, Toast.LENGTH_SHORT).show(); + } + return true; + } else if (id == R.id.print) { + if (activeTab != null) { + mPrintingController.startPrint(new TabPrinter(activeTab), + new PrintManagerDelegateImpl(this)); + } + return true; + } else if (id == R.id.distill_page) { + if (activeTab != null) { + DomDistillerTabUtils.distillCurrentPageAndView( + activeTab.getContentViewCore().getWebContents()); + } + return true; + } else if (id == R.id.back_menu_id) { + if (activeTab != null && activeTab.canGoBack()) { + activeTab.goBack(); + } + return true; + } else if (id == R.id.forward_menu_id) { + if (activeTab != null && activeTab.canGoForward()) { + activeTab.goForward(); + } + return true; + } else if (id == R.id.share_menu_id || id == R.id.direct_share_menu_id) { + ShareHelper.share(item.getItemId() == R.id.direct_share_menu_id, this, + activeTab.getTitle(), activeTab.getUrl(), null, + Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); + return true; + } else { + return super.onOptionsItemSelected(item); } } diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index bac985e14bb1..5c27fc52f0a3 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn @@ -440,11 +440,16 @@ source_set("test_support") { "pdf/pdf_browsertest_base.h", "test/test_confirm_bubble_model.cc", "test/test_confirm_bubble_model.h", - "views/find_bar_host_unittest_util_views.cc", "website_settings/mock_permission_bubble_request.cc", "website_settings/mock_permission_bubble_request.h", ] + if (toolkit_views) { + sources += [ + "views/find_bar_host_unittest_util_views.cc", + ] + } + public_deps = [ ":ui", ] diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 3a2af9f5e353..2b6197b43213 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -577,6 +577,7 @@ { 'targets': [ { + # GN: //chrome/android:chrome_java 'target_name': 'chrome_java', 'type': 'none', 'dependencies': [ @@ -597,7 +598,6 @@ '../components/components.gyp:gcm_driver_java', '../components/components.gyp:invalidation_java', '../components/components.gyp:navigation_interception_java', - '../components/components.gyp:sessions', '../components/components.gyp:variations_java', '../components/components.gyp:web_contents_delegate_android_java', '../content/content.gyp:content_java', @@ -621,6 +621,7 @@ ], }, { + # GN: //chrome/android:chrome_strings_grd 'target_name': 'chrome_strings_grd', 'type': 'none', 'variables': { @@ -631,6 +632,7 @@ ], }, { + # GN: //chrome:page_info_connection_type_javagen 'target_name': 'page_info_connection_type_java', 'type': 'none', 'variables': { diff --git a/chrome/chrome_android.gypi b/chrome/chrome_android.gypi index f494b399bf2f..125ae1a12599 100644 --- a/chrome/chrome_android.gypi +++ b/chrome/chrome_android.gypi @@ -18,6 +18,7 @@ ], 'targets': [ { + # GN: //chrome:chrome_android_core 'target_name': 'chrome_android_core', 'type': 'static_library', 'dependencies': [ @@ -52,6 +53,7 @@ }, }, { + # GYP: //chrome/android:chrome_version_java 'target_name': 'chrome_version_java', 'type': 'none', 'variables': { diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 0274a792578e..9b4f0fc131cb 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3493,6 +3493,7 @@ ['OS=="android"', { 'targets': [ { + # GN: //chrome/browser:jni_headers 'target_name': 'chrome_browser_jni_headers', 'type': 'none', 'sources': [ '<@(chrome_browser_jni_sources)' ], @@ -3502,6 +3503,7 @@ 'includes': [ '../build/jni_generator.gypi' ], }, { + # GN: //chrome/android:activity_type_ids_javagen 'target_name': 'activity_type_ids_java', 'type': 'none', 'sources': [ @@ -3514,6 +3516,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android:app_banner_metrics_ids_javagen 'target_name': 'app_banner_metrics_ids_java', 'type': 'none', 'sources': [ @@ -3526,6 +3529,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android:resource_id_javagen 'target_name': 'resource_id_java', 'type': 'none', 'sources': [ @@ -3538,6 +3542,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android/profile_account_management_metrics_javagen 'target_name': 'profile_account_management_metrics_java', 'type': 'none', 'sources': [ @@ -3550,6 +3555,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android:profile_sync_service_model_type_selection_javagen 'target_name': 'profile_sync_service_model_type_selection_java', 'type': 'none', 'sources': [ @@ -3562,6 +3568,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android:toolbar_model_security_levels_javagen 'target_name': 'toolbar_model_security_levels_java', 'type': 'none', 'sources': [ @@ -3574,6 +3581,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android:tab_load_status_javagen 'target_name': 'tab_load_status_java', 'type': 'none', 'sources': [ diff --git a/chrome/chrome_shell.gypi b/chrome/chrome_shell.gypi index 81b99ccace6b..20a7aae4fac1 100644 --- a/chrome/chrome_shell.gypi +++ b/chrome/chrome_shell.gypi @@ -12,6 +12,7 @@ }, 'targets': [ { + # GN: //chrome/android:chrome_shell_base 'target_name': 'libchromeshell_base', 'type': 'static_library', 'dependencies': [ @@ -51,6 +52,7 @@ ], }, { + # GN: //chrome/android:chrome_shell 'target_name': 'libchromeshell', 'type': 'shared_library', 'sources': [ @@ -65,6 +67,7 @@ ], }, { + # GN: //chrome/android:chrome_sync_shell 'target_name': 'libchromesyncshell', 'type': 'shared_library', 'sources': [ @@ -80,6 +83,7 @@ ], }, { + # GN: //chrome/android:chrome_shell_apk 'target_name': 'chrome_shell_apk', 'type': 'none', 'dependencies': [ @@ -102,6 +106,7 @@ 'includes': [ '../build/java_apk.gypi', ], }, { + # GN: N/A # chrome_shell_apk creates a .jar as a side effect. Any java targets # that need that .jar in their classpath should depend on this target, # chrome_shell_apk_java. Dependents of chrome_shell_apk receive its @@ -132,6 +137,7 @@ ], }, { + # GN: //chrome/android:chrome_sync_shell_apk 'target_name': 'chrome_sync_shell_apk', 'type': 'none', 'dependencies': [ @@ -157,6 +163,7 @@ 'includes': [ '../build/java_apk.gypi', ], }, { + # GN: N/A # chrome_sync_shell_apk creates a .jar as a side effect. Any java # targets that need that .jar in their classpath should depend on this # target. Dependents of chrome_sync_shell_apk receive its jar path in the diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index 082f3c1e355f..d295f52f8b49 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn @@ -62,6 +62,8 @@ static_library("common") { "//components/variations", "//content/public/common", "//crypto", + "//extensions:extensions_resources", + "//extensions/strings", "//media/cast:net", "//net", "//skia", @@ -104,8 +106,6 @@ static_library("common") { "//chrome/common/extensions/api", "//extensions/common", "//extensions/common/api", - "//extensions/strings", - "//extensions:extensions_resources", ] } @@ -173,7 +173,6 @@ static_library("common") { sources -= [ "badge_util.cc", "chrome_version_info_posix.cc", - "extensions/manifest_handlers/minimum_chrome_version_checker.cc", "icon_with_badge_image_source.cc", "media_galleries/metadata_types.h", "spellcheck_common.cc", diff --git a/components/bookmarks.gypi b/components/bookmarks.gypi index 6c96a22b0b6b..ffdfd1bcef73 100644 --- a/components/bookmarks.gypi +++ b/components/bookmarks.gypi @@ -125,6 +125,7 @@ ['OS=="android"', { 'targets': [ { + # GN: //components/common/android:bookmarks_java 'target_name': 'bookmarks_java', 'type': 'none', 'dependencies': [ @@ -137,6 +138,7 @@ 'includes': [ '../build/java.gypi' ], }, { + # GN: //components/common/android:bookmarks_jni_headers 'target_name': 'bookmarks_jni_headers', 'type': 'none', 'sources': [ @@ -148,6 +150,7 @@ 'includes': [ '../build/jni_generator.gypi' ], }, { + # GN: //components/common/android:bookmarks_type_javagen 'target_name': 'bookmark_type_java', 'type': 'none', 'sources': [ diff --git a/components/bookmarks/common/android/BUILD.gn b/components/bookmarks/common/android/BUILD.gn new file mode 100644 index 000000000000..aa628827861d --- /dev/null +++ b/components/bookmarks/common/android/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +# GYP: //components/bookmarks.gyp:bookmarks_java +android_library("bookmarks_java") { + deps = [ + "//base:base_java", + ] + srcjar_deps = [ + ":bookmark_type_javagen", + ] + DEPRECATED_java_in_dir = "java/src" +} + +# GYP: //components/bookmarks.gyp:bookmarks_jni_headers +generate_jni("bookmarks_jni_headers") { + jni_package = "components/bookmarks" + sources = [ + "java/src/org/chromium/components/bookmarks/BookmarkId.java" + ] +} + +# GYP: //components/bookmarks.gyp:bookmarks_type_java +java_cpp_template("bookmark_type_javagen") { + sources = [ + "java/src/org/chromium/components/bookmarks/BookmarkType.template", + ] + package_name = "org/chromium/components/bookmarks" + inputs = [ + "bookmark_type_list.h", + ] +} diff --git a/components/dom_distiller.gypi b/components/dom_distiller.gypi index 3cab978a24e1..b720fab5bb53 100644 --- a/components/dom_distiller.gypi +++ b/components/dom_distiller.gypi @@ -175,6 +175,7 @@ ['OS=="android"', { 'targets': [ { + # GN: //components/dom_distiller/android:dom_distiller_core_java 'target_name': 'dom_distiller_core_java', 'type': 'none', 'dependencies': [ @@ -188,6 +189,7 @@ 'includes': [ '../build/java.gypi' ], }, { + # GN: //components/dom_distiller/android:dom_distiller_core_font_family_javagen 'target_name': 'dom_distiller_core_font_family_java', 'type': 'none', 'sources': [ @@ -200,6 +202,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //components/dom_distiller/core:jni_headers 'target_name': 'dom_distiller_core_jni_headers', 'type': 'none', 'sources': [ @@ -213,6 +216,7 @@ 'includes': [ '../build/jni_generator.gypi' ], }, { + # GN: //components/dom_distiller/android:dom_distiller_core_theme_javagen 'target_name': 'dom_distiller_core_theme_java', 'type': 'none', 'sources': [ diff --git a/components/dom_distiller/android/BUILD.gn b/components/dom_distiller/android/BUILD.gn new file mode 100644 index 000000000000..02490165ecda --- /dev/null +++ b/components/dom_distiller/android/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + + +# GYP: //components/dom_distiller.gypi:dom_distiller_core_java +android_library("dom_distiller_core_java") { + deps = [ + "//base:base_java", + ] + + srcjar_deps = [ + ":dom_distiller_core_font_family_javagen", + ":dom_distiller_core_theme_javagen", + ] + + DEPRECATED_java_in_dir = "java/src" +} + +# GYP: //components/dom_distiller.gypi:dom_distiller_core_font_family_java +java_cpp_template("dom_distiller_core_font_family_javagen") { + package_name = "org/chromium/components/dom_distiller/core" + sources = [ + "java/src/org/chromium/components/dom_distiller/core/FontFamily.template" + ] + inputs = [ + "../core/font_family_list.h" + ] +} + +# GYP: //components/dom_distiller.gypi:dom_distiller_core_font_family_java +java_cpp_template("dom_distiller_core_theme_javagen") { + package_name = "org/chromium/components/dom_distiller/core" + sources = [ + "java/src/org/chromium/components/dom_distiller/core/Theme.template" + ] + inputs = [ + "../core/theme_list.h" + ] +} diff --git a/components/enhanced_bookmarks.gypi b/components/enhanced_bookmarks.gypi index 71b815a63cee..ee0a8d4ba4a9 100644 --- a/components/enhanced_bookmarks.gypi +++ b/components/enhanced_bookmarks.gypi @@ -5,6 +5,7 @@ { 'targets': [ { + # GN: //components/enhanced_bookmarks:enhanced_bookmarks 'target_name': 'enhanced_bookmarks', 'type': 'static_library', 'include_dirs': [ @@ -59,6 +60,7 @@ ], }, { + # GN: //components/enhanced_bookmarks:enhanced_bookmarks_test_support 'target_name': 'enhanced_bookmarks_test_support', 'type': 'static_library', 'include_dirs': [ diff --git a/components/enhanced_bookmarks/BUILD.gn b/components/enhanced_bookmarks/BUILD.gn index 736ac97e731d..6a8e132256ff 100644 --- a/components/enhanced_bookmarks/BUILD.gn +++ b/components/enhanced_bookmarks/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# GYP: //components/enhanced_bookmarks.gypi:enhanced_bookmarks source_set("enhanced_bookmarks") { sources = [ "bookmark_image_service.cc", @@ -48,6 +49,7 @@ source_set("enhanced_bookmarks") { } } +# GYP: //components/enhanced_bookmarks.gypi:enhanced_bookmarks_test_support source_set("test_support") { testonly = true sources = [ diff --git a/components/gcm_driver.gypi b/components/gcm_driver.gypi index 959154708668..a908e41267af 100644 --- a/components/gcm_driver.gypi +++ b/components/gcm_driver.gypi @@ -135,6 +135,7 @@ ['OS == "android"', { 'targets': [ { + # GN version: //components/gcm_driver/android:gcm_driver_java 'target_name': 'gcm_driver_java', 'type': 'none', 'dependencies': [ @@ -149,7 +150,7 @@ 'includes': [ '../build/java.gypi' ], }, { - # GN version: //components/gcm_driver:jni_headers + # GN version: //components/gcm_driver/android:jni_headers 'target_name': 'gcm_driver_jni_headers', 'type': 'none', 'sources': [ diff --git a/components/gcm_driver/BUILD.gn b/components/gcm_driver/BUILD.gn index 95b059626905..51360df5fe7b 100644 --- a/components/gcm_driver/BUILD.gn +++ b/components/gcm_driver/BUILD.gn @@ -71,10 +71,9 @@ static_library("gcm_driver") { "gcm_stats_recorder_impl.h", ] deps -= [ - "//components/gcm_driver/proto", "//google_apis/gcm", ] - deps += [ ":jni_headers" ] + deps += [ "android:jni_headers" ] } } @@ -108,15 +107,3 @@ static_library("test_support") { deps -= [ "//google_apis/gcm" ] } } - -if (is_android) { - import("//build/config/android/rules.gni") - - # GYP version: components/gcm_driver.gypi:gcm_driver_jni_headers - generate_jni("jni_headers") { - sources = [ - "android/java/src/org/chromium/components/gcm_driver/GCMDriver.java", - ] - jni_package = "components/gcm_driver" - } -} diff --git a/components/gcm_driver/android/BUILD.gn b/components/gcm_driver/android/BUILD.gn new file mode 100644 index 000000000000..70e99a936c34 --- /dev/null +++ b/components/gcm_driver/android/BUILD.gn @@ -0,0 +1,26 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +# GYP version: components/gcm_driver.gypi:gcm_driver_jni_headers +generate_jni("jni_headers") { + sources = [ + "java/src/org/chromium/components/gcm_driver/GCMDriver.java", + ] + jni_package = "components/gcm_driver" +} + +# GYP version: components/gcm_driver.gypi:gcm_driver_java +android_library("gcm_driver_java") { + deps = [ + "//base:base_java", + "//content/public/android:content_java", + "//sync/android:sync_java", + "//third_party/android_tools:android_gcm_java", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + ] + + DEPRECATED_java_in_dir = "java/src" +} diff --git a/components/invalidation/BUILD.gn b/components/invalidation/BUILD.gn index b39fe28fa3b5..cf9a294153bb 100644 --- a/components/invalidation/BUILD.gn +++ b/components/invalidation/BUILD.gn @@ -78,15 +78,6 @@ static_library("invalidation") { "ticl_settings_provider.h", ] } - if (is_android) { - sources += [ - "android/component_jni_registrar.cc", - "android/component_jni_registrar.h", - "invalidation_service_android.cc", - "invalidation_service_android.h", - ] - deps += [ ":jni_headers" ] - } public_deps = [ "//third_party/cacheinvalidation", @@ -104,6 +95,16 @@ static_library("invalidation") { "//third_party/protobuf:protobuf_lite", # "//third_party/cacheinvalidation/src/google/cacheinvalidation:cacheinvalidation_proto_cpp", ] + + if (is_android) { + sources += [ + "android/component_jni_registrar.cc", + "android/component_jni_registrar.h", + "invalidation_service_android.cc", + "invalidation_service_android.h", + ] + deps += [ ":jni_headers" ] + } } static_library("unittests") { @@ -141,17 +142,7 @@ static_library("test_support") { "unacked_invalidation_set_test_util.cc", "unacked_invalidation_set_test_util.h", ] - if (!is_android) { - sources += [ - "p2p_invalidation_service.cc", - "p2p_invalidation_service.h", - ] - } - if (is_android) { - deps += [ - ":jni_headers", - ] - } + deps = [ "//base", "//components/gcm_driver:test_support", @@ -167,23 +158,40 @@ static_library("test_support") { "//third_party/protobuf:protobuf_lite", # "//third_party/cacheinvalidation/src/google/cacheinvalidation:cacheinvalidation_proto_cpp", ] + + if (is_android) { + deps += [ + ":jni_headers", + ] + } else { + sources += [ + "p2p_invalidation_service.cc", + "p2p_invalidation_service.h", + ] + } } if (is_android) { - static_library("java") { + android_library("java") { deps = [ - "//base", - "//sync:java", - "//third_party/cacheinvalidation:javalib", - ] - sources = [ + "//base:base_java", + "//sync/android:sync_java", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + "//third_party/cacheinvalidation:cacheinvalidation_proto_java", + "//third_party/jsr-305:jsr_305_javalib", ] + DEPRECATED_java_in_dir = "android/java/src" } - static_library("javatests") { + android_library("javatests") { deps = [ ":java", - "//base:java_test_support", + "//base:base_java", + "//base:base_java_test_support", + "//sync/android:sync_java", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + "//third_party/cacheinvalidation:cacheinvalidation_proto_java", ] + DEPRECATED_java_in_dir = "android/javatests/src" } generate_jni("jni_headers") { sources = [ diff --git a/components/navigation_interception.gypi b/components/navigation_interception.gypi index c2e4f76f8b14..92434529ee3e 100644 --- a/components/navigation_interception.gypi +++ b/components/navigation_interception.gypi @@ -50,6 +50,7 @@ ['OS=="android"', { 'targets': [ { + # GN version: //components/navigation_intercaption/android:navigation_interception_java 'target_name': 'navigation_interception_java', 'type': 'none', 'dependencies': [ diff --git a/components/navigation_interception/BUILD.gn b/components/navigation_interception/BUILD.gn index 95103e6b5be3..07c664060928 100644 --- a/components/navigation_interception/BUILD.gn +++ b/components/navigation_interception/BUILD.gn @@ -37,8 +37,7 @@ static_library("navigation_interception") { if (is_android) { - # TODO(GYP): navigation_interception_java target - + # GYP: //components/navigation_interception.gypi:navigation_interception_jni_headers generate_jni("jni_headers") { sources = [ "android/java/src/org/chromium/components/navigation_interception/InterceptNavigationDelegate.java", diff --git a/components/navigation_interception/android/BUILD.gn b/components/navigation_interception/android/BUILD.gn new file mode 100644 index 000000000000..b13a847e9b49 --- /dev/null +++ b/components/navigation_interception/android/BUILD.gn @@ -0,0 +1,12 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +android_library("navigation_interception_java") { + deps = [ + "//base:base_java", + ] + DEPRECATED_java_in_dir = "java/src" +} diff --git a/components/variations.gypi b/components/variations.gypi index 55b8a72da48b..a3fc300c8565 100644 --- a/components/variations.gypi +++ b/components/variations.gypi @@ -83,6 +83,7 @@ ['OS=="android"', { 'targets': [ { + # GN version: //components/variations/android:variations_java 'target_name': 'variations_java', 'type': 'none', 'dependencies': [ @@ -94,7 +95,7 @@ 'includes': [ '../build/java.gypi' ], }, { - # GN version: //components/variations:variations_java + # GN version: //components/variations:jni 'target_name': 'variations_jni_headers', 'type': 'none', 'sources': [ diff --git a/components/variations/BUILD.gn b/components/variations/BUILD.gn index da9ef09ab675..07b17e7890f4 100644 --- a/components/variations/BUILD.gn +++ b/components/variations/BUILD.gn @@ -52,6 +52,7 @@ static_library("variations") { } if (is_android) { + # GYP: //components/variations.gypi:variations_jni_headers generate_jni("jni") { sources = [ "android/java/src/org/chromium/components/variations/VariationsAssociatedData.java", diff --git a/components/variations/android/BUILD.gn b/components/variations/android/BUILD.gn new file mode 100644 index 000000000000..3fe1d683d7e7 --- /dev/null +++ b/components/variations/android/BUILD.gn @@ -0,0 +1,14 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + + +# GYP: //components/variations.gypi:variations_java +android_library("variations_java") { + deps = [ + "//base:base_java" + ] + DEPRECATED_java_in_dir = "java/src" +} diff --git a/components/web_contents_delegate_android.gypi b/components/web_contents_delegate_android.gypi index fdea3b76ee2e..fb9291268228 100644 --- a/components/web_contents_delegate_android.gypi +++ b/components/web_contents_delegate_android.gypi @@ -8,6 +8,7 @@ ['OS=="android"', { 'targets': [ { + # GN: //components/web_contents_delegate_android:web_contents_delegate_android 'target_name': 'web_contents_delegate_android', 'type': 'static_library', 'dependencies': [ @@ -37,6 +38,7 @@ ], }, { + # GN: //components/web_contents_delegate_android:web_contents_delegate_android_java 'target_name': 'web_contents_delegate_android_java', 'type': 'none', 'dependencies': [ @@ -49,6 +51,7 @@ 'includes': [ '../build/java.gypi' ], }, { + # GN: //components/web_contents_delegate_android:web_contents_delegate_android_jni_headers 'target_name': 'web_contents_delegate_android_jni_headers', 'type': 'none', 'sources': [ diff --git a/components/web_contents_delegate_android/BUILD.gn b/components/web_contents_delegate_android/BUILD.gn new file mode 100644 index 000000000000..541df1a81ca4 --- /dev/null +++ b/components/web_contents_delegate_android/BUILD.gn @@ -0,0 +1,52 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +# GYP: //components/web_contents_delegate_android:web_contents_delegate_android +static_library("web_contents_delegate_android") { + sources = [ + "color_chooser_android.cc", + "color_chooser_android.h", + "component_jni_registrar.cc", + "component_jni_registrar.h", + "validation_message_bubble_android.cc", + "validation_message_bubble_android.h", + "web_contents_delegate_android.cc", + "web_contents_delegate_android.h", + ] + + deps = [ + ":web_contents_delegate_android_jni_headers", + "//base", + "//content/public/browser", + "//content/public/common", + "//net", + "//skia", + "//ui/base", + "//ui/gfx", + "//ui/gfx/geometry", + ] +} + +# GYP: //components/web_contents_delegate_android:web_contents_delegate_android_java +android_library("web_contents_delegate_android_java") { + deps = [ + "//base:base_java", + "//ui/android:ui_java", + "//content/public/android:content_java", + "//content/public/android:content_java_resources", + ] + DEPRECATED_java_in_dir = "android/java/src" +} + +# GYP: //components/web_contents_delegate_android:web_contents_delegate_android_jni_headers +generate_jni("web_contents_delegate_android_jni_headers") { + sources = [ + "android/java/src/org/chromium/components/web_contents_delegate_android/ColorChooserAndroid.java", + "android/java/src/org/chromium/components/web_contents_delegate_android/ValidationMessageBubble.java", + "android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java", + ] + jni_package = "web_contents_delegate_android" +} diff --git a/content/public/test/android/BUILD.gn b/content/public/test/android/BUILD.gn index 01167c8400c6..c51441f8b2f5 100644 --- a/content/public/test/android/BUILD.gn +++ b/content/public/test/android/BUILD.gn @@ -16,5 +16,5 @@ android_library("content_java_test_support") { "//base:base_java_test_support", "//content/public/android:content_java", ] - DEPRECATED_java_in_dir = "javatests" + DEPRECATED_java_in_dir = "javatests/src" } diff --git a/device/usb/BUILD.gn b/device/usb/BUILD.gn index 385bcb961d5d..e12e74568fb3 100644 --- a/device/usb/BUILD.gn +++ b/device/usb/BUILD.gn @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +assert(!is_android && !is_ios) + source_ids = "//third_party/usb_ids/usb.ids" generated_ids = "$target_gen_dir/usb_ids_gen.cc" diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn index a6b9d09b31a5..f0026dc17699 100644 --- a/extensions/BUILD.gn +++ b/extensions/BUILD.gn @@ -47,13 +47,16 @@ grit("extensions_renderer_resources") { "extensions_renderer_resources.pak", ] grit_flags = [ "-E", "mojom_root=" + rebase_path(root_gen_dir) ] - if (enable_extensions) { - deps = [ - "//device/serial:serial_mojo", - ] - } + + # TODO(GYP,cjhopman): GYP has this dependency guarded by enable_extensions==1, + # but I don't know how that possibly works. + deps = [ + "//device/serial:serial_mojo", + ] } +if (enable_extensions) { + source_set("test_support") { testonly = true sources = [ @@ -264,3 +267,5 @@ test("extensions_unittests") { } } } + +} diff --git a/printing/BUILD.gn b/printing/BUILD.gn index a1ef97df0620..995fbaf19523 100644 --- a/printing/BUILD.gn +++ b/printing/BUILD.gn @@ -232,6 +232,7 @@ if (use_cups) { } if (is_android) { + # GYP: //printing/printing.gyp:printing_jni_headers generate_jni("printing_jni_headers") { sources = [ "android/java/src/org/chromium/printing/PrintingContext.java", @@ -239,16 +240,11 @@ if (is_android) { jni_package = "printing" } - # TODO(GYP) - #{ - # 'target_name': 'printing_java', - # 'type': 'none', - # 'variables': { - # 'java_in_dir': '../printing/android/java', - # }, - # 'dependencies': [ - # '../base/base.gyp:base_java', - # ], - # 'includes': [ '../build/java.gypi' ], - #} + # GYP: //printing/printing.gyp:printing_java + android_library("printing_java") { + deps = [ + "//base:base_java" + ] + DEPRECATED_java_in_dir = "android/java/src" + } } diff --git a/printing/printing.gyp b/printing/printing.gyp index 48e289adaedc..31c0f1dea30f 100644 --- a/printing/printing.gyp +++ b/printing/printing.gyp @@ -292,6 +292,7 @@ ['OS == "android"', { 'targets': [ { + # GN: //printing:printing_jni_headers 'target_name': 'printing_jni_headers', 'type': 'none', 'sources': [ @@ -302,8 +303,9 @@ }, 'includes': [ '../build/jni_generator.gypi' ], }, - { - 'target_name': 'printing_java', + { + # GN: //printing:printing_java + 'target_name': 'printing_java', 'type': 'none', 'variables': { 'java_in_dir': '../printing/android/java', @@ -312,7 +314,7 @@ '../base/base.gyp:base_java', ], 'includes': [ '../build/java.gypi' ], - } + } ] }], ] diff --git a/sync/BUILD.gn b/sync/BUILD.gn index 9b187cff1dba..2ba15cb0805d 100644 --- a/sync/BUILD.gn +++ b/sync/BUILD.gn @@ -694,6 +694,8 @@ static_library("test_support_sync_fake_server") { "//sync", ] + forward_dependent_configs_from = [ "//third_party/protobuf:protobuf_lite" ] + configs += [ "//build/config/compiler:wexit_time_destructors" ] } @@ -764,4 +766,49 @@ if (!is_ios) { } } -#TODO(GYP): Need to port sync_android.gypi and Android test targets. +if (is_android) { + import("//build/config/android/rules.gni") + + # GYP: //sync/sync_tests.gypi:fake_server_jni + generate_jni("fake_server_jni") { + testonly = true + jni_package = "sync/test/fake_server" + sources = [ + "//chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/FakeServerHelper.java" + ] + } + + # GYP: //sync/sync_tests.gypi:sync_java_test_support + android_library("sync_java_test_support") { + testonly = true + deps = [ + "android:sync_java", + "//base:base_java", + "//base:base_java_test_support", + "//third_party/jsr-305:jsr_305_javalib", + ] + DEPRECATED_java_in_dir = "test/android/javatests/src" + } + + # GYP: //sync/sync_tests.gypi:test_support_sync_fake_server_android + static_library("test_support_sync_fake_server_android") { + testonly = true + sources = [ + "test/fake_server/android/fake_server_helper_android.cc", + "test/fake_server/android/fake_server_helper_android.h", + ] + deps = [ + ":fake_server_jni", + ":test_support_sync_fake_server", + "//base", + ] + } + + # GYP: //sync/sync_tests.gypi:sync_unit_tests_apk + unittest_apk("sync_unit_tests_apk") { + unittests_dep = ":sync_unit_tests" + deps = [ + ":sync_unit_tests", + ] + } +} diff --git a/sync/android/BUILD.gn b/sync/android/BUILD.gn new file mode 100644 index 000000000000..fb9dde2ab5eb --- /dev/null +++ b/sync/android/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +android_library("sync_java") { + deps = [ + "//base:base_java", + "//net/android:net_java", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + "//third_party/cacheinvalidation:cacheinvalidation_proto_java", + "//third_party/jsr-305:jsr_305_javalib", + "//third_party/android_tools:android_gcm_java", + ] + DEPRECATED_java_in_dir = "java/src" +} + +android_library("sync_javatests") { + testonly = true + deps = [ + ":sync_java", + "//base:base_java", + "//base:base_java_test_support", + "//sync:sync_java_test_support", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + "//third_party/cacheinvalidation:cacheinvalidation_proto_java", + "//third_party/jsr-305:jsr_305_javalib", + ] + DEPRECATED_java_in_dir = "javatests/src" +} diff --git a/sync/sync_android.gypi b/sync/sync_android.gypi index e707f0ff599c..51374672b47a 100644 --- a/sync/sync_android.gypi +++ b/sync/sync_android.gypi @@ -7,6 +7,7 @@ ['OS == "android"', { 'targets': [ { + # GN: //sync/android:sync_java 'target_name': 'sync_java', 'type': 'none', 'variables': { diff --git a/sync/sync_tests.gypi b/sync/sync_tests.gypi index 6e3c03aa8091..739a90ebc933 100644 --- a/sync/sync_tests.gypi +++ b/sync/sync_tests.gypi @@ -426,6 +426,7 @@ ['OS == "android"', { 'targets': [ { + # GN: //sync/android:sync_javatests 'target_name': 'sync_javatests', 'type': 'none', 'variables': { @@ -439,6 +440,7 @@ 'includes': [ '../build/java.gypi' ], }, { + # GN: //sync:sync_java_test_support 'target_name': 'sync_java_test_support', 'type': 'none', 'variables': { @@ -450,6 +452,7 @@ 'includes': [ '../build/java.gypi' ], }, { + # GN: //sync:sync_fake_server_jni_headers 'target_name': 'sync_fake_server_jni_headers', 'type': 'none', 'sources': [ @@ -462,6 +465,7 @@ 'includes': [ '../build/jni_generator.gypi' ], }, { + # GN: //sync:test_support_sync_fake_server_android 'target_name': 'test_support_sync_fake_server_android', 'type': 'static_library', 'dependencies': [ @@ -474,11 +478,8 @@ 'test/fake_server/android/fake_server_helper_android.h', ], }, - ], - }], - ['OS == "android"', { - 'targets': [ { + # GN: //sync:sync_unit_tests_apk 'target_name': 'sync_unit_tests_apk', 'type': 'none', 'dependencies': [ diff --git a/third_party/libusb/BUILD.gn b/third_party/libusb/BUILD.gn index 891a2f646583..e2b96e3bc1c9 100644 --- a/third_party/libusb/BUILD.gn +++ b/third_party/libusb/BUILD.gn @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +assert(!is_android && !is_ios) + config("libusb_config") { include_dirs = [ "src/libusb", -- 2.11.4.GIT