mirror of https://github.com/mongodb/mongo
SERVER-103729 fix browser for new fields and switch to space rather than tab to separate loc from ctx (#36647)
GitOrigin-RevId: 710a49d9d21f6098879ebd85cf7da6d29588b084
This commit is contained in:
parent
4164f376ba
commit
eb948d70a0
|
|
@ -1110,6 +1110,16 @@ tasks:
|
||||||
- "./src/evergreen/run_python_script_with_report.sh"
|
- "./src/evergreen/run_python_script_with_report.sh"
|
||||||
- "validate-module-calls"
|
- "validate-module-calls"
|
||||||
- "modules_poc/merge_decls.py"
|
- "modules_poc/merge_decls.py"
|
||||||
|
- command: subprocess.exec
|
||||||
|
type: test
|
||||||
|
params:
|
||||||
|
binary: bash
|
||||||
|
args:
|
||||||
|
- "./src/evergreen/run_python_script_with_report.sh"
|
||||||
|
- "ensure-browser-can-parse-output"
|
||||||
|
- "modules_poc/browse.py"
|
||||||
|
- "merged_decls.json"
|
||||||
|
- "--parse-only"
|
||||||
|
|
||||||
- name: bazel_coverage
|
- name: bazel_coverage
|
||||||
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"]
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class LocAndContext(NamedTuple):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def parse(cls, usage: str):
|
def parse(cls, usage: str):
|
||||||
loc, ctx = usage.split("\t")
|
loc, _, ctx = usage.partition(" ")
|
||||||
return cls(Loc.parse(loc), sys.intern(ctx))
|
return cls(Loc.parse(loc), sys.intern(ctx))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -224,11 +224,11 @@ def add_mod_loc_mapping_nodes(node: TreeNode, usages: Usages, kind: str, expand=
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Currently only STATIC_ASSERT doesn't have a name.
|
# Currently only STATIC_ASSERT doesn't have a name.
|
||||||
[kind, *name] = loc.ctx.split(" ", 1)
|
kind, _, name = loc.ctx.partition(" ")
|
||||||
mod_node.add_leaf(
|
mod_node.add_leaf(
|
||||||
Text.assemble(
|
Text.assemble(
|
||||||
fancy_kind(kind),
|
fancy_kind(kind),
|
||||||
Text(" " + name[0], style="bold bright_white") if name else "",
|
Text(" " + name, style="bold bright_white") if name else "",
|
||||||
f" {loc.loc}",
|
f" {loc.loc}",
|
||||||
),
|
),
|
||||||
loc.loc,
|
loc.loc,
|
||||||
|
|
@ -516,6 +516,9 @@ for d in raw_decls:
|
||||||
for mod, locs in d["other_mods"].items():
|
for mod, locs in d["other_mods"].items():
|
||||||
locs.sort()
|
locs.sort()
|
||||||
d["other_mods"][mod] = [Loc.parse(loc) for loc in locs]
|
d["other_mods"][mod] = [Loc.parse(loc) for loc in locs]
|
||||||
|
# For now these aren't used in the browser
|
||||||
|
del d["vis_from"]
|
||||||
|
del d["vis_from_non_ns"]
|
||||||
|
|
||||||
decls = sorted((Decl(**d) for d in raw_decls), key=lambda d: d.loc)
|
decls = sorted((Decl(**d) for d in raw_decls), key=lambda d: d.loc)
|
||||||
del raw_decls
|
del raw_decls
|
||||||
|
|
@ -565,7 +568,7 @@ for f in files.values():
|
||||||
files = {k: v for k, v in sorted(files.items(), key=lambda kv: kv[1].unknown_count, reverse=True)}
|
files = {k: v for k, v in sorted(files.items(), key=lambda kv: kv[1].unknown_count, reverse=True)}
|
||||||
modules = {d.mod for d in decls}
|
modules = {d.mod for d in decls}
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__" and "--parse-only" not in sys.argv:
|
||||||
app = ModularityApp()
|
app = ModularityApp()
|
||||||
app.run()
|
app.run()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -784,7 +784,7 @@ def find_usages(mod: str, c: Cursor, context: DecoratedCursor | None):
|
||||||
# if this fails, something is missing in context_kinds or namespace_scope_context_kinds
|
# if this fails, something is missing in context_kinds or namespace_scope_context_kinds
|
||||||
assert context
|
assert context
|
||||||
|
|
||||||
usage = f"{pretty_location(c.location)}\t{context.string_for_context}"
|
usage = f"{pretty_location(c.location)} {context.string_for_context}"
|
||||||
d.used_from.setdefault(mod, set()).add(usage)
|
d.used_from.setdefault(mod, set()).add(usage)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,14 @@ def _group_by_vis_map(vis_from):
|
||||||
group_by(.mod) |
|
group_by(.mod) |
|
||||||
map({
|
map({
|
||||||
mod: .[0].mod,
|
mod: .[0].mod,
|
||||||
locs: [.[].locs[]] | map(split("\t") | .[1]) | unique,
|
locs: [
|
||||||
|
.[].locs[] |
|
||||||
|
split(" ") |
|
||||||
|
if length == 3
|
||||||
|
then "\(.[1]) \(.[2])" # CXX_METHOD Foo::bar
|
||||||
|
else "\(.[1]) \(.[0])" # STATIC_ASSERT src/mongo/foo.cpp:123:45
|
||||||
|
end
|
||||||
|
] | unique,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue