File tree Expand file tree Collapse file tree 5 files changed +34
-9
lines changed Expand file tree Collapse file tree 5 files changed +34
-9
lines changed Original file line number Diff line number Diff line change 73317331done
73327332
73337333if test -z "$EX_DOC"; then
7334- EX_DOC="$ERL_TOP/make/ex_doc_wrapper"
73357334 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: No 'ex_doc' command found: it will (optionally) be downloaded when building the HTML documentation " >&5
73367335printf "%s\n" "$as_me: WARNING: No 'ex_doc' command found: it will (optionally) be downloaded when building the HTML documentation " >&2;}
73377336fi
Original file line number Diff line number Diff line change 474474
475475AC_CHECK_PROGS ( EX_DOC , ex_doc )
476476if test -z "$EX_DOC"; then
477- EX_DOC="$ERL_TOP/make/ex_doc_wrapper"
478477 AC_MSG_WARN ( [ No 'ex_doc' command found: it will (optionally) be downloaded when building the HTML documentation ] )
479478fi
480479
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk
2626include ../vsn.mk
2727VSN =$(COMMON_TEST_VSN )
2828APPLICATION =common_test
29+ EX_DOC_WARNINGS_AS_ERRORS =false
2930
3031# ----------------------------------------------------
3132# Release Target
Original file line number Diff line number Diff line change 5252DOC_TARGETS? =html
5353endif
5454
55+ EX_DOC_WARNINGS_AS_ERRORS? =true
56+
5557docs : $(DOC_TARGETS )
5658
5759chunks :
5860
5961HTML_DEPS? =$(wildcard $(APP_EBIN_DIR ) /* .beam) $(wildcard * .md) $(wildcard * /* .md) $(wildcard assets/* )
6062
61- $(HTMLDIR ) /index.html : $(HTML_DEPS ) docs.exs
62- $(gen_verbose ) ERL_FLAGS=" -pz $( ERL_TOP) /erts/ebin" \
63- $(EX_DOC ) $(EX_DOC_FORMATS ) --homepage-url " $( INDEX_DIR) /index.html" " $( APPLICATION) " $(VSN ) $(APP_EBIN_DIR ) -o " $( HTMLDIR) " -c $(ERL_TOP ) /make/ex_doc.exs
63+ $(HTMLDIR ) /index.html : $(HTML_DEPS ) docs.exs $( ERL_TOP ) /make/ex_doc.exs
64+ $(gen_verbose ) EX_DOC_WARNINGS_AS_ERRORS= $( EX_DOC_WARNINGS_AS_ERRORS ) ERL_FLAGS=" -pz $( ERL_TOP) /erts/ebin" \
65+ $(ERL_TOP ) /make/ex_doc_wrapper $(EX_DOC_FORMATS ) --homepage-url " $( INDEX_DIR) /index.html" " $( APPLICATION) " $(VSN ) $(APP_EBIN_DIR ) -o " $( HTMLDIR) " -c $(ERL_TOP ) /make/ex_doc.exs
6466
6567html : $(HTMLDIR ) /index.html
6668
Original file line number Diff line number Diff line change @@ -4,9 +4,9 @@ ARGS=("$@")
44
55set -eo pipefail {0}
66
7- if command -v ex_doc & > /dev/null ; then
8- exec ex_doc " ${ARGS[@]} "
9- else
7+ EX_DOC= $( command -v ex_doc || true )
8+
9+ if [ -z " ${EX_DOC} " ] ; then
1010 echo -n " Could not find ex_doc! "
1111 read -p " Do you want to download latest ex_doc from github? (y/n)? " -n 1 -r
1212 echo
1515 if $ERL_TOP /otp_build download_ex_doc; then
1616 read -p " Press any key to continue..." -n 1 -r
1717 echo " continuing"
18- exec ex_doc " ${ARGS[@]} "
18+ EX_DOC= $( command -v ex_doc || true )
1919 else
2020 exit 1
2121 fi
2222 else
2323 exit 1
2424 fi
2525fi
26+
27+ # # The below bash magic captures the output of stderr into OUTPUT while still printing
28+ # # everything we get to stdout and stderr. This is done by:
29+
30+ # # 1. duplicating the stdout (1) and stderr (2) streams to fd 3 and 4 respectively.
31+ exec 3>&1 4>&2
32+
33+ # # Running the command where we redirect stderr to fd 1 and stdout to fd 3.
34+ # # We then use tee on the stderr (which is now fd 1) to print that to fd 4
35+ OUTPUT=" $( { " ${EX_DOC} " " ${ARGS[@]} " ; } 2>&1 1>&3 | tee /dev/fd/4 ) "
36+
37+ # # Close fd 3 and 4
38+ exec 3>& - 4>& -
39+
40+ if [ " ${EX_DOC_WARNINGS_AS_ERRORS} " != " false" ]; then
41+ if echo " ${OUTPUT} " | grep " warning:" 1> /dev/null; then
42+ echo " ex_doc emitted warnings"
43+ # # Touch the config file in order to re-trigger make
44+ if [ -f " docs.exs" ]; then
45+ touch " docs.exs"
46+ fi
47+ exit 1;
48+ fi
49+ fi
You can’t perform that action at this time.
0 commit comments