Skip to content

Commit

Permalink
Reduce absolute paths in generated ninja files
Browse files Browse the repository at this point in the history
After this change, the number of steps required for rebuilding all
after snapshot and "gn gen" is reduced to 711 (Linux Release build).

BUG=723856

Review-Url: https://codereview.chromium.org/2905523002
Cr-Commit-Position: refs/heads/master@{#475458}
  • Loading branch information
wychen authored and Commit Bot committed May 30, 2017
1 parent 6761834 commit 5e1f725
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 39 deletions.
18 changes: 11 additions & 7 deletions build/config/nacl/rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ template("generate_nmf") {
# Starts empty so the code below can use += everywhere.
data = []

nmfflags += [ "--library-path=" + rebase_path(root_out_dir) ]
nmfflags +=
[ "--library-path=" + rebase_path(root_out_dir, root_build_dir) ]

# NOTE: There is no explicit dependency for the lib directory
# (lib32 and lib64 for x86/x64) created in the product directory.
# They are created as a side-effect of nmf creation.
if (current_cpu != "x86" && current_cpu != "x64") {
nmfflags +=
[ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ]
[ "--library-path=" +
rebase_path("${nacl_toolchain_tooldir}/lib", root_build_dir) ]
if (current_cpu == "arm") {
data += [ "${lib_path}/libarm/" ]
} else {
Expand All @@ -90,8 +92,9 @@ template("generate_nmf") {
} else {
# For x86-32, the lib/ directory is called lib32/ instead.
if (current_cpu == "x86") {
nmfflags += [ "--library-path=" +
rebase_path("${nacl_toolchain_tooldir}/lib32") ]
nmfflags +=
[ "--library-path=" +
rebase_path("${nacl_toolchain_tooldir}/lib32", root_build_dir) ]
data += [ "${lib_path}/lib32/" ]
}

Expand All @@ -112,16 +115,17 @@ template("generate_nmf") {
"root_out_dir")
}
nmfflags += [
"--library-path=" + rebase_path(x64_out_dir),
"--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib"),
"--library-path=" + rebase_path(x64_out_dir, root_build_dir),
"--library-path=" +
rebase_path("${nacl_toolchain_tooldir}/lib", root_build_dir),
]
data += [ "${lib_path}/lib64/" ]
}
}
}
args = [
"--no-default-libpath",
"--objdump=" + objdump,
"--objdump=" + rebase_path(objdump, root_build_dir),
"--output=" + rebase_path(nmf, root_build_dir),
] + nmfflags + rebase_path(sources, root_build_dir)
if (is_nacl_glibc && current_cpu == "arm") {
Expand Down
3 changes: 2 additions & 1 deletion build/toolchain/gcc_toolchain.gni
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ template("gcc_toolchain") {
# This needs a Python script to avoid using a complex shell command
# requiring sh control structures, pipelines, and POSIX utilities.
# The host might not have a POSIX shell and utilities (e.g. Windows).
solink_wrapper = rebase_path("//build/toolchain/gcc_solink_wrapper.py")
solink_wrapper =
rebase_path("//build/toolchain/gcc_solink_wrapper.py", root_build_dir)
command = "$python_path \"$solink_wrapper\" --readelf=\"$readelf\" --nm=\"$nm\" $strip_switch--sofile=\"$unstripped_sofile\" --tocfile=\"$tocfile\"$map_switch --output=\"$sofile\"$whitelist_flag -- $link_command"

rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix"
Expand Down
2 changes: 1 addition & 1 deletion chrome/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ grit("resources") {
]
grit_flags = [
"-E",
"mojom_root=" + rebase_path(root_gen_dir),
"mojom_root=" + rebase_path(root_gen_dir, root_build_dir),
]
deps = [
"//chrome/common/media_router/mojo:media_controller__generator",
Expand Down
4 changes: 2 additions & 2 deletions extensions/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ grit("extensions_browser_resources") {
]
grit_flags = [
"-E",
"mojom_root=" + rebase_path(root_gen_dir),
"mojom_root=" + rebase_path(root_gen_dir, root_build_dir),
]
}

Expand All @@ -47,7 +47,7 @@ grit("extensions_renderer_resources") {
]
grit_flags = [
"-E",
"mojom_root=" + rebase_path(root_gen_dir),
"mojom_root=" + rebase_path(root_gen_dir, root_build_dir),
]

deps = [
Expand Down
8 changes: 4 additions & 4 deletions headless/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ action("embed_resources") {

args = [
"--data_file",
rebase_path("$root_out_dir/headless_lib.pak"),
rebase_path("$root_out_dir/headless_lib.pak", root_build_dir),
"--gendir",
rebase_path("$root_gen_dir"),
rebase_path("$root_gen_dir", root_build_dir),
"--header_file",
"headless/embedded_resource_pak.h",
"--source_file",
Expand Down Expand Up @@ -119,7 +119,7 @@ grit("resources") {
]
grit_flags = [
"-E",
"mojom_root=" + rebase_path(root_gen_dir),
"mojom_root=" + rebase_path(root_gen_dir, root_build_dir),
]
deps = [
":tab_socket__generator",
Expand Down Expand Up @@ -197,7 +197,7 @@ action("gen_devtools_client_api") {
"--protocol",
rebase_path(inputs[0], root_build_dir),
"--output_dir",
rebase_path(target_gen_dir) + "/public",
rebase_path(target_gen_dir, root_build_dir) + "/public",
]
}

Expand Down
4 changes: 2 additions & 2 deletions mojo/public/js/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ action("new_bindings") {
compiled_file,
]

args = rebase_path(new_bindings_js_files)
args += [ rebase_path(compiled_file) ]
args = rebase_path(new_bindings_js_files, root_build_dir)
args += [ rebase_path(compiled_file, root_build_dir) ]

deps = [
"//mojo/public/interfaces/bindings:new_bindings__generator",
Expand Down
2 changes: 1 addition & 1 deletion mojo/public/tools/bindings/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ action("precompile_templates") {
"--use_bundled_pylibs",
"precompile",
"-o",
rebase_path(target_gen_dir),
rebase_path(target_gen_dir, root_build_dir),
]
}
8 changes: 4 additions & 4 deletions mojo/public/tools/bindings/mojom.gni
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ template("mojom") {
"-I",
rebase_path("//", root_build_dir),
"-o",
rebase_path(root_gen_dir),
rebase_path(root_gen_dir, root_build_dir),
"--bytecode_path",
rebase_path("$root_gen_dir/mojo/public/tools/bindings"),
rebase_path("$root_gen_dir/mojo/public/tools/bindings", root_build_dir),
]

if (defined(invoker.import_dirs)) {
Expand Down Expand Up @@ -378,7 +378,7 @@ template("mojom") {
"--impl_macro",
shared_component_impl_macro,
"--output_file",
generated_shared_export_header,
rebase_path(generated_shared_export_header, root_build_dir),
"--relative_path",
rebase_path(generated_shared_export_header, root_gen_dir),
]
Expand Down Expand Up @@ -532,7 +532,7 @@ template("mojom") {
"--impl_macro",
"${invoker.component_macro_prefix}${bindings_configuration.component_macro_suffix}_IMPL",
"--output_file",
generated_export_header,
rebase_path(generated_export_header, root_build_dir),
"--relative_path",
rebase_path(generated_export_header, root_gen_dir),
]
Expand Down
8 changes: 4 additions & 4 deletions ppapi/native_client/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ if (is_nacl) {

script = "irt_debuglink.py"
args = [
rebase_path(objcopy),
rebase_path(irt_debug),
rebase_path(irt_stripped),
rebase_path(irt_final),
rebase_path(objcopy, root_build_dir),
rebase_path(irt_debug, root_build_dir),
rebase_path(irt_stripped, root_build_dir),
rebase_path(irt_final, root_build_dir),
]
}
}
Expand Down
3 changes: 2 additions & 1 deletion ppapi/native_client/nacl_test_data.gni
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ template("nacl_test_data") {
"-arch",
arch,
"-Wl,-L" +
rebase_path(get_label_info(pnacl_irt_shim, "target_out_dir")),
rebase_path(get_label_info(pnacl_irt_shim, "target_out_dir"),
root_build_dir),
]
deps = [
":$nexe_target_name(//build/toolchain/nacl:newlib_pnacl)",
Expand Down
4 changes: 2 additions & 2 deletions remoting/host/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ if (enable_remoting_host) {
"--define",
"IT2ME_HOST_PATH=$it2me_host_path",
"--variables",
rebase_path(branding_path),
rebase_path(branding_path, root_build_dir),
"--template",
"{{source}}",
"--output",
Expand All @@ -649,7 +649,7 @@ if (enable_remoting_host) {
"--locale_dir",
rebase_path(webapp_locale_dir, root_build_dir),
"--variables",
rebase_path(branding_path),
rebase_path(branding_path, root_build_dir),
"--template",
"{{source}}",
"--locale_output",
Expand Down
2 changes: 1 addition & 1 deletion remoting/tools/build/remoting_localize.gni
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ template("remoting_localize") {
foreach(i, invoker.variables) {
args += [
"--variables",
i,
rebase_path(i, root_build_dir),
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion services/catalog/public/tools/catalog.gni
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ template("catalog") {
output_filename,
]

args = [ "--output=" + rebase_path(output_filename) ]
args = [ "--output=" + rebase_path(output_filename, root_build_dir) ]

if (is_debug || dcheck_always_on) {
args += [ "--pretty" ]
Expand Down
11 changes: 6 additions & 5 deletions testing/libfuzzer/fuzzer_test.gni
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ template("fuzzer_test") {

args = [
"--output",
rebase_path(out),
rebase_path(out, root_build_dir),
]

if (defined(invoker.seed_corpus)) {
args += [ rebase_path(invoker.seed_corpus) ]
args += [ rebase_path(invoker.seed_corpus, root_build_dir) ]
}

if (defined(invoker.seed_corpuses)) {
foreach(seed_corpus_path, invoker.seed_corpuses) {
args += [ rebase_path(seed_corpus_path) ]
args += [ rebase_path(seed_corpus_path, root_build_dir) ]
}
}

Expand Down Expand Up @@ -93,13 +93,14 @@ template("fuzzer_test") {
script = "//testing/libfuzzer/gen_fuzzer_config.py"
args = [
"--config",
rebase_path("$root_build_dir/" + config_name),
rebase_path("$root_build_dir/" + config_name, root_build_dir),
]

if (defined(invoker.dict)) {
args += [
"--dict",
rebase_path("$root_build_dir/" + invoker.target_name + ".dict"),
rebase_path("$root_build_dir/" + invoker.target_name + ".dict",
root_build_dir),
]
}

Expand Down
4 changes: 2 additions & 2 deletions tools/generate_library_loader/generate_library_loader.gni
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ template("generate_library_loader") {
"--name",
invoker.name,
"--output-h",
rebase_path(output_h),
rebase_path(output_h, root_build_dir),
"--output-cc",
rebase_path(output_cc),
rebase_path(output_cc, root_build_dir),
"--header",
invoker.header,

Expand Down
3 changes: 2 additions & 1 deletion ui/vector_icons/vector_icons.gni
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ template("aggregate_vector_icons") {
rebase_path(invoker.icons, root_build_dir, invoker.icon_directory)

args = [
"--working_directory=" + rebase_path(invoker.icon_directory),
"--working_directory=" +
rebase_path(invoker.icon_directory, root_build_dir),
"--file_list={{response_file_name}}",
"--output_cc=" + rebase_path(output_cc, root_build_dir),
"--output_h=" + rebase_path(output_h, root_build_dir),
Expand Down

0 comments on commit 5e1f725

Please sign in to comment.