Commit 788bfe32 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

Revert "Don't build js2gtest()s in win/cross builds."

This reverts commit 3a54e6fa.

Reason for revert: Possibly no longer needed after
#703693 disabled g2gtest()s in cross builds in a different way.

Original change's description:
> Don't build js2gtest()s in win/cross builds.
> 
> Bug: 1010561
> Change-Id: Ic6b0d656af1944d9dbb16f5fb96d70fe1ad90f14
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1835157
> Auto-Submit: Nico Weber <thakis@chromium.org>
> Commit-Queue: Dan Beam <dbeam@chromium.org>
> Reviewed-by: Dan Beam <dbeam@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#702156}

TBR=thakis@chromium.org,dbeam@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1010561
Change-Id: I7b8fd3399786da5d51b827b846d2b03c72efb337
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1851085
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704472}
parent e8c18c76
......@@ -19,144 +19,134 @@ import("//v8/gni/v8.gni")
# defines
# deps
# visibility
if (is_win && host_os != "win") {
# Running v8_shell for the host doesn't work in cross builds,
# https://crbug.com/1010561
template("js2gtest") {
not_needed(invoker, "*")
group(target_name) {
}
template("js2gtest") {
assert(defined(invoker.test_type) &&
(invoker.test_type == "webui" || invoker.test_type == "unit" ||
invoker.test_type == "extension" ||
invoker.test_type == "mojo_lite_webui"))
action_name = target_name + "_action"
source_set_name = target_name
# The mapping from sources to the copied version.
copied_source_pattern = "$root_out_dir/test_data/{{source_root_relative_dir}}/{{source_file_part}}"
gen_source_pattern = "{{source_gen_dir}}/{{source_name_part}}-gen.cc"
data = []
if (defined(invoker.data)) {
data += invoker.data
}
} else {
template("js2gtest") {
assert(defined(invoker.test_type) &&
(invoker.test_type == "webui" || invoker.test_type == "unit" ||
invoker.test_type == "extension" ||
invoker.test_type == "mojo_lite_webui"))
action_name = target_name + "_action"
source_set_name = target_name
# The mapping from sources to the copied version.
copied_source_pattern = "$root_out_dir/test_data/{{source_root_relative_dir}}/{{source_file_part}}"
gen_source_pattern = "{{source_gen_dir}}/{{source_name_part}}-gen.cc"
data = []
if (defined(invoker.data)) {
data += invoker.data
}
action_foreach(action_name) {
testonly = true
visibility = [ ":$source_set_name" ]
script = "//tools/gypv8sh.py"
action_foreach(action_name) {
testonly = true
visibility = [ ":$source_set_name" ]
script = "//tools/gypv8sh.py"
sources = invoker.sources
sources = invoker.sources
v8_shell_path = get_label_info("//v8:v8_shell($v8_snapshot_toolchain)",
"root_out_dir") + "/v8_shell"
if (host_os == "win") {
v8_shell_path += ".exe"
}
v8_shell_path = get_label_info("//v8:v8_shell($v8_snapshot_toolchain)",
"root_out_dir") + "/v8_shell"
if (host_os == "win") {
v8_shell_path += ".exe"
}
input_js = [
"//chrome/third_party/mock4js/mock4js.js",
"//chrome/test/data/webui/test_api.js",
"//chrome/test/base/js2gtest.js",
]
inputs = [ v8_shell_path ] + input_js
if (defined(invoker.deps_js)) {
inputs += [ invoker.deps_js ]
}
if (defined(invoker.gen_include_files)) {
inputs += invoker.gen_include_files
}
# Outputs. The script will copy the source files to the output directory,
# which then must be treated as runtime data. The generated .cc file isn't
# data, it will be compiled in a step below.
outputs = [
copied_source_pattern,
gen_source_pattern,
]
data += process_file_template(sources, [ copied_source_pattern ])
args = []
if (defined(invoker.deps_js)) {
args += [
"--deps_js",
rebase_path(invoker.deps_js, root_build_dir),
]
}
args += [
# Need "./" for script to find binary (cur dir is not on path).
"./" + rebase_path(v8_shell_path, root_build_dir),
]
args += rebase_path(input_js, root_build_dir) + [ invoker.test_type ]
if (v8_use_external_startup_data) {
args += [ "--external=y" ]
} else {
args += [ "--external=n" ]
}
input_js = [
"//chrome/third_party/mock4js/mock4js.js",
"//chrome/test/data/webui/test_api.js",
"//chrome/test/base/js2gtest.js",
]
inputs = [ v8_shell_path ] + input_js
if (defined(invoker.deps_js)) {
inputs += [ invoker.deps_js ]
}
if (defined(invoker.gen_include_files)) {
inputs += invoker.gen_include_files
}
# Outputs. The script will copy the source files to the output directory,
# which then must be treated as runtime data. The generated .cc file isn't
# data, it will be compiled in a step below.
outputs = [
copied_source_pattern,
gen_source_pattern,
]
data += process_file_template(sources, [ copied_source_pattern ])
args = []
if (defined(invoker.deps_js)) {
args += [
"{{source}}",
rebase_path("//", root_build_dir), # Path to source root.
gen_source_pattern,
rebase_path(copied_source_pattern, root_build_dir),
"--deps_js",
rebase_path(invoker.deps_js, root_build_dir),
]
}
args += [
# Need "./" for script to find binary (cur dir is not on path).
"./" + rebase_path(v8_shell_path, root_build_dir),
]
args += rebase_path(input_js, root_build_dir) + [ invoker.test_type ]
if (v8_use_external_startup_data) {
args += [ "--external=y" ]
} else {
args += [ "--external=n" ]
}
args += [
"{{source}}",
rebase_path("//", root_build_dir), # Path to source root.
gen_source_pattern,
rebase_path(copied_source_pattern, root_build_dir),
]
deps = [
"//v8:v8_shell($v8_snapshot_toolchain)",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
}
deps = [
"//v8:v8_shell($v8_snapshot_toolchain)",
if (defined(invoker.extra_js_files)) {
copy_target_name = target_name + "_copy"
copy(copy_target_name) {
visibility = [ ":$source_set_name" ]
sources = invoker.extra_js_files
outputs = [
copied_source_pattern,
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
}
}
if (defined(invoker.extra_js_files)) {
copy_target_name = target_name + "_copy"
copy(copy_target_name) {
visibility = [ ":$source_set_name" ]
sources = invoker.extra_js_files
outputs = [
copied_source_pattern,
]
}
source_set(source_set_name) {
testonly = true
forward_variables_from(invoker,
[
"defines",
"visibility",
])
sources = process_file_template(invoker.sources, [ gen_source_pattern ])
# This empty public header is intentional to remove unnecessary build
# dependency.
public = []
deps = [
":$action_name",
# The generator implicitly makes includes from these targets.
"//chrome/test:test_support",
"//testing/gmock",
"//testing/gtest",
"//url",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
source_set(source_set_name) {
testonly = true
forward_variables_from(invoker,
[
"defines",
"visibility",
])
sources = process_file_template(invoker.sources, [ gen_source_pattern ])
# This empty public header is intentional to remove unnecessary build
# dependency.
public = []
deps = [
":$action_name",
# The generator implicitly makes includes from these targets.
"//chrome/test:test_support",
"//testing/gmock",
"//testing/gtest",
"//url",
if (defined(invoker.gen_include_files)) {
data += invoker.gen_include_files
}
if (defined(invoker.extra_js_files)) {
data_deps = [
":$copy_target_name",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (defined(invoker.gen_include_files)) {
data += invoker.gen_include_files
}
if (defined(invoker.extra_js_files)) {
data_deps = [
":$copy_target_name",
]
}
}
}
}
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