Skip to content

Commit

Permalink
Attribution Internals: Migrate to TypeScript
Browse files Browse the repository at this point in the history
Bug: 1316438
Change-Id: I5d6935b4a6c947d87428322f91cdcdaa0900b1c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3639272
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: Andrew Paseltiner <apaseltiner@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1002458}
  • Loading branch information
Rebekah Potter authored and Chromium LUCI CQ committed May 12, 2022
1 parent c50ecd9 commit 5595faf
Show file tree
Hide file tree
Showing 10 changed files with 433 additions and 473 deletions.
2 changes: 1 addition & 1 deletion content/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ grit("dev_ui_content_resources") {
"//content/browser/attribution_reporting:mojo_bindings_webui_js",
"//content/browser/prerender:mojo_bindings_webui_js",
"//content/browser/process_internals:mojo_bindings_webui_js",
"//content/browser/resources/attribution_reporting:web_components",
"//content/browser/resources/attribution_reporting:build_ts",
"//storage/browser/quota:mojo_bindings_webui_js",
]
}
Expand Down
2 changes: 2 additions & 0 deletions content/OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ pfeldman@chromium.org
# structural changes, please get a review from a reviewer in this file.
per-file BUILD.gn=*

per-file dev_ui_content_resources.grd=file://ui/webui/PLATFORM_OWNERS

# The remaining rules are for platform-specific implementation changes.
# Do NOT add other per-file changes as they would also apply to public/.

Expand Down
1 change: 0 additions & 1 deletion content/browser/resources/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ group("resources") {
if (enable_js_type_check) {
group("closure_compile") {
deps = [
"attribution_reporting:closure_compile",
"histograms:closure_compile",
"process:closure_compile",
]
Expand Down
47 changes: 29 additions & 18 deletions content/browser/resources/attribution_reporting/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,42 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//third_party/closure_compiler/compile_js.gni")
import("//tools/polymer/html_to_js.gni")
import("//tools/typescript/ts_library.gni")

html_to_js("web_components") {
js_files = [ "attribution_internals_table.js" ]
js_files = [ "attribution_internals_table.ts" ]
}

js_type_check("closure_compile") {
closure_flags = default_closure_args + mojom_js_args + [
"js_module_root=" + rebase_path(".", root_build_dir),
"js_module_root=" + rebase_path(
"$root_gen_dir/mojom-webui/content/browser/attribution_reporting",
root_build_dir),
]
deps = [ ":attribution_internals" ]
# Copy (via creating sym links) all the other files into the same folder for
# ts_library.
copy("copy_files") {
deps = [ "//content/browser/attribution_reporting:mojo_bindings_webui_js" ]
sources = [
"$root_gen_dir/mojom-webui/content/browser/attribution_reporting/attribution_internals.mojom-webui.js",
"./attribution_internals.ts",
"./table_model.ts",
]
outputs = [ "$target_gen_dir/{{source_file_part}}" ]
}

js_library("attribution_internals") {
ts_library("build_ts") {
root_dir = target_gen_dir
out_dir = "$target_gen_dir/tsc"
tsconfig_base = "tsconfig_base.json"
in_files = [
"attribution_internals.ts",
"attribution_internals_table.ts",
"table_model.ts",
"attribution_internals.mojom-webui.js",
]
deps = [
":table_model",
"//content/browser/attribution_reporting:mojo_bindings_webui_js",
"//ui/webui/resources/js:assert.m",
"//ui/webui/resources/js:util.m",
"//ui/webui/resources:library",
"//ui/webui/resources/mojo:library",
]
definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ]
extra_deps = [
":copy_files",
":web_components",
]
}

js_library("table_model") {
}

0 comments on commit 5595faf

Please sign in to comment.