diff --git a/.gitignore b/.gitignore index a9d88a7bf9ee..0329c75ef567 100644 --- a/.gitignore +++ b/.gitignore @@ -142,7 +142,7 @@ JAVADOC-GENERATED /doc /make/output.mk -/make/emd2exml +/make/ex_doc_wrapper /make/make_emakefile /make/install_dir_data.sh diff --git a/erts/configure b/erts/configure index 4a89d597e7d0..b0bc1111d503 100755 --- a/erts/configure +++ b/erts/configure @@ -7331,7 +7331,6 @@ fi done if test -z "$EX_DOC"; then - EX_DOC="$ERL_TOP/make/ex_doc_wrapper" { 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 printf "%s\n" "$as_me: WARNING: No 'ex_doc' command found: it will (optionally) be downloaded when building the HTML documentation " >&2;} fi @@ -26903,6 +26902,9 @@ ac_config_files="$ac_config_files emulator/$host/Makefile:emulator/Makefile.in e ac_config_files="$ac_config_files ../make/make_emakefile:../make/make_emakefile.in" +ac_config_files="$ac_config_files ../make/ex_doc_wrapper:../make/ex_doc_wrapper.in" + + ac_config_files="$ac_config_files ../lib/os_mon/c_src/$host/Makefile:../lib/os_mon/c_src/Makefile.in ../lib/runtime_tools/c_src/$host/Makefile:../lib/runtime_tools/c_src/Makefile.in" @@ -27616,6 +27618,7 @@ do "lib_src/$host/Makefile") CONFIG_FILES="$CONFIG_FILES lib_src/$host/Makefile:lib_src/Makefile.in" ;; "../make/$host/otp.mk") CONFIG_FILES="$CONFIG_FILES ../make/$host/otp.mk:../make/otp.mk.in" ;; "../make/make_emakefile") CONFIG_FILES="$CONFIG_FILES ../make/make_emakefile:../make/make_emakefile.in" ;; + "../make/ex_doc_wrapper") CONFIG_FILES="$CONFIG_FILES ../make/ex_doc_wrapper:../make/ex_doc_wrapper.in" ;; "../lib/os_mon/c_src/$host/Makefile") CONFIG_FILES="$CONFIG_FILES ../lib/os_mon/c_src/$host/Makefile:../lib/os_mon/c_src/Makefile.in" ;; "../lib/runtime_tools/c_src/$host/Makefile") CONFIG_FILES="$CONFIG_FILES ../lib/runtime_tools/c_src/$host/Makefile:../lib/runtime_tools/c_src/Makefile.in" ;; "../make/install_dir_data.sh") CONFIG_FILES="$CONFIG_FILES ../make/install_dir_data.sh:../make/install_dir_data.sh.in" ;; @@ -28172,6 +28175,7 @@ printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} case $ac_file$ac_mode in "../make/make_emakefile":F) chmod +x ../make/make_emakefile ;; + "../make/ex_doc_wrapper":F) chmod +x ../make/ex_doc_wrapper ;; "../make/install_dir_data.sh":F) chmod +x ../make/install_dir_data.sh ;; esac diff --git a/erts/configure.ac b/erts/configure.ac index 9185e62a1796..ddf6317c262e 100644 --- a/erts/configure.ac +++ b/erts/configure.ac @@ -474,7 +474,6 @@ fi AC_CHECK_PROGS(EX_DOC, ex_doc) if test -z "$EX_DOC"; then - EX_DOC="$ERL_TOP/make/ex_doc_wrapper" AC_MSG_WARN([No 'ex_doc' command found: it will (optionally) be downloaded when building the HTML documentation ]) fi @@ -3677,6 +3676,9 @@ AC_CONFIG_FILES([ AC_CONFIG_FILES([../make/make_emakefile:../make/make_emakefile.in], [chmod +x ../make/make_emakefile]) +AC_CONFIG_FILES([../make/ex_doc_wrapper:../make/ex_doc_wrapper.in], + [chmod +x ../make/ex_doc_wrapper]) + dnl dnl The ones below should be moved to their respective lib dnl diff --git a/lib/common_test/doc/Makefile b/lib/common_test/doc/Makefile index 66722a56f7c5..236b312853af 100644 --- a/lib/common_test/doc/Makefile +++ b/lib/common_test/doc/Makefile @@ -26,6 +26,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk include ../vsn.mk VSN=$(COMMON_TEST_VSN) APPLICATION=common_test +EX_DOC_WARNINGS_AS_ERRORS=false # ---------------------------------------------------- # Release Target diff --git a/lib/tftp/src/tftp.erl b/lib/tftp/src/tftp.erl index dc2fbf1d53e5..8378b00186f9 100644 --- a/lib/tftp/src/tftp.erl +++ b/lib/tftp/src/tftp.erl @@ -49,7 +49,7 @@ This is a complete implementation of the following IETF standards: The only feature that not is implemented in this release is the "netascii" transfer mode. -The [start/](`start/3`)function starts a daemon process which, listens +The [start](`start/1`) function starts a daemon process which, listens for UDP packets on a port. When it receives a request for read or write it spawns a temporary server process which handles the actual transfer of the file. On the client side the diff --git a/make/doc.mk b/make/doc.mk index 8425938ca99e..f0dcfb5b8e39 100644 --- a/make/doc.mk +++ b/make/doc.mk @@ -52,15 +52,17 @@ else DOC_TARGETS?=html endif +EX_DOC_WARNINGS_AS_ERRORS?=true + docs: $(DOC_TARGETS) chunks: HTML_DEPS?=$(wildcard $(APP_EBIN_DIR)/*.beam) $(wildcard *.md) $(wildcard */*.md) $(wildcard assets/*) -$(HTMLDIR)/index.html: $(HTML_DEPS) docs.exs - $(gen_verbose)ERL_FLAGS="-pz $(ERL_TOP)/erts/ebin" \ - $(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 +$(HTMLDIR)/index.html: $(HTML_DEPS) docs.exs $(ERL_TOP)/make/ex_doc.exs + $(gen_verbose)EX_DOC_WARNINGS_AS_ERRORS=$(EX_DOC_WARNINGS_AS_ERRORS) ERL_FLAGS="-pz $(ERL_TOP)/erts/ebin" \ + $(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 html: $(HTMLDIR)/index.html diff --git a/make/ex_doc.exs b/make/ex_doc.exs index 606ccac3a6ea..4561df526d32 100644 --- a/make/ex_doc.exs +++ b/make/ex_doc.exs @@ -151,7 +151,7 @@ current_datetime = System.os_time() |> DateTime.from_unix!(:native) config = [ proglang: :erlang, source_url_pattern: source_url_pattern, - assets: Path.join(cwd, "/assets"), + assets: %{ Path.join(cwd, "/assets") => "assets" }, logo: Path.join(:code.root_dir(), "system/doc/assets/erlang-logo.png"), before_closing_head_tag: fn _ -> "" end, before_closing_footer_tag: fn _ -> diff --git a/make/ex_doc_wrapper b/make/ex_doc_wrapper deleted file mode 100755 index f82c219e1544..000000000000 --- a/make/ex_doc_wrapper +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -ARGS=("$@") - -set -eo pipefail {0} - -if command -v ex_doc &> /dev/null; then - exec ex_doc "${ARGS[@]}" -else - echo -n "Could not find ex_doc! " - read -p "Do you want to download latest ex_doc from github? (y/n)? " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]] - then - if $ERL_TOP/otp_build download_ex_doc; then - read -p "Press any key to continue..." -n 1 -r - echo "continuing" - exec ex_doc "${ARGS[@]}" - else - exit 1 - fi - else - exit 1 - fi -fi diff --git a/make/ex_doc_wrapper.in b/make/ex_doc_wrapper.in new file mode 100755 index 000000000000..8f9b06df31b3 --- /dev/null +++ b/make/ex_doc_wrapper.in @@ -0,0 +1,52 @@ +#!/bin/bash + +ARGS=("$@") + +set -eo pipefail {0} + +## If EX_DOC is not set to a file, we search the PATH for it using command -v +if [ ! -f "${EX_DOC}" ]; then + EX_DOC=$(command -v ex_doc || true) +fi + +if [ -z "${EX_DOC}" ]; then + echo -n "Could not find ex_doc! " + read -p "Do you want to download latest ex_doc from github? (y/n)? " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]] + then + if $ERL_TOP/otp_build download_ex_doc; then + read -p "Press any key to continue..." -n 1 -r + echo "continuing" + EX_DOC=$(command -v ex_doc || true) + else + exit 1 + fi + else + exit 1 + fi +fi + +## The below bash magic captures the output of stderr into OUTPUT while still printing +## everything we get to stdout and stderr. This is done by: + +## 1. duplicating the stdout (1) and stderr (2) streams to fd 3 and 4 respectively. +exec 3>&1 4>&2 + +## Running the command where we redirect stderr to fd 1 and stdout to fd 3. +## We then use tee on the stderr (which is now fd 1) to print that to fd 4 +OUTPUT="$( { escript@EXEEXT@ "${EX_DOC}" "${ARGS[@]}"; } 2>&1 1>&3 | tee /dev/fd/4 )" + +## Close fd 3 and 4 +exec 3>&- 4>&- + +if [ "${EX_DOC_WARNINGS_AS_ERRORS}" != "false" ]; then + if echo "${OUTPUT}" | grep "warning:" 1>/dev/null; then + echo "ex_doc emitted warnings" + ## Touch the config file in order to re-trigger make + if [ -f "docs.exs" ]; then + touch "docs.exs" + fi + exit 1; + fi +fi diff --git a/system/doc/top/.gitignore b/system/doc/top/.gitignore index 461d1a1dd2ca..85edf9eb6316 100644 --- a/system/doc/top/.gitignore +++ b/system/doc/top/.gitignore @@ -7,3 +7,4 @@ testing documentation system man_index.md +README.md