-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add warnings as errors for ex_doc #8596
Changes from all commits
3f2487d
8d18ce9
3c3d26b
0a5025e
75913d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Next error I get from the nix build
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. stack trace
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this comes from https://github.com/elixir-lang/ex_doc/blob/v0.34.0/CHANGELOG.md#v0340-2024-05-30? i.e. I think this requires a specific version of ex_doc now. Unsure if that is intended? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will always require a specific version of ex_doc, which one is listed in https://github.com/erlang/otp/blob/master/make/ex_doc_vsn There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh, okay! Let me update that and keep testing thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are some bugs in v0.34.0 of ex_doc that cause some issues, so you may have to wait for v0.35.0 in order for everything to pass. |
||
logo: Path.join(:code.root_dir(), "system/doc/assets/erlang-logo.png"), | ||
before_closing_head_tag: fn _ -> "<style>.dark img { background-color: white; }</style>" end, | ||
before_closing_footer_tag: fn _ -> | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is fine because EX_DOC wouldn't have been defined previously |
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ testing | |
documentation | ||
system | ||
man_index.md | ||
README.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last question, should this be false by default?
I immediately had to turn it off in the nix build. Which worked by the way! Here is the simplification I was able to do with this https://github.com/chiroptical/nixpkgs/pull/4/files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I want it to be on by default as there should never be any warnings if you use the correct ExDoc vsn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get this from the build with that set to true.
I guess you may want to set this in the wrapper then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be something that needs fixing in nix I think. The Erlang VM thinks that filenames should be encoded in latin1 because the locale is not set to utf8.
The elixir nix package seems to set LANG and LC_TYPE to
C.UTF-8
which should do the trick.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess so! Really appreciate you looking through all this.