Skip to content

Commit 78651ea

Browse files
committed
always set doctreedir
1 parent 2912daf commit 78651ea

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

sphinxdocs/private/sphinx.bzl

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -293,18 +293,15 @@ def _run_sphinx(ctx, format, source_path, inputs, output_prefix, use_persistent_
293293
# Don't add to run_args: parallel building breaks interactive debugging
294294
args.add("--jobs=auto")
295295

296-
if use_persistent_workers:
297-
# * Normally Sphinx puts doctrees in the output dir. We can't do that
298-
# because Bazel will clear the output directory every invocation. To
299-
# work around that, create it as a sibling directory.
300-
# * Use a non-dot prefixed name so it shows up more visibly.
301-
args.add(paths.join(output_dir.path + "_doctrees"), format = "--doctree-dir=%s")
302-
303-
else:
304-
# These aren't added to run_args because we assume direct invocations
305-
# will add them if necessary.
306-
args.add("--fresh-env") # Don't try to use cache files. Bazel can't make use of them.
307-
args.add("--write-all") # Write all files; don't try to detect "changed" files
296+
# Put the doctree dir outside of the output directory.
297+
# This allows it to be reused between invocations when possible; Bazel
298+
# clears the output directory every action invocation.
299+
# * For workers, they can fully re-use it.
300+
# * For non-workers, it can be reused when sandboxing is disabled via
301+
# the `no-sandbox` tag or execution requirement.
302+
#
303+
# We also use a non-dot prefixed name so it shows up more visibly.
304+
args.add(paths.join(output_dir.path + "_doctrees"), format = "--doctree-dir=%s")
308305

309306
for opt in ctx.attr.extra_opts:
310307
expanded = ctx.expand_location(opt)

0 commit comments

Comments
 (0)