Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: update inspector_protocol #26154

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/inspector/node_inspector.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
'node_protocol_files': [
'<(protocol_tool_path)/lib/Allocator_h.template',
'<(protocol_tool_path)/lib/Array_h.template',
'<(protocol_tool_path)/lib/Collections_h.template',
'<(protocol_tool_path)/lib/CBOR_cpp.template',
'<(protocol_tool_path)/lib/CBOR_h.template',
'<(protocol_tool_path)/lib/DispatcherBase_cpp.template',
'<(protocol_tool_path)/lib/DispatcherBase_h.template',
'<(protocol_tool_path)/lib/ErrorSupport_cpp.template',
Expand All @@ -30,11 +31,13 @@
'<(protocol_tool_path)/lib/ValueConversions_h.template',
'<(protocol_tool_path)/lib/Values_cpp.template',
'<(protocol_tool_path)/lib/Values_h.template',
'<(protocol_tool_path)/lib/base_string_adapter_cc.template',
'<(protocol_tool_path)/lib/base_string_adapter_h.template',
'<(protocol_tool_path)/templates/Exported_h.template',
'<(protocol_tool_path)/templates/Imported_h.template',
'<(protocol_tool_path)/templates/TypeBuilder_cpp.template',
'<(protocol_tool_path)/templates/TypeBuilder_h.template',
'<(protocol_tool_path)/CodeGenerator.py',
'<(protocol_tool_path)/code_generator.py',
]
},
'defines': [
Expand Down Expand Up @@ -86,7 +89,7 @@
],
'action': [
'python',
'tools/inspector_protocol/ConvertProtocolToJSON.py',
'tools/inspector_protocol/convert_protocol_to_json.py',
'<@(_inputs)',
'<@(_outputs)',
],
Expand All @@ -104,7 +107,7 @@
'process_outputs_as_sources': 1,
'action': [
'python',
'tools/inspector_protocol/CodeGenerator.py',
'tools/inspector_protocol/code_generator.py',
'--jinja_dir', '<@(protocol_tool_path)/..',
'--output_base', '<(SHARED_INTERMEDIATE_DIR)/src/',
'--config', '<(SHARED_INTERMEDIATE_DIR)/node_protocol_config.json',
Expand All @@ -122,7 +125,7 @@
],
'action': [
'python',
'tools/inspector_protocol/ConcatenateProtocols.py',
'tools/inspector_protocol/concatenate_protocols.py',
'<@(_inputs)',
'<@(_outputs)',
],
Expand Down
5 changes: 5 additions & 0 deletions tools/inspector_protocol/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Defines the Google C++ style for automatic reformatting.
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: Google
DerivePointerAlignment: false
MaxEmptyLinesToKeep: 1
6 changes: 6 additions & 0 deletions tools/inspector_protocol/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated files.
out*/

# Third party files which are pulled with gclient (see DEPS).
third_party/gtest/gtest
third_party/mini_chromium/mini_chromium
106 changes: 106 additions & 0 deletions tools/inspector_protocol/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# All build targets below are experimental and not used within the
# Chromium / V8 / etc. trees yet thus far. Do not depend on anything.

import("//testing/test.gni")

static_library("json_parser") {
sources = [
"encoding/json_parser.cc",
"encoding/json_parser.h",
"encoding/json_parser_handler.h",
"encoding/platform.h",
"encoding/span.h",
"encoding/status.h",
"encoding/str_util.cc",
"encoding/str_util.h",
]
}

static_library("linux_dev_platform") {
sources = [
"encoding/linux_dev_platform.cc",
"encoding/linux_dev_platform.h",
"encoding/platform.h",
]
}

test("json_parser_test") {
sources = [
"encoding/json_parser_test.cc",
]
deps = [
":json_parser",
":linux_dev_platform",
"//base",
"//testing/gmock:gmock",
"//testing/gtest:gtest",
"//testing/gtest:gtest_main",
]
}

static_library("cbor") {
sources = [
"encoding/cbor.cc",
"encoding/cbor.h",
"encoding/json_parser_handler.h",
"encoding/span.h",
"encoding/status.h",
]
deps = [
":json_parser",
]
}

test("cbor_test") {
sources = [
"encoding/cbor_test.cc",
]
deps = [
":cbor",
":json_std_string_writer",
":linux_dev_platform",
"//base",
"//testing/gmock:gmock",
"//testing/gtest:gtest",
"//testing/gtest:gtest_main",
]
}

test("span_test") {
sources = [
"encoding/span.h",
"encoding/span_test.cc",
]
deps = [
"//base",
"//testing/gmock:gmock",
"//testing/gtest:gtest",
"//testing/gtest:gtest_main",
]
}

static_library("json_std_string_writer") {
sources = [
"encoding/json_parser_handler.h",
"encoding/json_std_string_writer.cc",
"encoding/json_std_string_writer.h",
]
}

test("json_std_string_writer_test") {
sources = [
"encoding/json_std_string_writer_test.cc",
]
deps = [
":json_std_string_writer",
":linux_dev_platform",
"//base",
"//testing/gmock:gmock",
"//testing/gtest:gtest",
"//testing/gtest:gtest_main",
]
}
64 changes: 64 additions & 0 deletions tools/inspector_protocol/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# The global configuration visible in all BUILD.gn files. See also
# ".gn" in this directory.

if (target_os == "") {
target_os = host_os
}
if (target_cpu == "") {
target_cpu = host_cpu
}
if (current_cpu == "") {
current_cpu = target_cpu
}
if (current_os == "") {
current_os = target_os
}

# This configures Clang as the C++ compiler. mini_chromium is an
# external dependency we pull in via the DEPS file / gclient sync / fetch.
set_default_toolchain(
"//third_party/mini_chromium/mini_chromium/build:gcc_like_toolchain")

declare_args() {
# When true, enables the debug configuration, with additional run-time checks
# and logging. When false, enables the release configuration, with additional
# optimizations.
is_debug = false
}

_default_configs = [
"//third_party/mini_chromium/mini_chromium/build:default",
"//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors",
]

_default_executable_configs =
_default_configs +
[ "//third_party/mini_chromium/mini_chromium/build:executable" ]

set_defaults("source_set") {
configs = _default_configs
}

set_defaults("static_library") {
configs = _default_configs
}

set_defaults("executable") {
configs = _default_executable_configs
}

set_defaults("loadable_module") {
configs = _default_configs
}

set_defaults("shared_library") {
configs = _default_configs
}

set_defaults("test") {
configs = _default_executable_configs
}
67 changes: 67 additions & 0 deletions tools/inspector_protocol/DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# ! DO NOT ROLL THIS FILE INTO CHROMIUM (or other repositories). !
# ! It's only useful for the standalone configuration in !
# ! https://chromium.googlesource.com/deps/inspector_protocol/ !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# This file configures gclient, a tool that installs dependencies
# at particular versions into this source tree. See
# https://chromium.googlesource.com/chromium/tools/depot_tools.git
# To fetch these dependencies, run "gclient sync". The fetch
# command (from depot_tools) will also run gclient sync.

vars = {
'chromium_git': 'https://chromium.googlesource.com',
}

# The keys in this dictionary define where the external dependencies (values)
# will be mapped into this gclient. The root of the gclient will
# be the parent directory of the directory in which this DEPS file is.
deps = {
# gn (the build tool) and clang-format.
'buildtools':
Var('chromium_git') + '/chromium/buildtools.git@' +
'6fe4a3251488f7af86d64fc25cf442e817cf6133',
# The toolchain definitions (clang C++ compiler etc.)
'src/third_party/mini_chromium/mini_chromium':
Var('chromium_git') + '/chromium/mini_chromium@' +
'737433ebade4d446643c6c07daae02a67e8decca',
# For writing unittests.
'src/third_party/gtest/gtest':
Var('chromium_git') + '/external/github.com/google/googletest@' +
'c091b0469ab4c04ee9411ef770f32360945f4c53',
}

hooks = [
{
'name': 'clang_format_linux',
'pattern': '.',
'condition': 'host_os == "linux"',
'action': [
'download_from_google_storage',
'--no_resume',
'--no_auth',
'--bucket=chromium-clang-format',
'--sha1_file',
'buildtools/linux64/clang-format.sha1',
],
},
{
'name': 'gn_linux',
'pattern': '.',
'condition': 'host_os == "linux"',
'action': [
'download_from_google_storage',
'--no_resume',
'--no_auth',
'--bucket=chromium-gn',
'--sha1_file',
'buildtools/linux64/gn.sha1',
],
},
]
recursedeps = ['buildtools']
3 changes: 1 addition & 2 deletions tools/inspector_protocol/OWNERS
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
set noparent

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
yangguo@chromium.org
johannes@chromium.org
33 changes: 33 additions & 0 deletions tools/inspector_protocol/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Chromium inspector (devtools) protocol

This package contains code generators and templates for the Chromium
inspector protocol.

The canonical location of this package is at
https://chromium.googlesource.com/deps/inspector_protocol/

In the Chromium tree, it's rolled into
https://cs.chromium.org/chromium/src/third_party/inspector_protocol/

In the V8 tree, it's rolled into
https://cs.chromium.org/chromium/src/v8/third_party/inspector_protocol/

See also [Contributing to Chrome Devtools Protocol](https://docs.google.com/document/d/1c-COD2kaK__5iMM5SEx-PzNA7HFmgttcYfOHHX0HaOM/edit).

We're working on enabling standalone builds for parts of this package for
testing and development, please feel free to ignore this for now.
But, if you're familiar with
[Chromium's development process](https://www.chromium.org/developers/contributing-code)
and have the depot_tools installed, you may use these commands
to fetch the package (and dependencies) and build and run the tests:

fetch inspector_protocol
cd src
gn gen out/Release
ninja -C out/Release json_parser_test
out/Release/json_parser_test

You'll probably also need to install g++, since Clang uses this to find the
standard C++ headers. E.g.,

sudo apt-get install g++-8
16 changes: 0 additions & 16 deletions tools/inspector_protocol/README.v8

This file was deleted.

19 changes: 19 additions & 0 deletions tools/inspector_protocol/WATCHLISTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Watchlist Rules
# Refer: http://dev.chromium.org/developers/contributing-code/watchlists

# IMPORTANT: The regular expression filepath is tested against each path using
# re.search, so it is not usually necessary to add .*.
{
'WATCHLIST_DEFINITIONS': {
'devtools': {
'filepath': '.*',
},
},
'WATCHLISTS': {
'devtools': ['[email protected]']
},
}
12 changes: 12 additions & 0 deletions tools/inspector_protocol/base/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This library simply delegates to the third party library; we're doing this
# to be compatible with the Chromium tree.
static_library("base") {
testonly = true # This dependency is only allowed for tests.
public_deps = [
"//third_party/mini_chromium/mini_chromium/base",
]
}
Loading