Commit 5ea8c42e authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

Document interdependencies under ui/file_manager/file_manager.

The ChromeOS Gallery, video_player, and audio_player currently pick out
a collection of .js files from various places inside the folder structure
of the ChromeOS files App.

This CL documents where that occurs, with a view to move these, shared
files out to a shared "toolkit" folder higher up in the folder structure.
There is already a "common" folder, but it is within the Files app
subtree and hard to enforce via layering.

It uses GN's "visibility" on the closure targets to detect whether new
dependencies are added.

Bug: 879035
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I6b134ccad20c22ad46372871ab488200d3cbafa1
Reviewed-on: https://chromium-review.googlesource.com/1188735
Commit-Queue: Trent Apted <tapted@chromium.org>
Reviewed-by: default avatarcalamity <calamity@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590186}
parent 3f6b636c
...@@ -22,3 +22,4 @@ Local modifications: ...@@ -22,3 +22,4 @@ Local modifications:
- Fix bug in js_binary.py causing it to drop externs. - Fix bug in js_binary.py causing it to drop externs.
- Cache dependency subtrees in js_binary.py for a huge performance boost. - Cache dependency subtrees in js_binary.py for a huge performance boost.
- Add js_unit_tests.gni for generating .html files for running unit tests. - Add js_unit_tests.gni for generating .html files for running unit tests.
- Forward target visibility in the js_library template.
...@@ -53,6 +53,7 @@ template("js_library") { ...@@ -53,6 +53,7 @@ template("js_library") {
"externs_list", "externs_list",
"extra_sources", "extra_sources",
"extra_deps", "extra_deps",
"visibility",
]) ])
output_file = "$target_gen_dir/$target_name.js_library" output_file = "$target_gen_dir/$target_name.js_library"
outputs = [ outputs = [
......
...@@ -4,6 +4,22 @@ ...@@ -4,6 +4,22 @@
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
# TODO(tapted): This folder should be restricted to file_manager, but related
# apps currently depend on background_base, which depends on
# volume_manager_factory, and that pulls in nearly everything else. For now,
# document externally-exposed targets visible with this helper, and hide
# transitive dependencies (but note those transitive dependencies should move
# elsewhere too).
related_apps = [
"//ui/file_manager/audio_player/*",
"//ui/file_manager/file_manager/*",
"//ui/file_manager/gallery/*",
"//ui/file_manager/video_player/*",
]
# Default to private.
visibility = [ ":*" ]
js_type_check("closure_compile") { js_type_check("closure_compile") {
deps = [ deps = [
":app_window_wrapper", ":app_window_wrapper",
...@@ -60,6 +76,7 @@ js_library("closure_compile_externs") { ...@@ -60,6 +76,7 @@ js_library("closure_compile_externs") {
} }
js_library("app_window_wrapper") { js_library("app_window_wrapper") {
visibility += related_apps
deps = [ deps = [
":app_windows", ":app_windows",
"../../common/js:async_util", "../../common/js:async_util",
...@@ -92,6 +109,7 @@ js_library("background") { ...@@ -92,6 +109,7 @@ js_library("background") {
} }
js_library("background_base") { js_library("background_base") {
visibility += related_apps
deps = [ deps = [
":app_windows", ":app_windows",
":volume_manager_factory", ":volume_manager_factory",
...@@ -209,6 +227,7 @@ js_library("media_scanner") { ...@@ -209,6 +227,7 @@ js_library("media_scanner") {
} }
js_library("mock_volume_manager") { js_library("mock_volume_manager") {
visibility += related_apps
deps = [ deps = [
":volume_info_impl", ":volume_info_impl",
":volume_info_list_impl", ":volume_info_list_impl",
...@@ -234,6 +253,12 @@ js_library("task_queue") { ...@@ -234,6 +253,12 @@ js_library("task_queue") {
} }
js_library("test_util_base") { js_library("test_util_base") {
# TODO(tapted): Move this target to //ui/file_manager/base. It is used in the
# background page of all |related_apps|, but accessed via extension messaging.
# So it doesn't need to be visible as a closure dependency, except for the
# "unpacked" test framework.
visibility += [ "//ui/file_manager/file_manager/test/js:test_util" ]
deps = [ deps = [
":app_windows", ":app_windows",
"../../common/js:error_util", "../../common/js:error_util",
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
# TODO(tapted): This entire folder should move to //ui/file_manager/base.
visibility = [ "//ui/file_manager/*" ]
js_type_check("closure_compile") { js_type_check("closure_compile") {
deps = [ deps = [
":async_util", ":async_util",
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
visibility = [ "//ui/file_manager/file_manager/foreground/*" ]
js_type_check("closure_compile") { js_type_check("closure_compile") {
deps = [ deps = [
":files_icon_button", ":files_icon_button",
...@@ -51,12 +53,18 @@ js_library("files_safe_media") { ...@@ -51,12 +53,18 @@ js_library("files_safe_media") {
js_library("files_safe_media_webview_content") { js_library("files_safe_media_webview_content") {
} }
# TODO(tapted): Move this to //ui/file_manager/base.
js_library("files_toast") { js_library("files_toast") {
visibility += [ "//ui/file_manager/gallery/*" ]
externs_list = [ "$externs_path/web_animations.js" ] externs_list = [ "$externs_path/web_animations.js" ]
} }
# TODO(tapted): Move this to //ui/file_manager/base.
js_library("files_toggle_ripple") { js_library("files_toggle_ripple") {
visibility += [ "//ui/file_manager/gallery/*" ]
} }
# TODO(tapted): Move this to //ui/file_manager/base.
js_library("files_tooltip") { js_library("files_tooltip") {
visibility += [ "//ui/file_manager/gallery/*" ]
} }
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
import("//third_party/closure_compiler/js_unit_tests.gni") import("//third_party/closure_compiler/js_unit_tests.gni")
visibility = [
"//ui/file_manager/file_manager/foreground/*",
"//ui/file_manager/file_manager/test/js/*",
]
js_type_check("closure_compile_module") { js_type_check("closure_compile_module") {
deps = [ deps = [
":actions_controller", ":actions_controller",
...@@ -578,7 +583,9 @@ js_library("task_history") { ...@@ -578,7 +583,9 @@ js_library("task_history") {
] ]
} }
# TODO(tapted): Move this into //ui/file_manager/base.
js_library("thumbnail_loader") { js_library("thumbnail_loader") {
visibility += [ "//ui/file_manager/gallery/*" ]
deps = [ deps = [
"../../../image_loader:image_loader_client", "../../../image_loader:image_loader_client",
"../../common/js:file_type", "../../common/js:file_type",
...@@ -606,7 +613,13 @@ js_library("toolbar_controller") { ...@@ -606,7 +613,13 @@ js_library("toolbar_controller") {
] ]
} }
# TODO(tapted): Move this to //ui/file_manager/base.
js_library("volume_manager_wrapper") { js_library("volume_manager_wrapper") {
visibility += [
"//ui/file_manager/audio_player/*",
"//ui/file_manager/gallery/*",
"//ui/file_manager/video_player/*",
]
deps = [ deps = [
"../../../externs:file_manager_private", "../../../externs:file_manager_private",
"../../common/js:async_util", "../../common/js:async_util",
...@@ -643,6 +656,7 @@ js_unit_tests("unit_tests") { ...@@ -643,6 +656,7 @@ js_unit_tests("unit_tests") {
} }
group("closure_compile") { group("closure_compile") {
visibility += [ "*" ]
deps = [ deps = [
":closure_compile_module", ":closure_compile_module",
":unit_tests_type_check", ":unit_tests_type_check",
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
# TODO(tapted): This entire folder should move to //ui/file_manager/base.
visibility = [ "//ui/file_manager/*" ]
js_type_check("closure_compile") { js_type_check("closure_compile") {
deps = [ deps = [
":byte_reader", ":byte_reader",
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
visibility = [ "//ui/file_manager/file_manager/foreground/*" ]
js_type_check("closure_compile") { js_type_check("closure_compile") {
deps = [ deps = [
":actions_submenu", ":actions_submenu",
...@@ -261,13 +263,17 @@ js_library("file_tap_handler") { ...@@ -261,13 +263,17 @@ js_library("file_tap_handler") {
] ]
} }
# TODO(tapted): Move this into //ui/file_manager/base.
js_library("files_alert_dialog") { js_library("files_alert_dialog") {
visibility += [ "//ui/file_manager/gallery/*" ]
deps = [ deps = [
"//ui/webui/resources/js/cr/ui:dialogs", "//ui/webui/resources/js/cr/ui:dialogs",
] ]
} }
# TODO(tapted): Move this into //ui/file_manager/base.
js_library("files_confirm_dialog") { js_library("files_confirm_dialog") {
visibility += [ "//ui/file_manager/gallery/*" ]
deps = [ deps = [
"//ui/webui/resources/js/cr/ui:dialogs", "//ui/webui/resources/js/cr/ui:dialogs",
] ]
...@@ -319,6 +325,9 @@ js_library("multi_profile_share_dialog") { ...@@ -319,6 +325,9 @@ js_library("multi_profile_share_dialog") {
} }
js_library("progress_center_panel") { js_library("progress_center_panel") {
# The progress_center on the background page maintains a list of panels.
visibility += [ "//ui/file_manager/file_manager/background/*" ]
deps = [ deps = [
"..:progress_center_item_group", "..:progress_center_item_group",
"../../../common/js:progress_center_common", "../../../common/js:progress_center_common",
...@@ -349,7 +358,9 @@ js_library("search_box") { ...@@ -349,7 +358,9 @@ js_library("search_box") {
] ]
} }
# TODO(tapted): Move this into //ui/file_manager/base.
js_library("share_dialog") { js_library("share_dialog") {
visibility += [ "//ui/file_manager/gallery/*" ]
deps = [ deps = [
":file_manager_dialog_base", ":file_manager_dialog_base",
"..:share_client", "..:share_client",
......
...@@ -45,6 +45,9 @@ js_type_check("closure_compile") { ...@@ -45,6 +45,9 @@ js_type_check("closure_compile") {
] ]
} }
# Remaining targets in this file are private.
visibility = [ ":*" ]
js_library("closure_compile_externs") { js_library("closure_compile_externs") {
sources = [] sources = []
externs_list = [ externs_list = [
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
visibility = [ "//ui/file_manager/file_manager/*" ]
js_library("chrome_api_test_impl") { js_library("chrome_api_test_impl") {
} }
......
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