Skip to content

Commit

Permalink
Fix missing GN dependencies.
Browse files Browse the repository at this point in the history
Fixes some cases where a dependency between a target's inputs and outputs exists without an explicit dependency.

json_schema_api.gni was generating wrong names, this was fixed.

mojo_application_package.gni was fixed to generate unique names (just a bug I noticed in passing) and support the testonly flag, which is necessary when I added the correct dependency.

The rest of the cases are just adding deps or making existing deps public so that the ability to depend on the target's outputs is passed to dependents.

BUG=487897

Review URL: https://codereview.chromium.org/1128163007

Cr-Commit-Position: refs/heads/master@{#330636}
  • Loading branch information
brettw authored and Commit bot committed May 19, 2015
1 parent 16895a0 commit eadea21
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 17 deletions.
10 changes: 6 additions & 4 deletions build/json_schema_api.gni
Original file line number Diff line number Diff line change
Expand Up @@ -154,23 +154,25 @@ template("json_schema_api") {

assert(defined(invoker.impl_dir),
"\"impl_dir\" must be defined for the $target_name template.")
impl_dir = invoker.impl_dir

# Child directory inside the generated file tree.
gen_child_dir = rebase_path(invoker.impl_dir, "//")

bundle_generator_registration_name =
target_name + "_bundle_generator_registration"
action(bundle_generator_registration_name) {
script = compiler_script
inputs = compiler_sources + invoker.sources + uncompiled_sources
outputs = [
"$root_gen_dir/$impl_dir/generated_api_registration.cc",
"$root_gen_dir/$impl_dir/generated_api_registration.h",
"$root_gen_dir/$gen_child_dir/generated_api_registration.cc",
"$root_gen_dir/$gen_child_dir/generated_api_registration.h",
]
args = [
"--root=" + rebase_path("//", root_build_dir),
"--destdir=" + rebase_path(root_gen_dir, root_build_dir),
"--namespace=$root_namespace",
"--generator=cpp-bundle-registration",
"--impl-dir=" + rebase_path(impl_dir, "//"),
"--impl-dir=$gen_child_dir",
"--include-rules=$schema_include_rules",
] + rebase_path(invoker.sources, root_build_dir) +
rebase_path(uncompiled_sources, root_build_dir)
Expand Down
8 changes: 5 additions & 3 deletions build/secondary/tools/grit/grit_rule.gni
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,11 @@ template("grit") {
# depend on us.
sources = grit_outputs

# Deps set on the template invocation will go on the grit script running
# target rather than this library.
deps = [
# Deps set on the template invocation will go on the action that runs
# grit above rather than this library. This target needs to depend on the
# action publicly so other scripts can take the outputs from the grit
# script as inputs.
public_deps = [
":$grit_custom_target",
]
public_configs = [ ":$grit_config" ]
Expand Down
21 changes: 19 additions & 2 deletions chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,11 @@ repack("packed_extra_resources") {
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
]
deps += [
"//content:resources",
"//content/browser/tracing:resources",
"//third_party/WebKit/public:resources",
]
}
if (is_chromeos) {
sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
Expand All @@ -548,7 +553,10 @@ repack("packed_extra_resources") {
"$root_gen_dir/extensions/extensions_renderer_resources.pak",
"$root_gen_dir/extensions/extensions_resources.pak",
]
deps += [ "//chrome/common:extensions_api_resources" ]
deps += [
"//chrome/common:extensions_api_resources",
"//extensions:extensions_resources",
]
}

# GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
Expand All @@ -567,6 +575,9 @@ repack("browser_tests_pak") {
"$root_gen_dir/chrome/options_test_resources.pak",
]
output = "$root_out_dir/browser_tests.pak"
deps = [
"//chrome/browser/resources:options_test_resources",
]
}

# Collects per-locale grit files from many sources into global per-locale files.
Expand Down Expand Up @@ -629,16 +640,21 @@ template("chrome_repack_percent") {
deps = [
"//chrome/app/theme:theme_resources",
"//chrome/renderer:resources",
"//components/resources",
"//components/strings",
"//net:net_resources",
"//ui/resources",
]

if (!is_ios) {
sources += [
"$root_gen_dir/blink/public/resources/blink_image_resources_${percent}_percent.pak",
"$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
]
deps += [ "//content:resources" ]
deps += [
"//content/app/resources",
"//third_party/WebKit/public:image_resources",
]
}
if (use_ash) {
sources +=
Expand All @@ -651,6 +667,7 @@ template("chrome_repack_percent") {
}
if (enable_extensions) {
sources += [ "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak" ]
deps += [ "//extensions:extensions_browser_resources" ]
}

output = repack_output_file
Expand Down
3 changes: 3 additions & 0 deletions chrome/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ action("make_generated_resources_map") {
# specifying it manually. This doesn't happen in the GYP build.
source_set("generated_resources_map") {
sources = get_target_outputs(":make_generated_resources_map")
deps = [
":make_generated_resources_map",
]
}

# GYP version: chrome/chrome_resources.gyp:chrome_strings
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ grit("resources") {
deps = [
":about_credits",
":chrome_internal_resources_gen",
"//chrome/browser/ui/webui/omnibox:mojo_bindings",
]
inputs = [
omnibox_mojom_file,
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ui/libgtk2ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ component("libgtk2ui") {
"//chrome:strings",
"//components/resources",
"//content/public/browser",
"//mojo/environment:chromium",
"//printing",
"//skia",
"//third_party/mojo/src/mojo/edk/system",
Expand Down
1 change: 1 addition & 0 deletions chrome/test/chromedriver/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ source_set("automation_client_lib") {
sources += get_target_outputs(":embed_user_data_dir_in_cpp")

deps = [
":embed_extension_in_cpp",
":embed_js_in_cpp",
":embed_user_data_dir_in_cpp",
"//base",
Expand Down
1 change: 1 addition & 0 deletions components/html_viewer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ mojo_application_package("html_viewer") {
"$root_build_dir/natives_blob.bin",
"$root_build_dir/snapshot_blob.bin",
]
deps += [ "//gin" ]
}
}

Expand Down
1 change: 1 addition & 0 deletions extensions/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ repack("shell_and_test_pak") {
deps = [
":extensions_resources",
"//content:resources",
"//content/app/strings",
"//content/browser/devtools:devtools_resources",
"//content/shell:resources",
"//extensions/shell:resources",
Expand Down
10 changes: 6 additions & 4 deletions gin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,8 @@ component("gin") {
"//base/third_party/dynamic_annotations",
]
if (v8_use_external_startup_data && is_win) {
deps += [
":gin_v8_snapshot_fingerprint",
"//crypto:crypto",
]
public_deps += [ ":gin_v8_snapshot_fingerprint" ]
deps += [ "//crypto:crypto" ]
sources += [ "$target_gen_dir/v8_snapshot_fingerprint.cc" ]
defines += [ "V8_VERIFY_EXTERNAL_STARTUP_DATA" ]
}
Expand Down Expand Up @@ -108,6 +106,10 @@ if (v8_use_external_startup_data) {
outputs = [
output_file,
]

deps = [
"//v8",
]
}
}

Expand Down
9 changes: 7 additions & 2 deletions mojo/mojo_application_package.gni
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@ template("mojo_application_package") {
output_name = invoker.output_name
}

copy("copy_mojo_application_resources") {
copy_step_name = "${target_name}__copy_resources"
copy(copy_step_name) {
sources = invoker.resources
outputs = [
"$root_out_dir/$output_name/resources/{{source_file_part}}",
]
if (defined(invoker.testonly)) {
testonly = invoker.testonly
}
deps = mojo_deps
}
mojo_deps += [ ":copy_mojo_application_resources" ]
mojo_deps += [ ":$copy_step_name" ]
}

mojo_native_application(target_name) {
Expand Down
4 changes: 2 additions & 2 deletions ui/resources/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ if (!is_mac) {
# (copy_ui_test_pak action)
if (is_ios || is_mac) {
group("ui_test_pak") {
deps = [
public_deps = [
":repack_ui_test_pak",
":repack_ui_test_mac_locale_pack",
]
Expand All @@ -90,7 +90,7 @@ if (is_ios || is_mac) {
outputs = [
"$root_out_dir/ui/en-US.pak",
]
deps = [
public_deps = [
":repack_ui_test_pak",
]
}
Expand Down

0 comments on commit eadea21

Please sign in to comment.