File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 5353
5454set -x
5555{erlang_home}/bin/dialyzer {apps_args} {plt_args}\\
56- -c {dirs} {opts} || test $? -eq 2
56+ {dirs} {opts}{check_warnings}
5757""" .format (
5858 begins_with_fun = BEGINS_WITH_FUN ,
5959 query_erlang_version = QUERY_ERL_VERSION ,
6464 name = ctx .label .name ,
6565 dirs = " " .join (dirs ),
6666 opts = " " .join (ctx .attr .dialyzer_opts ),
67+ check_warnings = " || test $? -eq 2" if not ctx .attr .warnings_as_errors else "" ,
6768 )
6869 else :
6970 output = ctx .actions .declare_file (ctx .label .name + ".bat" )
@@ -72,9 +73,9 @@ echo Erlang Version: {erlang_version}
7273
7374echo on
7475"{erlang_home}\\ bin\\ dialyzer" {apps_args} {plt_args} ^
75- -c {dirs} {opts}
76+ {dirs} {opts}
7677if %ERRORLEVEL% EQU 0 EXIT /B 0
77- if %ERRORLEVEL% EQU 2 EXIT /B 0
78+ {check_warnings}
7879EXIT /B 1
7980""" .format (
8081 erlang_home = windows_path (ctx .attr ._erlang_home [ErlangHomeProvider ].path ),
@@ -84,6 +85,7 @@ EXIT /B 1
8485 name = ctx .label .name ,
8586 dirs = " " .join (dirs ),
8687 opts = " " .join (ctx .attr .dialyzer_opts ),
88+ check_warnings = "if %ERRORLEVEL% EQU 2 EXIT /B 0" if not ctx .attr .warnings_as_errors else "" ,
8789 )
8890
8991 ctx .actions .write (
@@ -123,6 +125,7 @@ dialyze_test = rule(
123125 "-Wunmatched_returns" ,
124126 ],
125127 ),
128+ "warnings_as_errors" : attr .bool (default = True ),
126129 },
127130 test = True ,
128131)
You can’t perform that action at this time.
0 commit comments