Fix java_cpp_template srcjars having .d files and extra path component
Directories within srcjars are supposed to reflect java package names. The extra path component was making Android Studio unhappy. BUG=620034 Review-Url: https://codereview.chromium.org/2123003002 Cr-Original-Commit-Position: refs/heads/master@{#403897} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: a6e90c933afa77aae92cab39edc89db34cd7455e
This commit is contained in:
Родитель
b0d7c1e69e
Коммит
a0b95815c4
|
@ -365,51 +365,42 @@ if (enable_java_templates) {
|
||||||
set_sources_assignment_filter([])
|
set_sources_assignment_filter([])
|
||||||
forward_variables_from(invoker, [ "testonly" ])
|
forward_variables_from(invoker, [ "testonly" ])
|
||||||
|
|
||||||
assert(defined(invoker.sources))
|
_include_path = "//"
|
||||||
package_name = invoker.package_name + ""
|
|
||||||
|
|
||||||
if (defined(invoker.include_path)) {
|
if (defined(invoker.include_path)) {
|
||||||
include_path = invoker.include_path + ""
|
_include_path = invoker.include_path
|
||||||
} else {
|
|
||||||
include_path = "//"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_gcc_target_name = "${target_name}__apply_gcc"
|
_apply_gcc_target_name = "${target_name}__apply_gcc"
|
||||||
zip_srcjar_target_name = "${target_name}__zip_srcjar"
|
_base_gen_dir = "${target_gen_dir}/${target_name}/java_cpp_template"
|
||||||
final_target_name = target_name
|
|
||||||
|
|
||||||
action_foreach(apply_gcc_target_name) {
|
action_foreach(_apply_gcc_target_name) {
|
||||||
forward_variables_from(invoker,
|
forward_variables_from(invoker,
|
||||||
[
|
[
|
||||||
"deps",
|
"deps",
|
||||||
"public_deps",
|
"public_deps",
|
||||||
"data_deps",
|
"data_deps",
|
||||||
])
|
])
|
||||||
visibility = [ ":$zip_srcjar_target_name" ]
|
|
||||||
script = "//build/android/gyp/gcc_preprocess.py"
|
script = "//build/android/gyp/gcc_preprocess.py"
|
||||||
if (defined(invoker.inputs)) {
|
if (defined(invoker.inputs)) {
|
||||||
inputs = invoker.inputs + []
|
inputs = invoker.inputs + []
|
||||||
}
|
}
|
||||||
depfile = "${target_gen_dir}/${target_name}_{{source_name_part}}.d"
|
depfile =
|
||||||
|
"${target_gen_dir}/${invoker.target_name}_{{source_name_part}}.d"
|
||||||
|
|
||||||
sources = invoker.sources
|
sources = invoker.sources
|
||||||
|
|
||||||
gen_dir =
|
|
||||||
"${target_gen_dir}/${target_name}/java_cpp_template/${package_name}"
|
|
||||||
gcc_template_output_pattern = "${gen_dir}/{{source_name_part}}.java"
|
|
||||||
|
|
||||||
outputs = [
|
outputs = [
|
||||||
depfile,
|
depfile,
|
||||||
gcc_template_output_pattern,
|
"$_base_gen_dir/${invoker.package_name}/{{source_name_part}}.java",
|
||||||
]
|
]
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--depfile",
|
"--depfile",
|
||||||
rebase_path(depfile, root_build_dir),
|
rebase_path(depfile, root_build_dir),
|
||||||
"--include-path",
|
"--include-path",
|
||||||
rebase_path(include_path, root_build_dir),
|
rebase_path(_include_path, root_build_dir),
|
||||||
"--output",
|
"--output",
|
||||||
rebase_path(gen_dir, root_build_dir) + "/{{source_name_part}}.java",
|
rebase_path(outputs[1], root_build_dir),
|
||||||
"--template={{source}}",
|
"--template={{source}}",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -423,24 +414,17 @@ if (enable_java_templates) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_gcc_outputs = get_target_outputs(":$apply_gcc_target_name")
|
# Filter out .d files.
|
||||||
base_gen_dir = get_label_info(":$apply_gcc_target_name", "target_gen_dir")
|
set_sources_assignment_filter([ "*.d" ])
|
||||||
|
sources = get_target_outputs(":$_apply_gcc_target_name")
|
||||||
|
|
||||||
srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
|
zip(target_name) {
|
||||||
zip(zip_srcjar_target_name) {
|
|
||||||
visibility = [ ":$final_target_name" ]
|
|
||||||
inputs = apply_gcc_outputs
|
|
||||||
output = srcjar_path
|
|
||||||
base_dir = base_gen_dir
|
|
||||||
deps = [
|
|
||||||
":$apply_gcc_target_name",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
group(final_target_name) {
|
|
||||||
forward_variables_from(invoker, [ "visibility" ])
|
forward_variables_from(invoker, [ "visibility" ])
|
||||||
public_deps = [
|
inputs = sources
|
||||||
":$zip_srcjar_target_name",
|
output = "${target_gen_dir}/${target_name}.srcjar"
|
||||||
|
base_dir = _base_gen_dir
|
||||||
|
deps = [
|
||||||
|
":$_apply_gcc_target_name",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче