Skip to content

Commit 2cea844

Browse files
committed
Automatically Add group tags to documented code
1 parent e19d04a commit 2cea844

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tools/misc/docs_gen.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ def find_namespace(contents):
3131
return num + 1
3232
return 0
3333

34+
EXCLUDES = ["targets", "features/FEATURE", "features/mbedtls",
35+
"features/nanostack", "features/storage"]
36+
37+
def is_not_excluded(src):
38+
return all(exclude not in src for exclude in EXCLUDES)
39+
3440
if __name__ == "__main__":
3541
import sys
3642
from os.path import abspath, dirname, join
@@ -42,7 +48,7 @@ def find_namespace(contents):
4248
from tools.targets import TARGET_MAP
4349
toolchain = GCC_ARM(TARGET_MAP["Super_Target"])
4450
resources = toolchain.scan_resources(".")
45-
for src in resources.headers:
51+
for src in filter(is_not_excluded, resources.headers):
4652
if len(src.split(sep)) > 2:
4753
name = src.split(sep)[1]
4854
if name == "features":
@@ -55,7 +61,7 @@ def find_namespace(contents):
5561
after = "\n".join(contents.split("\n")[insert_at:])
5662
fd.write("{:s}\n/** \\addtogroup {:s} */\n/** @{{*/\n{:s}\n/** @}}*/\n".format(before,name,after))
5763
for name, res in resources.features.iteritems():
58-
for src in res.headers:
64+
for src in filter(is_not_excluded, res.headers):
5965
with open(src) as fd:
6066
contents = fd.read()
6167
with open(src, "w+") as fd:
@@ -64,5 +70,8 @@ def find_namespace(contents):
6470
after = "\n".join(contents.split("\n")[insert_at:])
6571
fd.write("{:s}\n/** \\addtogroup FEATURE_{:s} */\n/** @{{*/\n{:s}\n/** @}}*/\n".format(before,name,after))
6672

67-
generate_documentation(filter(lambda x: "targets" not in x, sum(map(lambda x:x.headers, resources.features.values()), resources.headers)),
73+
generate_documentation(filter(is_not_excluded,
74+
sum(map(lambda x:x.headers,
75+
resources.features.values()),
76+
resources.headers)),
6877
join(dirname(dirname(__file__)), "mbed-docs"))

0 commit comments

Comments
 (0)