In the Chromium backend engineers can use `DCHECK()` to ensure
certain invariants are held, but only execute these assertions
in a debug build. [1] Release builds do not ship with DCHECKS enabled.
In a similar fashion, introduce a build-time generated function
`DHCECK` that is only generated when `devtools_dcheck_always_on`
is set as GN arg. By default, `is_debug` builds enable
`devtools_dcheck_always_on`. However, in a release build, you can
explicitly set `devtools_dcheck_always_on` to `true` to achieve
the same effect.
When the GN arg is set, the build generates the `dcheck.js` file
with an implementation that checks the condition and fails if
it is not met. When the arg is not set, the function implementation
remains empty and becomes a noop.
To make sure that these functions calls are removed in a release
build (rather than being a noop), the terser configuration is
updated to treat these functions as pure. As such, terser will
remove any calls if the function implementation is empty. In a
release build that explicitly turns out the dchecks, terser
will not remove the function calls.
Lastly, to make sure that all code related to the dcheck is removed,
the condition needs to be a lambda. If we were to make it a raw
boolean, then `terser` would not be able to determine whether it
can remove the condition itself and would leave that behind. In other
words, the `DCHECK` call would still leave some artifacts behind,
namely the condition computation itself. By making it a lambda,
terser can deduce that the lambda creation has no side-effect and
remove the lambda if the `DHCECK` call is removed.
R=aerotwist@chromium.org
[1]: https://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/c++/c++.md#check_dcheck_and-notreached
Bug: none
Change-Id: Ic396f102141d9eb67c8690bd2a601b56061b9d8c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2894390
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
This locks down the visibility of ui/legacy:bundle to the various
folders that already depend on it. For now, the visibility is
quite broad, as there is still plenty of code depending on the
legacy UI implementation.
Consequently, downstream projects (such as the Edge DevTools fork)
will break if they depend on this bundle. Therefore, add a GN arg
that allows the visibility to be extended. To use this GN arg,
downstream projects can change their `default_args` in the root
`.gn` file:
default_args = {
devtools_ui_legacy_visibility = [
"//front_end/forked/folder/*",
]
}
This means that they can broaden the visibility of UI. It is still
recommended to remove as many of the dependencies on UI as feasible,
but that will likely not finish any time soon.
R=jacktfranklin@chromium.org,aerotwist@chromium.org
Bug: 1202788
Change-Id: I868e88ee3b1c66dd7c79d30d07648a7d2828e8f2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2853551
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
GN metadata allows to specify and later query metadata from any
action in our build graph. Using GN metadata, we can specify
GRD files on an action and collect these files on the top level.
Then, we can compare the list of collected files to the expected
GRD files in `devtools_grd_files.gni` to ensure they match.
As a follow-up change, we can remove the intermediate lists we have
been specifying in `all_devtools_modules.gni` and
`devtools_module_entrypoints.gni`, which now become obsolete. That's
because both `devtools_module` and `devtools_entrypoint` now specify
the files in their respective metadata and essentially perform the
check that all relevant files are collected.
R=aerotwist@chromium.org
Also-By: alexrudenko@chromium.org
Bug: 1174013
Change-Id: I9dd2e6f7e010b5c25f83556511af12d5d1c2ec7c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2843322
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
In release mode, the devtools_entrypoint prebundle step was missing
the deps. We ran into this issue when we were moving the emulation
panel into panels/emulation, which required some updates to the
toolbox.ts entrypoint (crrev.com/c/2782540).
The missing deps then required the rootdir logic to be changed,
such that deps are correctly resolved relative to the gen-directory,
not the source directory.
This CL might improve build performance in release builds, since
we are now properly using incremental references for our
entrypoints and saving a bit of compilation time.
DISABLE_THIRD_PARTY_CHECK=TypeScript fix
R=aerotwist@chromium.org
Bug: 1187573
Change-Id: I4662ac90ba50116cb668dfe3164fe725b74f9a37
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2782554
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
This also updates the Runtime and build_release_applications to use
the correct format for the various files. Most notably, it should
use the basename when concatening file names, since we don't want
to include the `panels/` part in these file names. As such, the
filenames become `panels/accessibility/accessibility_module.js`.
R=aerotwist@chromium.org
Bug: 1187573
Change-Id: I2d3d453ac0e5ea0d4358228531bfe31bde6e7655
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2757147
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
This reverts commit 037c96df04.
Reason for revert: upstream revert: https://crrev.com/c/2713518
Original change's description:
> Stop copying to resources/inspector in devtools_{module,entrypoint}
>
> This simplifies the JavaScript generating tasks in the DevTools
> build system to stop copying to resources/inspector. The output
> to the gen-folder will remain as-is.
>
> After this change, it will no longer be possible to use
> resources/inspector as build output location when using
> --custom-devtools-frontend. Instead, the location should be
> updated to use gen/front_end instead. Engineers are encouraged
> to remove the resources/inspector build output folder to ensure
> stale build artifacts aren't accidentally used while working
> on DevTools locally.
>
> Note that there are still files in resources/inspector generated by
> other actions in the build system. We will clean these up in
> follow-up CLs.
>
> R=alexrudenko@chromium.org,jacktfranklin@chromium.org
>
> Bug: 1174013
> Change-Id: I750d04e58c5fa85054b8451c3582b58a3f7c77ba
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2678696
> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
> Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Bug: 1174013
Change-Id: I9c4c561a59d808d3fdd1564475ec5ba21955d577
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2714545
Auto-Submit: Changhao Han <changhaohan@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
This simplifies the JavaScript generating tasks in the DevTools
build system to stop copying to resources/inspector. The output
to the gen-folder will remain as-is.
After this change, it will no longer be possible to use
resources/inspector as build output location when using
--custom-devtools-frontend. Instead, the location should be
updated to use gen/front_end instead. Engineers are encouraged
to remove the resources/inspector build output folder to ensure
stale build artifacts aren't accidentally used while working
on DevTools locally.
Note that there are still files in resources/inspector generated by
other actions in the build system. We will clean these up in
follow-up CLs.
R=alexrudenko@chromium.org,jacktfranklin@chromium.org
Bug: 1174013
Change-Id: I750d04e58c5fa85054b8451c3582b58a3f7c77ba
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2678696
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
The previous attempt of this fix was in https://crrev.com/c/2687497
That CL was reverted, as it inadvertently added more files to the
runtime_deps then was intended. Most notably, it erroneously included
`tsconfig.json`, `tsbuildinfo` and `d.ts` files.
Instead, we should manually filter out only those files that we are
interested in. In this case, these are the `js` and `js.map` files.
Once these are added to the runtime_deps, the layout tests can access
them, as they are pushed to the bots.
I have verified that the following command shows the expected output:
gn desc out/Default front_end/platform:bundle runtime_deps
R=jacktfranklin@chromium.org
Bug: 1174013
Change-Id: I6bc25665f06b5968bbd9748696a5723edac84ddc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2697201
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
All relevant build output files are now put into gen/front_end.
To make sure that we don't run into duplicate JS entrypoint
files, we have to turn of the emit of these targets in
front_end/BUILD.gn, such that build_release_applications can
put its output there. Since build_release_applications takes
the files from the front_end source directory, not the gen
directory, this causes no issues.
After this change, it is possible to use --custom-devtools-frontend
with gen/front_end rather than resources/inspector.
DISABLE_THIRD_PARTY_CHECK=Update TypeScript noemit
R=aerotwist@chromium.org
Bug: 1174013
Change-Id: Iad331ff0a28871a0ec297483fa03fbb485d05fb4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2672031
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
This is a reland of 159d86d3fb
The reland fixes the setting of "use_rbe" on the ts_library template
iff RBE is enabled for devtools directly. This prevents an
"unused variable" error when building with "use_rbe=true" and
"devtools_use_rbe=false".
Original change's description:
> Support RBE for building TypeScript int DevTools
>
> This CL implements initial support for executing TSC in the cloud by:
> 1) Introducing a new GN arg "devtools_use_rbe". This is experimental
> and will be folded into the Chromium "use_rbe" flag once RBE
> building has stabalized.
> 2) Pass the configured Chromium rewrapper along to ts_library.py.
> 3) Add a new function "runTscRemote" that calculates inputs required
> and invokes rewrapper
>
> Support is currently very limited:
> - Only works with a full Chromium checkout (NOT standalone DevTools)
> - Only works on leaf modules (modules without DEPS)
>
> Modules that can't be currently built in the Cloud are built locally
> as per usual.
>
> DISABLE_THIRD_PARTY_CHECK=Change typescript.gni
>
> R=tvanderlippe@chromium.org
>
> Bug: chromium:1139220
> Change-Id: Id7a1e6c113466414f6daaa661456d8debfe6696d
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2652508
> Commit-Queue: Simon Zünd <szuend@chromium.org>
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
DISABLE_THIRD_PARTY_CHECK=Change typescript.gni
Bug: chromium:1139220
Change-Id: I536fb580c3814a82525344ab5ebd5fb853568387
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2659015
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
This reverts commit 159d86d3fb.
Reason for revert:
This has broken a few re-client builders in Chromium:
* https://ci.chromium.org/p/chromium/builders/ci/Linux%20Builder%20%28reclient%29?limit=200
* https://ci.chromium.org/p/chromium/builders/ci/Linux%20Builder%20%28reclient%29
```
$ gn gen out/rbe-demo --args='use_rbe=true is_debug=false'
ERROR at //third_party/devtools-frontend/src/scripts/build/ninja/devtools_entrypoint.gni:132:19: Assignment had no effect.
use_rbe = false
^----
You set the variable "use_rbe" here and it was unused before it went
out of scope.
See //third_party/devtools-frontend/src/front_end/common/BUILD.gn:47:1: whence it was called.
```
Original change's description:
> Support RBE for building TypeScript int DevTools
>
> This CL implements initial support for executing TSC in the cloud by:
> 1) Introducing a new GN arg "devtools_use_rbe". This is experimental
> and will be folded into the Chromium "use_rbe" flag once RBE
> building has stabalized.
> 2) Pass the configured Chromium rewrapper along to ts_library.py.
> 3) Add a new function "runTscRemote" that calculates inputs required
> and invokes rewrapper
>
> Support is currently very limited:
> - Only works with a full Chromium checkout (NOT standalone DevTools)
> - Only works on leaf modules (modules without DEPS)
>
> Modules that can't be currently built in the Cloud are built locally
> as per usual.
>
> DISABLE_THIRD_PARTY_CHECK=Change typescript.gni
>
> R=tvanderlippe@chromium.org
>
> Bug: chromium:1139220
> Change-Id: Id7a1e6c113466414f6daaa661456d8debfe6696d
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2652508
> Commit-Queue: Simon Zünd <szuend@chromium.org>
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
TBR=szuend@chromium.org,tvanderlippe@chromium.org
Change-Id: Ie82249ab143f86bc61d706759b7b72c43ba4c53f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1139220
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2658258
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Ye Kuang <yekuang@google.com>
This CL implements initial support for executing TSC in the cloud by:
1) Introducing a new GN arg "devtools_use_rbe". This is experimental
and will be folded into the Chromium "use_rbe" flag once RBE
building has stabalized.
2) Pass the configured Chromium rewrapper along to ts_library.py.
3) Add a new function "runTscRemote" that calculates inputs required
and invokes rewrapper
Support is currently very limited:
- Only works with a full Chromium checkout (NOT standalone DevTools)
- Only works on leaf modules (modules without DEPS)
Modules that can't be currently built in the Cloud are built locally
as per usual.
DISABLE_THIRD_PARTY_CHECK=Change typescript.gni
R=tvanderlippe@chromium.org
Bug: chromium:1139220
Change-Id: Id7a1e6c113466414f6daaa661456d8debfe6696d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2652508
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
GRD compression takes a while. It takes a particularly long while in
debug builds. This change skips compression on debug builds which
takes the GRD step from ~55 seconds to ~5 seconds.
Alternately we could use this framework (passing through the debug state
of the build) to try different compression options as suggested in the
bug.
Test results for debug-component and release builds with this change:
5.2 weighted s to build gen/content/browser/devtools/devtools_resources_grit.d.stamp, gen... (5.2 s elapsed time)
24.5 weighted s to build gen/content/browser/devtools/devtools_resources_grit.d.stamp, gen... (24.5 s elapsed time)
Release is unchanged but debug is ~11 times faster.
Bug: 1162467
Change-Id: I017ec872a1645fef55aff09472cdf4427146d17b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2639276
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>