Skip to content

Commit 7c95ed8

Browse files
committed
Merge branch 'maint'
2 parents a33c78a + 2bbcc32 commit 7c95ed8

2 files changed

Lines changed: 16 additions & 24 deletions

File tree

make/ex_doc.exs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ annotations = Access.get(local_config, :annotations_for_docs, fn _ -> [] end)
179179

180180
current_datetime = System.os_time() |> DateTime.from_unix!(:native)
181181

182+
## Check if we should treat warnings as errors
183+
warnings_as_errors =
184+
case System.get_env("EX_DOC_WARNINGS_AS_ERRORS") do
185+
value when value in ["true", "default"] -> true
186+
"false" -> false
187+
end
188+
182189
## Check ExDoc version
183190
version_str =
184191
case System.get_env("EX_DOC_VERSION") do
@@ -290,7 +297,8 @@ config =
290297

291298
_ ->
292299
""
293-
end
300+
end,
301+
warnings_as_errors: warnings_as_errors
294302
] ++ search_config
295303

296304
Keyword.merge(

make/ex_doc_wrapper.in

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
ARGS=("$@")
2424

25-
set -eo pipefail {0}
26-
2725
## If EX_DOC is not set to a file, we search the PATH for it using command -v
2826
if [ ! -f "${EX_DOC}" ]; then
2927
EX_DOC=$(command -v ex_doc || true)
@@ -51,19 +49,6 @@ fi
5149
## This is currently used to handle search engine changes in v0.39.0
5250
export EX_DOC_VERSION=$($EX_DOC --version)
5351

54-
## The below bash magic captures the output of stderr into OUTPUT while still printing
55-
## everything we get to stdout and stderr. This is done by:
56-
57-
## 1. duplicating the stdout (1) and stderr (2) streams to fd 3 and 4 respectively.
58-
exec 3>&1 4>&2
59-
60-
## Running the command where we redirect stderr to fd 1 and stdout to fd 3.
61-
## We then use tee on the stderr (which is now fd 1) to print that to fd 4
62-
OUTPUT="$( { escript@EXEEXT@ "${EX_DOC}" "${ARGS[@]}"; } 2>&1 1>&3 | tee /dev/fd/4 )"
63-
64-
## Close fd 3 and 4
65-
exec 3>&- 4>&-
66-
6752
## If EX_DOC_WARNINGS_AS_ERRORS is not explicitly turned on
6853
## and any .app file is missing, we turn off warnings as errors
6954
if [ "${EX_DOC_WARNINGS_AS_ERRORS}" != "true" ]; then
@@ -74,13 +59,12 @@ if [ "${EX_DOC_WARNINGS_AS_ERRORS}" != "true" ]; then
7459
done
7560
fi
7661

77-
if [ "${EX_DOC_WARNINGS_AS_ERRORS}" != "false" ]; then
78-
if echo "${OUTPUT}" | grep "warning:" 1>/dev/null; then
79-
echo "ex_doc emitted warnings"
80-
## Touch the config file in order to re-trigger make
81-
if [ -f "docs.exs" ]; then
82-
touch "docs.exs"
83-
fi
84-
exit 1;
62+
escript@EXEEXT@ "${EX_DOC}" "${ARGS[@]}"
63+
64+
if [ "$?" != "0" ]; then
65+
## Touch the config file in order to re-trigger make
66+
if [ -f "docs.exs" ]; then
67+
touch "docs.exs"
8568
fi
69+
exit 1;
8670
fi

0 commit comments

Comments
 (0)