Commit 7c03b6d4 authored by danakj's avatar danakj Committed by Commit Bot

Require opt-in to generate mojom targets for Android Java.

Currently all mojom targets are generated on Android for Java which
then causes them to all be compiled as the bots compile all targets.

This makes generating Java bindings for Android explicit, and adds the
flag to each mojom target that is reachable during `gn gen`.

The flag is overridden by cpp_only, which would prevent Java bindings
from being generated.

This saves about 2 minutes per parallel compilation task when building
the .javac.jar step, which is a dominant part of compile. In the
experiment the total time spend on this step went from 1h21m to 1h10m.

The .jar step also improved from 1h1m to 53m, with weighted time from
6m6s to 5m4s.

R=agrieve@chromium.org, rockot@chromium.org
TBR=jam

Bug: 603143
Change-Id: I4c636ce051abcd7a89efc46224b2405cef8110dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1868986
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708315}
parent 83bb172f
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojo_types") {
generate_java = true
sources = [
"autofill_types.mojom",
]
......
......@@ -56,6 +56,7 @@ jumbo_source_set("unit_tests") {
}
mojom("mojo_bindings") {
generate_java = true
sources = [
"content_settings.mojom",
]
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"contextual_search_js_api_service.mojom",
]
......
......@@ -5,9 +5,11 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"payment_request_data.mojom",
]
# TODO(crbug.com/699569): Convert to use the new JS bindings.
# use_new_js_bindings = false
}
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"directory.mojom",
"file.mojom",
......
......@@ -200,6 +200,7 @@ component("vulkan_ycbcr_info") {
}
mojom("interfaces") {
generate_java = true
sources = [
"capabilities.mojom",
"context_result.mojom",
......@@ -224,6 +225,7 @@ mojom("interfaces") {
}
mojom("gpu_preferences_interface") {
generate_java = true
sources = [
"gpu_preferences.mojom",
]
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("video_capture") {
generate_java = true
sources = [
"video_capture.mojom",
"video_capture_types.mojom",
......
......@@ -6,6 +6,7 @@ import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"learning_task_controller.mojom",
"learning_types.mojom",
......
......@@ -6,6 +6,8 @@ import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
# TODO(crbug.com/676224): Conditionally add source files in this list when we
# support EnabledIf attribute in mojom files.
sources = [
......
......@@ -5,6 +5,7 @@
import("../../tools/bindings/mojom.gni")
mojom_component("bindings") {
generate_java = true
output_prefix = "mojo_mojom_bindings"
macro_prefix = "MOJO_MOJOM_BINDINGS"
......
......@@ -276,6 +276,7 @@ action_foreach("validation_test_data_list") {
mojom("test_interfaces") {
testonly = true
generate_java = true
sources = [
"math_calculator.mojom",
"no_module.mojom",
......@@ -391,6 +392,7 @@ mojom("test_export2") {
mojom("test_mojom_import") {
testonly = true
generate_java = true
sources = [
"sample_import.mojom",
]
......@@ -398,6 +400,7 @@ mojom("test_mojom_import") {
mojom("test_mojom_import_wrapper") {
testonly = true
generate_java = true
public_deps = [
":test_mojom_import",
]
......@@ -405,6 +408,7 @@ mojom("test_mojom_import_wrapper") {
mojom("test_mojom_import_wrapper_wrapper") {
testonly = true
generate_java = true
public_deps = [
":test_mojom_import_wrapper",
]
......@@ -412,6 +416,7 @@ mojom("test_mojom_import_wrapper_wrapper") {
mojom("test_mojom_import2") {
testonly = true
generate_java = true
sources = [
"sample_import2.mojom",
]
......@@ -480,6 +485,7 @@ mojom("test_no_sources") {
mojom("echo") {
testonly = true
generate_java = true
sources = [
"echo.mojom",
"echo_import/echo_import.mojom",
......@@ -489,6 +495,7 @@ mojom("echo") {
# These could probably be merged with "test_interfaces" at some point.
mojom("other_test_interfaces") {
testonly = true
generate_java = true
sources = [
"new_endpoint_types.test-mojom",
]
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom_component("base") {
generate_java = true
sources = [
"application_state.mojom",
"big_buffer.mojom",
......
......@@ -219,6 +219,11 @@ if (enable_mojom_typemapping) {
# will still be generated even when |cpp_only| is set to |true|, unless
# you also set |enable_fuzzing| to |false| in your mojom target.
#
# generate_java (optional)
# If set to true, Java bindings are generated for Android builds. If
# |cpp_only| is set to true, it overrides this to prevent generation of
# Java bindings.
#
# enable_fuzzing (optional)
# Enables generation of fuzzing sources for the target if the global build
# arg |enable_ipc_fuzzer| is also set to |true|. Defaults to |true|. If
......@@ -773,6 +778,10 @@ template("mojom") {
variant_suffix = "_${variant}"
cpp_only = true
}
generate_java = false
if (!cpp_only && defined(invoker.generate_java)) {
generate_java = invoker.generate_java
}
type_mappings_target_name = "${target_name}${variant_suffix}__type_mappings"
type_mappings_path =
"$target_gen_dir/${target_name}${variant_suffix}__type_mappings"
......@@ -1135,7 +1144,7 @@ template("mojom") {
}
}
if (!cpp_only && is_android) {
if (generate_java && is_android) {
import("//build/config/android/rules.gni")
java_generator_target_name = target_name + "_java__generator"
......
......@@ -6,6 +6,7 @@ import("//build/config/features.gni")
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"battery_monitor.mojom",
"battery_status.mojom",
......@@ -63,6 +64,7 @@ mojom("mojom") {
}
mojom("generic_sensor") {
generate_java = true
sources = [
"sensor.mojom",
"sensor_provider.mojom",
......@@ -86,6 +88,7 @@ mojom("generic_sensor") {
}
mojom("constants") {
generate_java = true
sources = [
"constants.mojom",
]
......@@ -101,6 +104,7 @@ mojom("constants") {
}
mojom("usb") {
generate_java = true
sources = [
"usb_device.mojom",
"usb_enumeration_options.mojom",
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"audio_focus.mojom",
"constants.mojom",
......
......@@ -10,6 +10,7 @@ import("//services/network/public/cpp/features.gni")
# which comes from the fact that proxy_resolver service uses these interfaces,
# and the network service uses the proxy_resolver service.
mojom("mojom_ip_address") {
generate_java = true
sources = [
"address_family.mojom",
"address_list.mojom",
......@@ -26,6 +27,7 @@ mojom("mojom_ip_address") {
# which comes from the fact that the typemap for url_loader.mojom
# (ResourceRequestBody) uses these interfaces.
mojom("data_pipe_interfaces") {
generate_java = true
sources = [
"chunked_data_pipe_getter.mojom",
"data_pipe_getter.mojom",
......@@ -43,6 +45,7 @@ mojom("data_pipe_interfaces") {
}
mojom("mutable_network_traffic_annotation_interface") {
generate_java = true
sources = [
"mutable_network_traffic_annotation_tag.mojom",
"mutable_partial_network_traffic_annotation_tag.mojom",
......@@ -52,6 +55,7 @@ mojom("mutable_network_traffic_annotation_interface") {
# This target is split from "mojom" target as the lazy serialization may
# cause problems. See https://crbug.com/822732.
mojom("websocket_mojom") {
generate_java = true
sources = [
"network_param.mojom",
"websocket.mojom",
......@@ -72,6 +76,7 @@ mojom("websocket_mojom") {
}
mojom("mojom") {
generate_java = true
sources = [
"content_security_policy.mojom",
"cookie_manager.mojom",
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"proxy_resolver.mojom",
]
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom_component("mojom") {
generate_java = true
output_prefix = "service_manager_mojom"
macro_prefix = "SERVICE_MANAGER_MOJOM"
......@@ -25,6 +26,7 @@ mojom_component("mojom") {
}
mojom_component("constants") {
generate_java = true
output_prefix = "service_manager_mojom_constants"
macro_prefix = "SERVICE_MANAGER_MOJOM_CONSTANTS"
sources = [
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"barcodedetection.mojom",
"barcodedetection_provider.mojom",
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"echo.mojom",
]
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"compositing/begin_frame_args.mojom",
"compositing/compositing_mode_watcher.mojom",
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"bitmap.mojom",
"blur_image_filter_tile_mode.mojom",
......
......@@ -13,6 +13,7 @@ if (is_android) {
# renderer/platform. In particular these mojom interfaces can't use types that
# are typemapped to a type in renderer/core.
mojom("mojom_platform") {
generate_java = true
sources = [
"ad_tagging/ad_frame.mojom",
"app_banner/app_banner.mojom",
......@@ -209,6 +210,7 @@ mojom("mojom_platform") {
# needed by Android's implementation (in chrome/android or in android_webview)
# for following mojom files.
mojom("android_mojo_bindings") {
generate_java = true
sources = [
"blob/blob.mojom",
"blob/blob_registry.mojom",
......@@ -265,6 +267,7 @@ mojom("android_mojo_bindings") {
# modules dependencies if it looks necessary, at that time we can put all of
# those high-level service worker mojom files there.
mojom("mojom_core") {
generate_java = true
sources = [
"messaging/cloneable_message.mojom",
"messaging/message_port_descriptor.mojom",
......@@ -415,6 +418,7 @@ mojom("mojom_broadcastchannel_bindings") {
}
mojom("mojom_mhtml_load_result") {
generate_java = true
sources = [
"loader/mhtml_load_result.mojom",
]
......@@ -428,6 +432,7 @@ mojom("mojom_mhtml_load_result") {
# because the chromium typemap for blink mojo_bindings has private content
# dependencies.
mojom_component("web_feature_mojo_bindings") {
generate_java = true
sources = [
"use_counter/css_property_id.mojom",
"web_feature/web_feature.mojom",
......@@ -441,6 +446,7 @@ mojom_component("web_feature_mojo_bindings") {
# mojom files because the chromium typemap for blink mojo_bindings has private
# content dependencies.
mojom("web_client_hints_types_mojo_bindings") {
generate_java = true
sources = [
"web_client_hints/web_client_hints_types.mojom",
]
......@@ -473,6 +479,7 @@ mojom("embedded_frame_sink_mojo_bindings") {
# This is a separate target because it needs unscrambled message IDs.
mojom("authenticator_test_mojo_bindings") {
generate_java = true
sources = [
"webauthn/virtual_authenticator.mojom",
]
......
......@@ -5,6 +5,8 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("usb") {
generate_java = true
# Ideally, this mojom file should be compiled directly in "mojom_platform"
# target in the parent directory. But as we need |scramble_message_ids| to
# be "false" for its mojom JS file will be used in external WPT tests.
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"ime_types.mojom",
]
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"cursor.mojom",
"ui_base_types.mojom",
......
......@@ -7,6 +7,7 @@ import("//mojo/public/tools/bindings/mojom.gni")
# This target does NOT depend on skia. One can depend on this target to avoid
# picking up a dependency on skia.
mojom("mojom") {
generate_java = true
sources = [
"geometry.mojom",
]
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"accelerated_widget.mojom",
"buffer_types.mojom",
......
......@@ -5,6 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [
"latency_info.mojom",
]
......
......@@ -5,12 +5,14 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("url_mojom_gurl") {
generate_java = true
sources = [
"url.mojom",
]
}
mojom("url_mojom_origin") {
generate_java = true
sources = [
"origin.mojom",
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment