diff options
author | pkotwicz <pkotwicz@chromium.org> | 2015-11-24 19:52:20 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-25 03:53:06 +0000 |
commit | 9ae3420e37bfb6c2878b0d036db01af0d16af067 (patch) | |
tree | a946f75b919a3575f72c0ac4a1582aba4787dd4a | |
parent | b81447781b75fcab4338168b292f01d4c9543892 (diff) | |
download | chromium_src-9ae3420e37bfb6c2878b0d036db01af0d16af067.zip chromium_src-9ae3420e37bfb6c2878b0d036db01af0d16af067.tar.gz chromium_src-9ae3420e37bfb6c2878b0d036db01af0d16af067.tar.bz2 |
Port ChromeSyncShell build rules to GN
BUG=475612
R=agrieve, newt, pvalenzuela, zea
TBR=brettw for .gn whitelisting usage fo gypi_to_gn in protocol_sources.gni
Review URL: https://codereview.chromium.org/1458353002
Cr-Commit-Position: refs/heads/master@{#361561}
-rw-r--r-- | .gn | 1 | ||||
-rw-r--r-- | build/config/android/rules.gni | 5 | ||||
-rw-r--r-- | chrome/android/BUILD.gn | 178 | ||||
-rw-r--r-- | chrome/android/chrome_apk.gyp | 45 | ||||
-rw-r--r-- | sync/BUILD.gn | 25 | ||||
-rw-r--r-- | sync/protocol/BUILD.gn | 45 | ||||
-rw-r--r-- | sync/protocol/protocol.gypi | 3 | ||||
-rw-r--r-- | sync/protocol/protocol_sources.gni | 14 | ||||
-rw-r--r-- | sync/sync_tests.gypi | 3 |
9 files changed, 214 insertions, 105 deletions
@@ -318,6 +318,7 @@ exec_script_whitelist = [ "//remoting/remoting_srcs.gni", "//remoting/remoting_version.gni", "//skia/BUILD.gn", + "//sync/protocol/protocol_sources.gni", "//third_party/android_platform/BUILD.gn", "//third_party/angle/BUILD.gn", "//third_party/angle/src/tests/BUILD.gn", diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index f3f5e27..824a44f 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni @@ -2168,9 +2168,14 @@ template("proto_java_library") { action("${_template_name}__protoc_java") { srcjar_path = "$target_gen_dir/$target_name.srcjar" script = "//build/protoc_java.py" + deps = [ _protoc_dep, ] + if (defined(invoker.deps)) { + deps += invoker.deps + } + sources = invoker.sources depfile = "$target_gen_dir/$target_name.d" outputs = [ diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 9cef154..5834ad6 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn @@ -19,12 +19,23 @@ if (enable_configuration_policy) { configuration_policy = 0 } -jinja_variables = [ +chrome_public_jinja_variables = [ "channel=$android_channel", "manifest_package=$manifest_package", "configuration_policy=$configuration_policy", ] +chrome_sync_shell_jinja_variables = [ + "channel=$android_channel", + "manifest_package=org.chromium.chrome.sync_shell", + "configuration_policy=$configuration_policy", +] + +chrome_apk_gypi = exec_script("//build/gypi_to_gn.py", + [ rebase_path("chrome_apk.gyp") ], + "scope", + [ "chrome_apk.gyp" ]) + chrome_android_paks_gypi = exec_script("//build/gypi_to_gn.py", [ @@ -364,21 +375,42 @@ android_assets("chrome_public_apk_assets") { jinja_template("chrome_public_apk_manifest") { input = "java/AndroidManifest.xml" output = "$root_gen_dir/chrome_public_apk_manifest/AndroidManifest.xml" - variables = jinja_variables + variables = chrome_public_jinja_variables variables += [ "min_sdk_version=16", "target_sdk_version=23", ] } -# GYP: //chrome/android/chrome_apk.gyp:chrome_public_template_resources -jinja_template_resources("chrome_public_template_resources") { +# GYP: //chrome/android/chrome_apk.gyp:chrome_sync_shell_apk_manifest +jinja_template("chrome_sync_shell_apk_manifest") { + input = "java/AndroidManifest.xml" + output = "$root_gen_dir/chrome_sync_shell_apk_manifest/AndroidManifest.xml" + variables = chrome_sync_shell_jinja_variables + variables += [ + "min_sdk_version=16", + "target_sdk_version=22", + ] +} + +# GYP: //chrome/android/chrome_apk.gyp:chrome_public_apk_template_resources +jinja_template_resources("chrome_public_apk_template_resources") { resources = [ "java/res_template/xml/searchable.xml", "java/res_template/xml/syncadapter.xml", ] res_dir = "java/res_template" - variables = jinja_variables + variables = chrome_public_jinja_variables +} + +# GYP: //chrome/android/chrome_apk.gyp:chrome_sync_shell_apk_template_resources +jinja_template_resources("chrome_sync_shell_apk_template_resources") { + resources = [ + "java/res_template/xml/searchable.xml", + "java/res_template/xml/syncadapter.xml", + ] + res_dir = "java/res_template" + variables = chrome_sync_shell_jinja_variables } # GYP: //chrome/android/chrome_apk.gyp:libchrome_public @@ -387,54 +419,95 @@ shared_library("chrome_public") { "//build/config/sanitizers:deps", "//chrome:chrome_android_core", ] - gypi_values = exec_script( - "//build/gypi_to_gn.py", - [ - rebase_path("chrome_apk.gyp"), - "--replace=<(chrome_native_sources_dir)=../browser/android/", - ], - "scope", - [ "chrome_apk.gyp" ]) - sources = gypi_values.chrome_public_app_native_sources + sources = chrome_apk_gypi.chrome_public_app_native_sources +} + +# GYP: //chrome/android/chrome_apk.gyp:libchrome_sync_shell +shared_library("chrome_sync_shell") { + testonly = true + deps = [ + "//build/config/sanitizers:deps", + "//chrome:chrome_android_core", + "//sync", + "//sync:test_support_sync_fake_server_android", + ] + sources = chrome_apk_gypi.chrome_sync_shell_app_native_sources } -chrome_public_apk_tmpl("chrome_public_apk") { - version_name = "Developer Build" - version_code = "1" +# Contains rules common to chrome_public_apk and chrome_sync_shell_apk +template("chrome_public_apk_tmpl_shared") { + chrome_public_apk_tmpl(target_name) { + forward_variables_from(invoker, "*") + + native_lib_version_rule = "//build/util:chrome_version_json" + + # Only attempt loading the library from the APK for 64 bit devices + # until the number of 32 bit devices which don't support this + # approach falls to a minimal level - http://crbug.com/390618. + if (chromium_linker_supported && + (target_cpu == "arm64" || target_cpu == "x64")) { + load_library_from_apk = chrome_public_apk_load_library_from_apk + } + + deps += [ + ":chrome_java", + ":chrome_public_apk_assets", + ":chrome_public_apk_resources", + "//base:base_java", + google_play_services_resources, + ] + } +} + +chrome_public_apk_tmpl_shared("chrome_public_apk") { android_manifest = get_target_outputs(":chrome_public_apk_manifest") android_manifest = android_manifest[1] apk_name = "ChromePublic" native_libs = [ "libchrome_public.so" ] - native_lib_version_rule = "//build/util:chrome_version_json" - - # Only attempt loading the library from the APK for 64 bit devices - # until the number of 32 bit devices which don't support this - # approach falls to a minimal level - http://crbug.com/390618. - if (chromium_linker_supported && - (target_cpu == "arm64" || target_cpu == "x64")) { - load_library_from_apk = chrome_public_apk_load_library_from_apk - } deps = [ - ":chrome_java", ":chrome_public", - ":chrome_public_apk_assets", ":chrome_public_apk_manifest", - ":chrome_public_apk_resources", - ":chrome_public_template_resources", - "//base:base_java", - google_play_services_resources, + ":chrome_public_apk_template_resources", + ] +} + +chrome_public_apk_tmpl_shared("chrome_sync_shell_apk") { + testonly = true + android_manifest = get_target_outputs(":chrome_sync_shell_apk_manifest") + android_manifest = android_manifest[1] + apk_name = "ChromeSyncShell" + native_libs = [ "libchrome_sync_shell.so" ] + + deps = [ + ":chrome_sync_shell", + ":chrome_sync_shell_apk_manifest", + ":chrome_sync_shell_apk_template_resources", + + # This exists here because com.google.protobuf.nano is needed in tests, + # but that code is stripped out via proguard. Adding this deps adds + # usages and prevents removal of the proto code. + "//sync:test_support_sync_proto_java", ] } chrome_public_test_apk_manifest = "$root_gen_dir/chrome_public_test_apk_manifest/AndroidManifest.xml" +chrome_sync_shell_test_apk_manifest = + "$root_gen_dir/chrome_sync_shell_test_apk_manifest/AndroidManifest.xml" # GYP: //chrome/android/chrome_apk.gyp:chrome_public_test_apk_manifest jinja_template("chrome_public_test_apk_manifest") { input = "javatests/AndroidManifest.xml" output = chrome_public_test_apk_manifest - variables = jinja_variables + variables = chrome_public_jinja_variables +} + +# GYP: //chrome/android/chrome_apk.gyp:chrome_sync_shell_test_apk_manifest +jinja_template("chrome_sync_shell_test_apk_manifest") { + input = "sync_shell/javatests/AndroidManifest.xml" + output = chrome_sync_shell_test_apk_manifest + variables = chrome_sync_shell_jinja_variables } # GYP: //chrome/android/chrome_apk.gyp:chrome_public_test_apk @@ -444,8 +517,45 @@ instrumentation_test_apk("chrome_public_test_apk") { android_manifest = chrome_public_test_apk_manifest deps = [ ":chrome_public_test_apk_manifest", - "//chrome/android:chrome_shared_test_java", + ":chrome_shared_test_java", ] isolate_file = "../chrome_public_test_apk.isolate" proguard_enabled = !is_debug } + +android_library("chrome_sync_shell_test_apk_java") { + testonly = true + DEPRECATED_java_in_dir = "sync_shell/javatests/src" + + deps = [ + "//base:base_java", + "//base:base_java_test_support", + "//chrome/android:chrome_java", + "//chrome/android:chrome_java_resources", + "//chrome/test/android:chrome_java_test_support", + "//components/bookmarks/common/android:bookmarks_java", + "//components/policy/android:policy_java", + "//content/public/android:content_java", + "//content/public/test/android:content_java_test_support", + "//sync:sync_java_test_support", + "//sync:test_support_sync_proto_java", + "//sync/android:sync_java", + "//third_party/android_protobuf:protobuf_nano_javalib", + "//third_party/android_tools:android_support_v13_java", + "//third_party/android_tools:android_support_v7_appcompat_java", + "//ui/android:ui_java", + ] +} + +# GYP: //chrome/android/chrome_apk.gyp:chrome_sync_shell_test_apk +instrumentation_test_apk("chrome_sync_shell_test_apk") { + apk_name = "ChromeSyncShellTest" + apk_under_test = ":chrome_sync_shell_apk" + android_manifest = chrome_sync_shell_test_apk_manifest + deps = [ + ":chrome_sync_shell_test_apk_java", + ":chrome_sync_shell_test_apk_manifest", + ] + isolate_file = "../chrome_sync_shell_test_apk.isolate" + proguard_enabled = !is_debug +} diff --git a/chrome/android/chrome_apk.gyp b/chrome/android/chrome_apk.gyp index f5df8f3..f1ca5cd 100644 --- a/chrome/android/chrome_apk.gyp +++ b/chrome/android/chrome_apk.gyp @@ -23,10 +23,18 @@ '../app/android/chrome_main_delegate_android_initializer.cc', '../browser/android/chrome_entry_point.cc', ], + + # This list is shared with GN. + 'chrome_sync_shell_app_native_sources': [ + '../browser/android/chrome_entry_point.cc', + '../browser/android/chrome_sync_shell_main_delegate_initializer.cc', + '../browser/android/chrome_sync_shell_main_delegate.h', + '../browser/android/chrome_sync_shell_main_delegate.cc', + ] }, 'targets': [ { - #GN: //chrome/android::custom_tabs_service_aidl + # GN: //chrome/android::custom_tabs_service_aidl 'target_name': 'custom_tabs_service_aidl', 'type': 'none', 'variables': { @@ -40,8 +48,8 @@ 'includes': [ '../../build/java_aidl.gypi' ], }, { - # GN: //chrome/android:chrome_public_template_resources - 'target_name': 'chrome_public_template_resources', + # GN: //chrome/android:chrome_public_apk_template_resources + 'target_name': 'chrome_public_apk_template_resources', 'type': 'none', 'variables': { 'jinja_inputs_base_dir': 'java/res_template', @@ -63,9 +71,8 @@ 'includes': [ '../../build/android/jinja_template.gypi' ], }, { - # TODO(pvalenzuela): Implement this target with GN: - # http://crbug.com/475612 - 'target_name': 'chrome_sync_shell_template_resources', + # GN: //chrome/android:chrome_sync_shell_apk_template_resources + 'target_name': 'chrome_sync_shell_apk_template_resources', 'type': 'none', 'variables': { 'jinja_inputs_base_dir': 'java/res_template', @@ -139,15 +146,11 @@ ], }, { - # TODO(pvalenzuela): Implement this target with GN: - # http://crbug.com/475612 + # GN: //chrome/android:chrome_sync_shell 'target_name': 'libchrome_sync_shell', 'type': 'shared_library', 'sources': [ - '../browser/android/chrome_entry_point.cc', - '../browser/android/chrome_sync_shell_main_delegate_initializer.cc', - '../browser/android/chrome_sync_shell_main_delegate.h', - '../browser/android/chrome_sync_shell_main_delegate.cc', + '<@(chrome_sync_shell_app_native_sources)', ], 'dependencies': [ 'libchrome_public_base', @@ -173,9 +176,8 @@ 'includes': [ '../../build/android/jinja_template.gypi' ], }, { - # TODO(pvalenzuela): Implement this target with GN: - # http://crbug.com/475612 - 'target_name': 'chrome_sync_shell_manifest', + # GN: //chrome/android:chrome_sync_shell_apk_manifest + 'target_name': 'chrome_sync_shell_apk_manifest', 'type': 'none', 'variables': { 'jinja_inputs': ['java/AndroidManifest.xml'], @@ -213,7 +215,7 @@ }, 'dependencies': [ 'chrome_android_paks_copy', - 'chrome_public_template_resources', + 'chrome_public_apk_template_resources', 'libchrome_public', '../chrome.gyp:chrome_java', ], @@ -231,8 +233,7 @@ 'includes': [ '../../build/apk_fake_jar.gypi' ], }, { - # TODO(pvalenzuela): Implement this target with GN: - # http://crbug.com/475612 + # GN: //chrome/android:chrome_sync_shell_apk 'target_name': 'chrome_sync_shell_apk', 'type': 'none', 'variables': { @@ -253,7 +254,7 @@ }, 'dependencies': [ 'chrome_android_paks_copy', - 'chrome_sync_shell_template_resources', + 'chrome_sync_shell_apk_template_resources', 'libchrome_sync_shell', '../chrome.gyp:chrome_java', # This exists here because com.google.protobuf.nano is needed in tests, @@ -316,8 +317,7 @@ 'includes': [ '../../build/android/jinja_template.gypi' ], }, { - # TODO(pvalenzuela): Implement this target with GN: - # http://crbug.com/475612 + # GN: //chrome/android:chrome_sync_shell_test_apk_manifest 'target_name': 'chrome_sync_shell_test_apk_manifest', 'type': 'none', 'variables': { @@ -355,8 +355,7 @@ ], }, { - # TODO(pvalenzuela): Implement this target with GN: - # http://crbug.com/475612 + # GN: //chrome/android:chrome_sync_shell_test_apk 'target_name': 'chrome_sync_shell_test_apk', 'type': 'none', 'dependencies': [ diff --git a/sync/BUILD.gn b/sync/BUILD.gn index b6a76af..c6fd22b 100644 --- a/sync/BUILD.gn +++ b/sync/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/features.gni") +import("//sync/protocol/protocol_sources.gni") import("//testing/test.gni") component("sync") { @@ -841,6 +842,30 @@ if (is_android) { ] } + _test_support_sync_prepared_protos_dir = + "$root_gen_dir/test_support_sync_proto_java_prepare/" + action("test_support_sync_proto_java_prepare") { + script = "//sync/protocol/prepare_protos_for_java_tests.py" + inputs = sync_protocol_sources + outputs = process_file_template( + sync_protocol_sources, + [ "$_test_support_sync_prepared_protos_dir/{{source_file_part}}" ]) + args = [ + "--output_dir", + rebase_path(_test_support_sync_prepared_protos_dir, root_build_dir), + ] + args += rebase_path(sync_protocol_sources, root_build_dir) + } + + # GYP: //sync/sync_tests.gypi:test_support_sync_proto_java + proto_java_library("test_support_sync_proto_java") { + proto_path = _test_support_sync_prepared_protos_dir + sources = get_target_outputs(":test_support_sync_proto_java_prepare") + deps = [ + ":test_support_sync_proto_java_prepare", + ] + } + # GYP: //sync/sync_tests.gypi:sync_java_test_support android_library("sync_java_test_support") { testonly = true diff --git a/sync/protocol/BUILD.gn b/sync/protocol/BUILD.gn index 0fefbc5..f90ae70 100644 --- a/sync/protocol/BUILD.gn +++ b/sync/protocol/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//third_party/protobuf/proto_library.gni") +import("protocol_sources.gni") # This must be a component for the dependency structure we have now, but the # proto_library generates a source set. Link those into a component. @@ -15,49 +16,7 @@ component("protocol") { proto_library("protocol_internal") { visibility = [ ":protocol" ] - sources = [ - "app_list_specifics.proto", - "app_notification_specifics.proto", - "app_setting_specifics.proto", - "app_specifics.proto", - "article_specifics.proto", - "attachments.proto", - "autofill_specifics.proto", - "bookmark_specifics.proto", - "client_commands.proto", - "client_debug_info.proto", - "device_info_specifics.proto", - "dictionary_specifics.proto", - "encryption.proto", - "entity_metadata.proto", - "experiment_status.proto", - "experiments_specifics.proto", - "extension_setting_specifics.proto", - "extension_specifics.proto", - "favicon_image_specifics.proto", - "favicon_tracking_specifics.proto", - "get_updates_caller_info.proto", - "history_delete_directive_specifics.proto", - "managed_user_setting_specifics.proto", - "managed_user_shared_setting_specifics.proto", - "managed_user_specifics.proto", - "managed_user_whitelist_specifics.proto", - "nigori_specifics.proto", - "password_specifics.proto", - "preference_specifics.proto", - "priority_preference_specifics.proto", - "search_engine_specifics.proto", - "session_specifics.proto", - "sync.proto", - "sync_enums.proto", - "synced_notification_app_info_specifics.proto", - "synced_notification_specifics.proto", - "test.proto", - "theme_specifics.proto", - "typed_url_specifics.proto", - "unique_position.proto", - "wifi_credential_specifics.proto", - ] + sources = sync_protocol_sources cc_generator_options = "dllexport_decl=SYNC_PROTO_EXPORT:" cc_include = "sync/protocol/sync_proto_export.h" diff --git a/sync/protocol/protocol.gypi b/sync/protocol/protocol.gypi index 82f7dd4..21aa65d 100644 --- a/sync/protocol/protocol.gypi +++ b/sync/protocol/protocol.gypi @@ -11,9 +11,6 @@ # The list of sync protocol buffer definitions. 'sync_proto_source_paths': [ - # NOTE: If you add a file to this list, also add it to - # sync/protocol/BUILD.gn - # TODO(pvalenzuela): Eliminate the requirement to update the GN file. '<(sync_proto_sources_dir)/app_notification_specifics.proto', '<(sync_proto_sources_dir)/app_setting_specifics.proto', '<(sync_proto_sources_dir)/app_specifics.proto', diff --git a/sync/protocol/protocol_sources.gni b/sync/protocol/protocol_sources.gni new file mode 100644 index 0000000..86cefae --- /dev/null +++ b/sync/protocol/protocol_sources.gni @@ -0,0 +1,14 @@ +# Copyright 2015 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. + +protocol_gypi = + exec_script("//build/gypi_to_gn.py", + [ + rebase_path("//sync/protocol/protocol.gypi"), + "--replace=<(sync_proto_sources_dir)=//sync/protocol", + ], + "scope", + [ "//sync/protocol/protocol.gypi" ]) + +sync_protocol_sources = protocol_gypi.sync_proto_source_paths diff --git a/sync/sync_tests.gypi b/sync/sync_tests.gypi index e7eceec..e550c30 100644 --- a/sync/sync_tests.gypi +++ b/sync/sync_tests.gypi @@ -439,8 +439,7 @@ 'includes': [ '../build/jni_generator.gypi' ], }, { - # TODO(pvalenzuela): Create GN version of this target. - # http://crbug.com/475612 + # GN: //sync:test_support_sync_proto_java 'target_name': 'test_support_sync_proto_java', 'type': 'none', 'variables': { |