0

Revert "WebUI Mojo Bindings: Remove use_typescript_sources"

This reverts commit 2599dd89d8.

Reason for revert: breaks compile for chromeos dbg
https://ci.chromium.org/ui/p/chromium/builders/try/linux-chromeos-compile-dbg/1632716

FileNotFoundError: [Errno 2] No such file or directory: 'gen/mojom-webui/chrome/test/data/webui/chromeos/web_ui_test.mojom-webui.js'

Original change's description:
> WebUI Mojo Bindings: Remove use_typescript_sources
>
> The use_typescript_sources parameter was confusing to reviewers (not
> clear what "sources" it refers to, or that it is WebUI-specific), and
> is now default true/on which is the reverse of convention and confuses
> developers about when the parameter needs to be specified.
>
> Renaming it to generate_webui_js_bindings, changing to default "off",
> and limiting the parameter to ChromeOS Ash since WebUI bindings always
> use TypeScript on other platforms.
>
> In this CL removing use_typescript_sources and updating a few
> remaining users.
>
> Bug: 1002798
> Change-Id: Ic6ee29be22b65bb2d4b1f5fda013766b3c06bd5e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5115946
> Reviewed-by: Reilly Grant <reillyg@chromium.org>
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1237670}

Bug: 1002798
Change-Id: I84c93e8c09ac384f18440e3eb791cf8b5b5d4b22
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5124793
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Shibalik Mohapatra <shibalik@chromium.org>
Owners-Override: Shibalik Mohapatra <shibalik@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1237850}
This commit is contained in:
Joel Hockey
2023-12-15 00:57:26 +00:00
committed by Chromium LUCI CQ
parent 305fc2ea02
commit 302442a4b4
6 changed files with 37 additions and 10 deletions
chrome/test/data/webui/chromeos
content/test
mojo/public/tools/bindings
sandbox/policy/mojom
services
device
public
network
public

@ -270,7 +270,7 @@ mojom("web_ui_test_bindings") {
webui_module_path = "/"
# Used by legacy MojoWebUIBrowserTest.
generate_legacy_js_bindings = true
use_typescript_sources = false
}
generate_grd("build_web_ui_test_mojo_grdp") {

@ -1077,7 +1077,7 @@ if (is_chromeos_ash) {
# Generate WebUI bindings in JavaScript instead of TypeScript. This is
# necessary since this target is intentionally testing JS WebUI bindings.
generate_webui_js_bindings = true
use_typescript_sources = false
}
}

@ -340,12 +340,24 @@ if (enable_scrambled_message_ids) {
#
# generate_webui_js_bindings (optional)
# Generate WebUI bindings in JavaScript rather than TypeScript. Defaults
# to false. ChromeOS only parameter.
# to false. ChromeOS only parameter. Use instead of
# |use_typescript_sources|, which is being removed.
#
# use_typescript_sources (optional)
# Generate WebUI bindings in TypeScript. Defaults to "true". When set to
# "false", WebUI bindings will be generated in JavaScript instead.
# Ignored if |webui_module_path| is not set.
#
# Note: DO NOT USE in new targets. New WebUI code should always be in
# TypeScript, so the corresponding WebUI mojo bindings should be in
# TypeScript as well. This parameter should only be set to false to
# support legacy WebUI code that still uses the Closure Compiler for
# typechecking.
#
# generate_legacy_js_bindings (optional)
# Generate js_data_deps target containing legacy JavaScript bindings files
# for Blink tests and other non-WebUI users when generating TypeScript
# bindings for WebUI. Ignored if generate_webui_js_bindings is set to
# bindings for WebUI. Ignored if use_typescript_sources is not set to
# true.
#
# js_generate_struct_deserializers (optional)
@ -374,7 +386,7 @@ if (enable_scrambled_message_ids) {
# given URL.
#
# Note: WebUI module bindings are generated in TypeScript by default,
# unless |generate_webui_js_bindings| is specified as true.
# unless |use_typescript_sources| is specified as false.
#
# The following parameters are used to support the component build. They are
# needed so that bindings which are linked with a component can use the same
@ -808,8 +820,10 @@ template("mojom") {
"--add-module-metadata",
"webui_module_path=${invoker.webui_module_path}",
]
if (defined(invoker.generate_webui_js_bindings) &&
invoker.generate_webui_js_bindings) {
if ((defined(invoker.use_typescript_sources) &&
!invoker.use_typescript_sources) ||
(defined(invoker.generate_webui_js_bindings) &&
invoker.generate_webui_js_bindings)) {
args += [
"--add-module-metadata",
"generate_webui_js=True",
@ -1847,7 +1861,19 @@ template("mojom") {
}
use_typescript_for_target = defined(invoker.webui_module_path) &&
!defined(invoker.generate_webui_js_bindings)
!defined(invoker.generate_webui_js_bindings) &&
(!defined(invoker.use_typescript_sources) ||
(defined(invoker.use_typescript_sources) &&
invoker.use_typescript_sources))
# Don't allow JavaScript WebUI bindings on non-ChromeOS platforms.
# TODO (rbpotter): Remove this check once use_typescript_sources is removed.
if (!use_typescript_for_target && defined(invoker.webui_module_path)) {
assert(
is_chromeos_ash,
"WebUI bindings should be in TypeScript on non-ChromeOS platforms. " +
"Remove use_typescript_sources = false")
}
generate_legacy_js = !use_typescript_for_target ||
(defined(invoker.generate_legacy_js_bindings) &&

@ -21,7 +21,7 @@ mojom("mojom") {
# bindings in JavaScript rather than TypeScript to support this legacy code.
if (is_chromeos_ash) {
webui_module_path = "/"
generate_webui_js_bindings = true
use_typescript_sources = false
}
enabled_features = []

@ -233,6 +233,7 @@ mojom("geoposition") {
mojom("geolocation_internals") {
sources = [ "geolocation_internals.mojom" ]
webui_module_path = "/"
use_typescript_sources = true
public_deps = [
":geoposition",
"//mojo/public/mojom/base",

@ -29,7 +29,7 @@ mojom("mojom_ip_address") {
# Used by ash/webui/resources/common/network_health, which is still using
# Closure Compiler, so generate WebUI bindings in JavaScript.
generate_webui_js_bindings = true
use_typescript_sources = false
}
public_deps = [ "//url/mojom:url_mojom_gurl" ]