Skip to content

Commit 4a05a73

Browse files
feat: support docs at root level (#482)
Signed-off-by: Alexander Lanin <Alexander.Lanin@etas.com>
1 parent b6d8d39 commit 4a05a73

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

docs.bzl

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,22 +156,28 @@ def docs(source_dir = "docs", data = [], deps = [], scan_code = [], known_good =
156156
deps = deps,
157157
)
158158

159+
# If the source directory is the root (".") we must omit it, otherwise:
160+
# > invalid glob pattern './**/*.png': segment '.' not permitted
161+
if source_dir == ".":
162+
source_prefix = ""
163+
else:
164+
source_prefix = source_dir + "/"
165+
159166
native.filegroup(
160167
name = "docs_sources",
161168
srcs = native.glob([
162-
source_dir + "/**/*.png",
163-
source_dir + "/**/*.svg",
164-
source_dir + "/**/*.md",
165-
source_dir + "/**/*.rst",
166-
source_dir + "/**/*.html",
167-
source_dir + "/**/*.css",
168-
source_dir + "/**/*.puml",
169-
source_dir + "/**/*.need",
170-
source_dir + "/**/*.yaml",
171-
source_dir + "/**/*.json",
172-
source_dir + "/**/*.csv",
173-
source_dir + "/**/*.inc",
174-
"more_docs/**/*.rst",
169+
source_prefix + "**/*.png",
170+
source_prefix + "**/*.svg",
171+
source_prefix + "**/*.md",
172+
source_prefix + "**/*.rst",
173+
source_prefix + "**/*.html",
174+
source_prefix + "**/*.css",
175+
source_prefix + "**/*.puml",
176+
source_prefix + "**/*.need",
177+
source_prefix + "**/*.yaml",
178+
source_prefix + "**/*.json",
179+
source_prefix + "**/*.csv",
180+
source_prefix + "**/*.inc",
175181
], allow_empty = True),
176182
visibility = ["//visibility:public"],
177183
)
@@ -279,7 +285,7 @@ def docs(source_dir = "docs", data = [], deps = [], scan_code = [], known_good =
279285
sphinx_docs(
280286
name = "needs_json",
281287
srcs = [":docs_sources"],
282-
config = ":" + source_dir + "/conf.py",
288+
config = ":" + source_prefix + "conf.py",
283289
extra_opts = [
284290
"-W",
285291
"--keep-going",

0 commit comments

Comments
 (0)