Skip to content

Commit

Permalink
AppVeyor, Travis: treat OCaml warnings as errors
Browse files Browse the repository at this point in the history
OCaml warnings still treated as only warnings during regular builds
outside the build bots.
  • Loading branch information
aantron committed Nov 25, 2016
1 parent dadb926 commit 5d0cf79
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ matrix:
- os: osx
env: COMPILER=4.03 PACKAGE_MANAGER=macports LIBEV=yes

env:
global:
- LWT_WARNINGS_AS_ERRORS=yes

script: bash -e utils/travis.sh

notifications:
Expand Down
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ environment:
- {SYSTEM: cygwin, ARCH: x86, COMPILER: 4.04}
- {SYSTEM: mingw, ARCH: x86_64, COMPILER: 4.03}

global:
LWT_WARNINGS_AS_ERRORS: yes

install:
- 'IF "%ARCH%"=="x86" ( SET CYGSH=C:\Cygwin\bin\bash -lc ) ELSE ( SET CYGSH=C:\Cygwin64\bin\bash -lc )'
- ps: '(new-object net.webclient).DownloadString("https://aantron.github.io/binaries/$env:SYSTEM/$env:ARCH/ocaml/$env:COMPILER/install.ps1") | PowerShell -Command -'
Expand Down
14 changes: 13 additions & 1 deletion myocamlbuild.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ let define_c_library name env =
flag ["link"; "ocaml"; tag] & S (List.map (fun arg -> S[A"-cclib"; arg]) lib)
end

let conditional_warnings_as_errors () =
match Sys.getenv "LWT_WARNINGS_AS_ERRORS" with
| "yes" ->
let flags = S [A "-warn-error"; A "+A"] in
flag ["ocaml"; "compile"] flags;
flag ["ocaml"; "link"] flags

| _ -> ()
| exception Not_found -> ()

let () =
dispatch
(fun hook ->
Expand Down Expand Up @@ -119,7 +129,9 @@ let () =
end;

List.iter (fun name ->
mark_tag_used (c_library_tag name)) c_libraries
mark_tag_used (c_library_tag name)) c_libraries;

conditional_warnings_as_errors ()

| _ ->
())
Expand Down

0 comments on commit 5d0cf79

Please sign in to comment.