Commit 015487b3 authored by Oksana Zhuravlova's avatar Oksana Zhuravlova Committed by Commit Bot

Implement a check for import/deps consistency in mojom files

This changes adds a new target to the mojom template which depends on
the parse target and is a dependency for all generation targets. A new
action has been added to the mojom_bindings_generator.py script that
compares the list of sources for all dependencies of a given mojom file
target to the list of imports in this file. If missing dependencies are
found, they are printed and the script exits with an error.
This changes also fixes missing dependencies and not fully-qualified
import statements.

Dependency check has been disabled for //content/common:mojo_bindings
and //content/public/common/interfaces since it caused multiple
definitions linker errors on Windows (they have both direct and indirect
dependencies on specific targets).

Bug: 753219
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_mojo;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win10_chromium_x64_rel_ng
Change-Id: I64613ad14af41f1fc2a77b81ac76507e26f9dfcc
Reviewed-on: https://chromium-review.googlesource.com/947384
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542054}
parent a3da58f9
...@@ -60,11 +60,15 @@ mojom("interfaces_internal") { ...@@ -60,11 +60,15 @@ mojom("interfaces_internal") {
"//components/signin/public/interfaces", "//components/signin/public/interfaces",
"//components/sync/mojo:interfaces", "//components/sync/mojo:interfaces",
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//services/preferences/public/mojom", "//services/preferences/public/mojom",
"//skia/public/interfaces", "//skia/public/interfaces",
"//ui/accessibility:ax_enums_mojo",
"//ui/events/mojo:interfaces", "//ui/events/mojo:interfaces",
"//ui/gfx/geometry/mojo",
"//ui/gfx/image/mojo:interfaces", "//ui/gfx/image/mojo:interfaces",
"//ui/message_center/public/mojo:mojo", "//ui/message_center/public/mojo:mojo",
"//url/mojom:url_mojom_gurl",
] ]
component_output_prefix = "ash_public_interfaces_internal" component_output_prefix = "ash_public_interfaces_internal"
...@@ -83,5 +87,6 @@ mojom("test_interfaces") { ...@@ -83,5 +87,6 @@ mojom("test_interfaces") {
] ]
deps = [ deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
] ]
} }
...@@ -694,6 +694,7 @@ mojom("mojo_bindings") { ...@@ -694,6 +694,7 @@ mojom("mojo_bindings") {
"//components/content_settings/core/common:mojo_bindings", "//components/content_settings/core/common:mojo_bindings",
"//content/public/common:interfaces", "//content/public/common:interfaces",
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//third_party/WebKit/public:mojo_bindings", "//third_party/WebKit/public:mojo_bindings",
"//ui/gfx/geometry/mojo", "//ui/gfx/geometry/mojo",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
...@@ -722,6 +723,7 @@ mojom("search_mojom") { ...@@ -722,6 +723,7 @@ mojom("search_mojom") {
public_deps = [ public_deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
] ]
} }
......
...@@ -12,6 +12,7 @@ mojom("interfaces") { ...@@ -12,6 +12,7 @@ mojom("interfaces") {
public_deps = [ public_deps = [
"//components/autofill/content/common:mojo_types", "//components/autofill/content/common:mojo_types",
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
] ]
} }
......
...@@ -10,10 +10,6 @@ mojom("mojom") { ...@@ -10,10 +10,6 @@ mojom("mojom") {
"constants.mojom", "constants.mojom",
] ]
if (is_chromeos) {
sources += [ "zip_file_creator.mojom" ]
}
if (safe_browsing_mode == 1) { if (safe_browsing_mode == 1) {
sources += [ "safe_archive_analyzer.mojom" ] sources += [ "safe_archive_analyzer.mojom" ]
} }
...@@ -21,4 +17,9 @@ mojom("mojom") { ...@@ -21,4 +17,9 @@ mojom("mojom") {
public_deps = [ public_deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
] ]
if (is_chromeos) {
sources += [ "zip_file_creator.mojom" ]
public_deps += [ "//components/filesystem/public/interfaces" ]
}
} }
...@@ -11,12 +11,13 @@ mojom("mojom") { ...@@ -11,12 +11,13 @@ mojom("mojom") {
"pdf_to_pwg_raster_converter.mojom", "pdf_to_pwg_raster_converter.mojom",
] ]
if (is_win) {
sources += [ "pdf_to_emf_converter.mojom" ]
}
deps = [ deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//ui/gfx/geometry/mojo", "//ui/gfx/geometry/mojo",
] ]
if (is_win) {
sources += [ "pdf_to_emf_converter.mojom" ]
deps += [ "//mojo/public/mojom/base" ]
}
} }
...@@ -12,6 +12,7 @@ mojom("mojom") { ...@@ -12,6 +12,7 @@ mojom("mojom") {
public_deps = [ public_deps = [
":constants", ":constants",
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
] ]
} }
......
...@@ -2170,6 +2170,8 @@ if (is_mac) { ...@@ -2170,6 +2170,8 @@ if (is_mac) {
] ]
public_deps = [ public_deps = [
"//components/autofill/content/common:mojo_types", "//components/autofill/content/common:mojo_types",
"//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
] ]
} }
} }
......
...@@ -57,7 +57,9 @@ if (is_chromeos) { ...@@ -57,7 +57,9 @@ if (is_chromeos) {
public_deps = [ public_deps = [
":media", ":media",
"//device/usb/public/mojom",
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//ui/gfx/geometry/mojo", "//ui/gfx/geometry/mojo",
] ]
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
module arc.mojom; module arc.mojom;
import "gfx.mojom"; import "components/arc/common/gfx.mojom";
// For future maintainers, each of the below enums were hand picked // For future maintainers, each of the below enums were hand picked
// from their equivalents in the Android source. Keep them in the // from their equivalents in the Android source. Keep them in the
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
module arc.mojom; module arc.mojom;
import "gfx.mojom"; import "components/arc/common/gfx.mojom";
import "scale_factor.mojom"; import "components/arc/common/scale_factor.mojom";
// Describes OrientationLock request. // Describes OrientationLock request.
// Note: ChromeOS currently assumes the internal panel is always landscape. // Note: ChromeOS currently assumes the internal panel is always landscape.
......
...@@ -4,45 +4,45 @@ ...@@ -4,45 +4,45 @@
module arc.mojom; module arc.mojom;
import "accessibility_helper.mojom"; import "components/arc/common/accessibility_helper.mojom";
import "app.mojom"; import "components/arc/common/app.mojom";
import "audio.mojom"; import "components/arc/common/audio.mojom";
import "auth.mojom"; import "components/arc/common/auth.mojom";
import "backup_settings.mojom"; import "components/arc/common/backup_settings.mojom";
import "bluetooth.mojom"; import "components/arc/common/bluetooth.mojom";
import "boot_phase_monitor.mojom"; import "components/arc/common/boot_phase_monitor.mojom";
import "cast_receiver.mojom"; import "components/arc/common/cast_receiver.mojom";
import "cert_store.mojom"; import "components/arc/common/cert_store.mojom";
import "clipboard.mojom"; import "components/arc/common/clipboard.mojom";
import "crash_collector.mojom"; import "components/arc/common/crash_collector.mojom";
import "enterprise_reporting.mojom"; import "components/arc/common/enterprise_reporting.mojom";
import "file_system.mojom"; import "components/arc/common/file_system.mojom";
import "ime.mojom"; import "components/arc/common/ime.mojom";
import "intent_helper.mojom"; import "components/arc/common/intent_helper.mojom";
import "kiosk.mojom"; import "components/arc/common/kiosk.mojom";
import "lock_screen.mojom"; import "components/arc/common/lock_screen.mojom";
import "metrics.mojom"; import "components/arc/common/metrics.mojom";
import "midis.mojom"; import "components/arc/common/midis.mojom";
import "net.mojom"; import "components/arc/common/net.mojom";
import "notifications.mojom"; import "components/arc/common/notifications.mojom";
import "obb_mounter.mojom"; import "components/arc/common/obb_mounter.mojom";
import "oemcrypto.mojom"; import "components/arc/common/oemcrypto.mojom";
import "policy.mojom"; import "components/arc/common/policy.mojom";
import "power.mojom"; import "components/arc/common/power.mojom";
import "print.mojom"; import "components/arc/common/print.mojom";
import "process.mojom"; import "components/arc/common/process.mojom";
import "rotation_lock.mojom"; import "components/arc/common/rotation_lock.mojom";
import "screen_capture.mojom"; import "components/arc/common/screen_capture.mojom";
import "storage_manager.mojom"; import "components/arc/common/storage_manager.mojom";
import "timer.mojom"; import "components/arc/common/timer.mojom";
import "tracing.mojom"; import "components/arc/common/tracing.mojom";
import "tts.mojom"; import "components/arc/common/tts.mojom";
import "usb_host.mojom"; import "components/arc/common/usb_host.mojom";
import "video.mojom"; import "components/arc/common/video.mojom";
import "voice_interaction_arc_home.mojom"; import "components/arc/common/voice_interaction_arc_home.mojom";
import "voice_interaction_framework.mojom"; import "components/arc/common/voice_interaction_framework.mojom";
import "volume_mounter.mojom"; import "components/arc/common/volume_mounter.mojom";
import "wallpaper.mojom"; import "components/arc/common/wallpaper.mojom";
// Next MinVersion: 37 // Next MinVersion: 37
// Deprecated method IDs: 101, 105 // Deprecated method IDs: 101, 105
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
module arc.mojom; module arc.mojom;
import "gfx.mojom"; import "components/arc/common/gfx.mojom";
// Represents the type of text input field currently focused. // Represents the type of text input field currently focused.
[Extensible] [Extensible]
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
module arc.mojom; module arc.mojom;
import "scale_factor.mojom"; import "components/arc/common/scale_factor.mojom";
// Describes the type of action to invoke. // Describes the type of action to invoke.
enum ActionType { enum ActionType {
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
module arc.mojom; module arc.mojom;
import "bitmap.mojom"; import "components/arc/common/bitmap.mojom";
import "gfx.mojom"; import "components/arc/common/gfx.mojom";
// These values must be matched with the NOTIFICATION_EVENT_* constants in // These values must be matched with the NOTIFICATION_EVENT_* constants in
// com.android.server.ArcNotificationListenerService. // com.android.server.ArcNotificationListenerService.
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
module arc_oemcrypto.mojom; module arc_oemcrypto.mojom;
import "oemcrypto.mojom"; import "components/arc/common/oemcrypto.mojom";
import "protected_buffer_manager.mojom"; import "components/arc/common/protected_buffer_manager.mojom";
// OemCryptoHostDaemon is implemented by the OemCrypto daemon running in // OemCryptoHostDaemon is implemented by the OemCrypto daemon running in
// Chrome OS and has Connect called from the Browser process in Chrome. // Chrome OS and has Connect called from the Browser process in Chrome.
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
module arc.mojom; module arc.mojom;
// For gfx::Size. // For gfx::Size.
import "video_common.mojom"; import "components/arc/common/video_common.mojom";
// Implemented by Chrome in order to allow requesting of permissions to perform // Implemented by Chrome in order to allow requesting of permissions to perform
// desktop capture as well as creating a session for it. // desktop capture as well as creating a session for it.
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
module arc.mojom; module arc.mojom;
import "video_decode_accelerator.mojom"; import "components/arc/common/video_decode_accelerator.mojom";
import "video_encode_accelerator.mojom"; import "components/arc/common/video_encode_accelerator.mojom";
// Deprecated method IDs: 0 // Deprecated method IDs: 0
// Next method ID: 2 // Next method ID: 2
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
module arc.mojom; module arc.mojom;
import "gfx.mojom"; import "components/arc/common/gfx.mojom";
import "video_common.mojom"; import "components/arc/common/video_common.mojom";
// Information of the bitstream buffer. // Information of the bitstream buffer.
struct BitstreamBuffer { struct BitstreamBuffer {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
module arc.mojom; module arc.mojom;
import "video_common.mojom"; import "components/arc/common/video_common.mojom";
[Extensible] [Extensible]
enum VideoPixelFormat { enum VideoPixelFormat {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
module arc.mojom; module arc.mojom;
import "gfx.mojom"; import "components/arc/common/gfx.mojom";
import "mojo/public/mojom/base/string16.mojom"; import "mojo/public/mojom/base/string16.mojom";
// Represents view structure to be passed to ARC. The view // Represents view structure to be passed to ARC. The view
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
module arc.mojom; module arc.mojom;
import "gfx.mojom"; import "components/arc/common/gfx.mojom";
// There is another copy of the VoiceInteractionState definition in // There is another copy of the VoiceInteractionState definition in
// //ash/public/interfaces/voice_interaction_controller.mojom // //ash/public/interfaces/voice_interaction_controller.mojom
......
...@@ -13,6 +13,7 @@ mojom("mojo_interfaces") { ...@@ -13,6 +13,7 @@ mojom("mojo_interfaces") {
public_deps = [ public_deps = [
":mojo_types", ":mojo_types",
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//ui/gfx/geometry/mojo", "//ui/gfx/geometry/mojo",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
] ]
......
...@@ -12,6 +12,7 @@ mojom("interfaces") { ...@@ -12,6 +12,7 @@ mojom("interfaces") {
public_deps = [ public_deps = [
"//third_party/WebKit/public:mojo_bindings", "//third_party/WebKit/public:mojo_bindings",
"//ui/gfx/geometry/mojo",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
] ]
......
...@@ -42,6 +42,7 @@ mojom("interfaces") { ...@@ -42,6 +42,7 @@ mojom("interfaces") {
public_deps = [ public_deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
] ]
enabled_features = [] enabled_features = []
......
...@@ -11,6 +11,7 @@ mojom("common") { ...@@ -11,6 +11,7 @@ mojom("common") {
public_deps = [ public_deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
] ]
} }
...@@ -528,6 +528,11 @@ mojom("mojo_bindings") { ...@@ -528,6 +528,11 @@ mojom("mojo_bindings") {
# indexed_db.mojom uses a native typemap that is not available in Java. # indexed_db.mojom uses a native typemap that is not available in Java.
cpp_only = true cpp_only = true
# imports vs deps check is disabled for this target to work around
# windows multiple definitions linker error caused by having
# both a direct and an indirect dependency on the same target
skip_deps_check = true
sources = [ sources = [
"appcache.mojom", "appcache.mojom",
"associated_interfaces.mojom", "associated_interfaces.mojom",
...@@ -590,20 +595,27 @@ mojom("mojo_bindings") { ...@@ -590,20 +595,27 @@ mojom("mojo_bindings") {
public_deps = [ public_deps = [
"//components/leveldb/public/interfaces", "//components/leveldb/public/interfaces",
"//content/public/common:interfaces", "//content/public/common:interfaces",
"//content/public/common:resource_type_bindings",
"//ipc:mojom_constants", "//ipc:mojom_constants",
"//media/mojo/interfaces", "//media/mojo/interfaces",
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//services/network/public/mojom", "//services/network/public/mojom",
"//services/service_manager/public/mojom", "//services/service_manager/public/mojom",
"//services/ui/public/interfaces", "//services/ui/public/interfaces",
"//services/ui/public/interfaces/ime",
"//services/video_capture/public/mojom", "//services/video_capture/public/mojom",
"//services/viz/public/interfaces", "//services/viz/public/interfaces",
"//skia/public/interfaces", "//skia/public/interfaces",
"//third_party/WebKit/public:mojo_bindings", "//third_party/WebKit/public:mojo_bindings",
"//third_party/WebKit/public:web_feature_mojo_bindings",
"//third_party/WebKit/public/mojom:mojom_core", "//third_party/WebKit/public/mojom:mojom_core",
"//ui/base/mojo:mojo_bindings", "//ui/base/mojo:mojo_bindings",
"//ui/events/mojo:interfaces",
"//ui/gfx/geometry/mojo", "//ui/gfx/geometry/mojo",
"//ui/gfx/mojo", "//ui/gfx/mojo",
"//ui/gfx/range/mojo",
"//ui/latency/mojo:interfaces",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
"//url/mojom:url_mojom_origin", "//url/mojom:url_mojom_origin",
] ]
......
...@@ -365,6 +365,11 @@ mojom("interfaces") { ...@@ -365,6 +365,11 @@ mojom("interfaces") {
"//extensions/common:mojo_blink", "//extensions/common:mojo_blink",
] ]
# imports vs deps check is disabled for this target to work around
# windows multiple definitions linker error caused by having
# both a direct and an indirect dependency on the same target
skip_deps_check = true
sources = [ sources = [
"appcache_info.mojom", "appcache_info.mojom",
"fullscreen_video_element.mojom", "fullscreen_video_element.mojom",
......
...@@ -13,6 +13,7 @@ mojom("mojom") { ...@@ -13,6 +13,7 @@ mojom("mojom") {
deps = [ deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
] ]
# USB Mojom interfaces are exposed publicly to layout tests which use # USB Mojom interfaces are exposed publicly to layout tests which use
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
module device.mojom; module device.mojom;
import "device.mojom"; import "device/usb/public/mojom/device.mojom";
import "device_manager.mojom"; import "device/usb/public/mojom/device_manager.mojom";
interface UsbChooserService { interface UsbChooserService {
// Get permission from user to use the device. // Get permission from user to use the device.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
module test.echo.mojom; module test.echo.mojom;
import "echo_import/echo_import.mojom"; import "mojo/public/interfaces/bindings/tests/echo_import/echo_import.mojom";
interface Echo { interface Echo {
EchoPoint(test.echo_import.mojom.Point point) EchoPoint(test.echo_import.mojom.Point point)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
[JavaPackage="org.chromium.mojo.bindings.test.mojom.sample"] [JavaPackage="org.chromium.mojo.bindings.test.mojom.sample"]
module sample; module sample;
import "sample_import.mojom"; import "mojo/public/interfaces/bindings/tests/sample_import.mojom";
// This sample shows how handles to MessagePipes can be sent as both parameters // This sample shows how handles to MessagePipes can be sent as both parameters
// to methods as well as fields on structs. // to methods as well as fields on structs.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
[JavaPackage="org.chromium.mojo.bindings.test.mojom.imported"] [JavaPackage="org.chromium.mojo.bindings.test.mojom.imported"]
module imported; module imported;
import "sample_import.mojom"; import "mojo/public/interfaces/bindings/tests/sample_import.mojom";
// This sample adds more types and constants to the "imported" namespace, // This sample adds more types and constants to the "imported" namespace,
// to test a bug with importing multiple modules with the same namespace. // to test a bug with importing multiple modules with the same namespace.
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
[JavaPackage="org.chromium.mojo.bindings.test.mojom.sample"] [JavaPackage="org.chromium.mojo.bindings.test.mojom.sample"]
module sample; module sample;
import "sample_import.mojom"; import "mojo/public/interfaces/bindings/tests/sample_import.mojom";
import "sample_import2.mojom"; import "mojo/public/interfaces/bindings/tests/sample_import2.mojom";
const uint8 kTwelve = 12; const uint8 kTwelve = 12;
......
...@@ -355,6 +355,24 @@ template("mojom") { ...@@ -355,6 +355,24 @@ template("mojom") {
} }
} }
target_sources_list = "$target_gen_dir/$target_name.sources_list"
sources_list = []
if (defined(invoker.sources)) {
sources_list = invoker.sources
}
write_file(target_sources_list, sources_list)
# a target implicitly depends on its own sources
deps_sources = [ rebase_path(target_sources_list, root_build_dir) ]
foreach(d, all_deps) {
dep_dir = get_label_info("$d", "target_gen_dir")
dep_short_name = get_label_info("$d", "name")
deps_sources +=
[ rebase_path("$dep_dir/$dep_short_name.sources_list", root_build_dir) ]
}
write_file("$target_gen_dir/$target_name.deps_sources_list", deps_sources)
if (defined(invoker.sources)) { if (defined(invoker.sources)) {
parser_target_name = "${target_name}__parser" parser_target_name = "${target_name}__parser"
enabled_features = [] enabled_features = []
...@@ -418,6 +436,38 @@ template("mojom") { ...@@ -418,6 +436,38 @@ template("mojom") {
} }
} }
if (defined(invoker.sources)) {
verify_deps_target_names = []
if (!defined(invoker.skip_deps_check) || !invoker.skip_deps_check) {
verify_deps_target_name = "${target_name}__verify_deps"
verify_deps_target_names += [ ":$verify_deps_target_name" ]
source_file_name = target_name
action_foreach(verify_deps_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources
sources = invoker.sources
deps = [
":$parsed_target_name",
]
outputs = [
"{{source_gen_dir}}/{{source_name_part}}.v",
]
args = [
"verify",
"{{source}}",
"-f",
rebase_path("$target_gen_dir/$source_file_name.deps_sources_list",
root_build_dir),
"--gen_dir",
rebase_path(root_gen_dir, root_build_dir),
"--depth",
rebase_path("//", root_build_dir),
]
}
}
}
generator_cpp_message_ids_target_name = "${target_name}__generate_message_ids" generator_cpp_message_ids_target_name = "${target_name}__generate_message_ids"
# Generate code that is shared by different variants. # Generate code that is shared by different variants.
...@@ -524,7 +574,8 @@ template("mojom") { ...@@ -524,7 +574,8 @@ template("mojom") {
deps = [ deps = [
":$parsed_target_name", ":$parsed_target_name",
"//mojo/public/tools/bindings:precompile_templates", "//mojo/public/tools/bindings:precompile_templates",
] ] + verify_deps_target_names
outputs = generator_shared_cpp_outputs outputs = generator_shared_cpp_outputs
args = common_generator_args args = common_generator_args
args += [ args += [
...@@ -698,7 +749,7 @@ template("mojom") { ...@@ -698,7 +749,7 @@ template("mojom") {
":$parsed_target_name", ":$parsed_target_name",
":$type_mappings_target_name", ":$type_mappings_target_name",
"//mojo/public/tools/bindings:precompile_templates", "//mojo/public/tools/bindings:precompile_templates",
] ] + verify_deps_target_names
outputs = generator_cpp_outputs outputs = generator_cpp_outputs
args = common_generator_args args = common_generator_args
args += [ args += [
...@@ -949,7 +1000,7 @@ template("mojom") { ...@@ -949,7 +1000,7 @@ template("mojom") {
":$parsed_target_name", ":$parsed_target_name",
":$type_mappings_target_name", ":$type_mappings_target_name",
"//mojo/public/tools/bindings:precompile_templates", "//mojo/public/tools/bindings:precompile_templates",
] ] + verify_deps_target_names
outputs = generator_java_outputs outputs = generator_java_outputs
args = common_generator_args args = common_generator_args
args += [ args += [
...@@ -1035,7 +1086,7 @@ template("mojom") { ...@@ -1035,7 +1086,7 @@ template("mojom") {
deps = [ deps = [
":$parsed_target_name", ":$parsed_target_name",
"//mojo/public/tools/bindings:precompile_templates", "//mojo/public/tools/bindings:precompile_templates",
] ] + verify_deps_target_names
outputs = generator_js_outputs outputs = generator_js_outputs
args = common_generator_args args = common_generator_args
args += [ args += [
......
...@@ -174,14 +174,7 @@ class MojomProcessor(object): ...@@ -174,14 +174,7 @@ class MojomProcessor(object):
MakeImportStackMessage(imported_filename_stack + [rel_filename.path]) MakeImportStackMessage(imported_filename_stack + [rel_filename.path])
sys.exit(1) sys.exit(1)
pickle_path = _GetPicklePath(rel_filename, args.output_dir) tree = _UnpickleAST(_GetPicklePath(rel_filename, args.output_dir))
try:
with open(pickle_path, "rb") as f:
tree = cPickle.load(f)
except (IOError, cPickle.UnpicklingError) as e:
print "%s: Error: %s" % (pickle_path, str(e))
sys.exit(1)
dirname = os.path.dirname(rel_filename.path) dirname = os.path.dirname(rel_filename.path)
# Process all our imports first and collect the module object for each. # Process all our imports first and collect the module object for each.
...@@ -273,6 +266,13 @@ def _PickleAST(ast, output_file): ...@@ -273,6 +266,13 @@ def _PickleAST(ast, output_file):
print "%s: Error: %s" % (output_file, str(e)) print "%s: Error: %s" % (output_file, str(e))
sys.exit(1) sys.exit(1)
def _UnpickleAST(input_file):
try:
with open(input_file, "rb") as f:
return cPickle.load(f)
except (IOError, cPickle.UnpicklingError) as e:
print "%s: Error: %s" % (input_file, str(e))
sys.exit(1)
def _ParseFile(args, rel_filename): def _ParseFile(args, rel_filename):
try: try:
...@@ -288,7 +288,6 @@ def _ParseFile(args, rel_filename): ...@@ -288,7 +288,6 @@ def _ParseFile(args, rel_filename):
except Error as e: except Error as e:
print "%s: Error: %s" % (rel_filename.path, str(e)) print "%s: Error: %s" % (rel_filename.path, str(e))
sys.exit(1) sys.exit(1)
_PickleAST(tree, _GetPicklePath(rel_filename, args.output_dir)) _PickleAST(tree, _GetPicklePath(rel_filename, args.output_dir))
...@@ -305,7 +304,42 @@ def _Precompile(args, _): ...@@ -305,7 +304,42 @@ def _Precompile(args, _):
template_expander.PrecompileTemplates(generator_modules, args.output_dir) template_expander.PrecompileTemplates(generator_modules, args.output_dir)
return 0 return 0
def _VerifyImportDeps(args, __):
fileutil.EnsureDirectoryExists(args.gen_dir)
for filename in args.filename:
rel_path = RelativePath(filename, args.depth)
tree = _UnpickleAST(_GetPicklePath(rel_path, args.gen_dir))
mojom_imports = set(
parsed_imp.import_filename for parsed_imp in tree.import_list
)
# read the paths from the file
f_deps = open(args.deps_file, 'r')
deps_sources = set()
for deps_path in f_deps:
deps_path = deps_path.rstrip('\n')
f_sources = open(deps_path, 'r')
for source_file in f_sources:
source_dir = deps_path.split(args.gen_dir + "/", 1)[1]
full_source_path = os.path.dirname(source_dir) + "/" + \
source_file
deps_sources.add(full_source_path.rstrip('\n'))
if (not deps_sources.issuperset(mojom_imports)):
print ">>> [%s] Missing dependencies for the following imports: %s" % ( \
args.filename[0], \
list(mojom_imports.difference(deps_sources)))
sys.exit(1)
source_filename, _ = os.path.splitext(rel_path.relative_path())
output_file = source_filename + '.v'
output_file_path = os.path.join(args.gen_dir, output_file)
WriteFile("", output_file_path)
return 0
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
...@@ -425,6 +459,22 @@ def main(): ...@@ -425,6 +459,22 @@ def main():
help="output directory for precompiled templates") help="output directory for precompiled templates")
precompile_parser.set_defaults(func=_Precompile) precompile_parser.set_defaults(func=_Precompile)
verify_parser = subparsers.add_parser("verify", description="Checks "
"the set of imports against the set of dependencies.")
verify_parser.add_argument("filename", nargs="+",
help="mojom input file")
verify_parser.add_argument("-f", "--file", dest="deps_file",
help="file containing paths to the sources files for "
"dependencies")
verify_parser.add_argument("-g", "--gen_dir",
dest="gen_dir",
help="directory with the syntax tree")
verify_parser.add_argument(
"-d", "--depth", dest="depth",
help="depth from source root")
verify_parser.set_defaults(func=_VerifyImportDeps)
args, remaining_args = parser.parse_known_args() args, remaining_args = parser.parse_known_args()
return args.func(args, remaining_args) return args.func(args, remaining_args)
......
...@@ -15,6 +15,7 @@ mojom("mojom") { ...@@ -15,6 +15,7 @@ mojom("mojom") {
public_deps = [ public_deps = [
":constants", ":constants",
"//media/mojo/interfaces", "//media/mojo/interfaces",
"//mojo/common:common_custom_types",
] ]
} }
......
...@@ -32,7 +32,9 @@ mojom("mojom") { ...@@ -32,7 +32,9 @@ mojom("mojom") {
public_deps = [ public_deps = [
":constants", ":constants",
"//mojo/common:common_custom_types",
"//services/network/public/mojom", "//services/network/public/mojom",
"//services/network/public/mojom:mutable_network_traffic_annotation_interface",
] ]
# The blink variant of the Device Service mojom are depended on by the # The blink variant of the Device Service mojom are depended on by the
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
module device.mojom; module device.mojom;
import "sensor.mojom"; import "services/device/public/mojom/sensor.mojom";
struct SensorInitParams { struct SensorInitParams {
// The Sensor interface. // The Sensor interface.
......
...@@ -78,6 +78,7 @@ mojom("mojom") { ...@@ -78,6 +78,7 @@ mojom("mojom") {
":mutable_network_traffic_annotation_interface", ":mutable_network_traffic_annotation_interface",
":udp_socket_interface", ":udp_socket_interface",
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//net/interfaces",
"//services/proxy_resolver/public/mojom", "//services/proxy_resolver/public/mojom",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
"//url/mojom:url_mojom_origin", "//url/mojom:url_mojom_origin",
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
module network.mojom; module network.mojom;
import "cookie_manager.mojom"; import "services/network/public/mojom/cookie_manager.mojom";
import "network_change_manager.mojom"; import "services/network/public/mojom/network_change_manager.mojom";
import "proxy_config.mojom"; import "services/network/public/mojom/proxy_config.mojom";
import "net/interfaces/ip_endpoint.mojom"; import "net/interfaces/ip_endpoint.mojom";
import "url_loader.mojom"; import "services/network/public/mojom/url_loader.mojom";
import "url_loader_factory.mojom"; import "services/network/public/mojom/url_loader_factory.mojom";
import "restricted_cookie_manager.mojom"; import "services/network/public/mojom/restricted_cookie_manager.mojom";
import "mojo/common/file_path.mojom"; import "mojo/common/file_path.mojom";
import "mojo/common/time.mojom"; import "mojo/common/time.mojom";
import "url/mojom/origin.mojom"; import "url/mojom/origin.mojom";
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
module network.mojom; module network.mojom;
import "network_change_manager.mojom"; import "services/network/public/mojom/network_change_manager.mojom";
[Native] [Native]
struct CertVerifyResult; struct CertVerifyResult;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
module network.mojom; module network.mojom;
import "cookie_manager.mojom"; import "services/network/public/mojom/cookie_manager.mojom";
import "mojo/common/time.mojom"; import "mojo/common/time.mojom";
import "url/mojom/url.mojom"; import "url/mojom/url.mojom";
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
module network.mojom; module network.mojom;
import "mutable_network_traffic_annotation_tag.mojom"; import "services/network/public/mojom/mutable_network_traffic_annotation_tag.mojom";
import "mojo/common/read_only_buffer.mojom"; import "mojo/common/read_only_buffer.mojom";
import "net/interfaces/address_family.mojom"; import "net/interfaces/address_family.mojom";
import "net/interfaces/ip_address.mojom"; import "net/interfaces/ip_address.mojom";
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
module network.mojom; module network.mojom;
import "mutable_network_traffic_annotation_tag.mojom"; import "services/network/public/mojom/mutable_network_traffic_annotation_tag.mojom";
import "url_loader.mojom"; import "services/network/public/mojom/url_loader.mojom";
const uint32 kURLLoadOptionNone = 0; const uint32 kURLLoadOptionNone = 0;
// Sends the net::SSLInfo struct in OnReceiveResponse. // Sends the net::SSLInfo struct in OnReceiveResponse.
......
...@@ -11,5 +11,6 @@ mojom("mojom") { ...@@ -11,5 +11,6 @@ mojom("mojom") {
] ]
public_deps = [ public_deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
] ]
} }
...@@ -9,7 +9,6 @@ mojom("mojom") { ...@@ -9,7 +9,6 @@ mojom("mojom") {
"proxy_resolver.mojom", "proxy_resolver.mojom",
] ]
deps = [ deps = [
"//mojo/common:common_custom_types",
"//net/interfaces", "//net/interfaces",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
] ]
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
module resource_coordinator.mojom; module resource_coordinator.mojom;
import "mojo/common/time.mojom"; import "mojo/common/time.mojom";
import "signals.mojom"; import "services/resource_coordinator/public/mojom/signals.mojom";
// Any new type here needs to be mirrored between coordination_unit_types.h and // Any new type here needs to be mirrored between coordination_unit_types.h and
// coordination_unit.mojom, and have mappings between the two defined in // coordination_unit.mojom, and have mappings between the two defined in
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
module resource_coordinator.mojom; module resource_coordinator.mojom;
import "coordination_unit.mojom"; import "services/resource_coordinator/public/mojom/coordination_unit.mojom";
import "mojo/common/process_id.mojom"; import "mojo/common/process_id.mojom";
import "mojo/common/time.mojom"; import "mojo/common/time.mojom";
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
module resource_coordinator.mojom; module resource_coordinator.mojom;
import "coordination_unit.mojom"; import "services/resource_coordinator/public/mojom/coordination_unit.mojom";
interface CoordinationUnitProvider { interface CoordinationUnitProvider {
CreateFrameCoordinationUnit(FrameCoordinationUnit& request, CoordinationUnitID id); CreateFrameCoordinationUnit(FrameCoordinationUnit& request, CoordinationUnitID id);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
module resource_coordinator.mojom; module resource_coordinator.mojom;
import "coordination_unit.mojom"; import "services/resource_coordinator/public/mojom/coordination_unit.mojom";
import "mojo/common/time.mojom"; import "mojo/common/time.mojom";
// A PageSignalReceiver implementation receives page-scoped signal from // A PageSignalReceiver implementation receives page-scoped signal from
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
module shape_detection.mojom; module shape_detection.mojom;
import "facedetection.mojom"; import "services/shape_detection/public/mojom/facedetection.mojom";
interface FaceDetectionProvider { interface FaceDetectionProvider {
CreateFaceDetection(FaceDetection& request, FaceDetectorOptions options); CreateFaceDetection(FaceDetection& request, FaceDetectorOptions options);
......
...@@ -16,6 +16,7 @@ mojom("ime") { ...@@ -16,6 +16,7 @@ mojom("ime") {
public_deps = [ public_deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//ui/events/mojo:interfaces", "//ui/events/mojo:interfaces",
"//ui/gfx/geometry/mojo", "//ui/gfx/geometry/mojo",
"//ui/gfx/range/mojo", "//ui/gfx/range/mojo",
......
...@@ -11,6 +11,7 @@ mojom("interfaces") { ...@@ -11,6 +11,7 @@ mojom("interfaces") {
public_deps = [ public_deps = [
"//components/discardable_memory/public/interfaces", "//components/discardable_memory/public/interfaces",
"//mojo/common:common_custom_types",
"//services/viz/privileged/interfaces/compositing", "//services/viz/privileged/interfaces/compositing",
"//services/viz/privileged/interfaces/gl", "//services/viz/privileged/interfaces/gl",
"//services/viz/public/interfaces", "//services/viz/public/interfaces",
......
...@@ -788,6 +788,7 @@ mojom("mojo_bindings") { ...@@ -788,6 +788,7 @@ mojom("mojo_bindings") {
"//components/payments/mojom", "//components/payments/mojom",
"//device/bluetooth/public/mojom", "//device/bluetooth/public/mojom",
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//services/device/public/mojom", "//services/device/public/mojom",
"//services/network/public/mojom", "//services/network/public/mojom",
"//services/service_manager/public/mojom", "//services/service_manager/public/mojom",
...@@ -835,6 +836,7 @@ mojom("android_mojo_bindings") { ...@@ -835,6 +836,7 @@ mojom("android_mojo_bindings") {
public_deps = [ public_deps = [
"//components/payments/mojom", "//components/payments/mojom",
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//ui/gfx/geometry/mojo", "//ui/gfx/geometry/mojo",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
] ]
......
...@@ -37,6 +37,7 @@ mojom("mojom_platform") { ...@@ -37,6 +37,7 @@ mojom("mojom_platform") {
public_deps = [ public_deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//services/network/public/mojom", "//services/network/public/mojom",
"//ui/gfx/geometry/mojo", "//ui/gfx/geometry/mojo",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
[JavaPackage="org.chromium.installedapp.mojom"] [JavaPackage="org.chromium.installedapp.mojom"]
module blink.mojom; module blink.mojom;
import "related_application.mojom"; import "third_party/WebKit/public/platform/modules/installedapp/related_application.mojom";
// Mojo service for the getInstalledRelatedApps implementation. // Mojo service for the getInstalledRelatedApps implementation.
interface InstalledAppProvider { interface InstalledAppProvider {
......
...@@ -12,6 +12,7 @@ mojom("mojo") { ...@@ -12,6 +12,7 @@ mojom("mojo") {
public_deps = [ public_deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
"//ui/gfx/image/mojo:interfaces", "//ui/gfx/image/mojo:interfaces",
"//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_gurl",
] ]
......
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