1# Generate .plt file, if it doesn't exist
2GET_FILENAME_COMPONENT (_couchdb_bin_dir "${COUCHDB_BIN_DIR}" REALPATH)
3
4IF (NOT EXISTS "${COUCHBASE_PLT}")
5  MESSAGE ("Generating ${COUCHBASE_PLT}...")
6  EXECUTE_PROCESS (COMMAND "${CMAKE_COMMAND}" -E echo
7    dialyzer --output_plt "${COUCHBASE_PLT}" --build_plt
8    --apps compiler crypto erts inets kernel os_mon sasl ssl stdlib xmerl
9    ${_couchdb_bin_dir}/src/mochiweb
10    ${_couchdb_bin_dir}/src/snappy ${_couchdb_bin_dir}/src/etap
11    # MISSING?  ${_couchdb_bin_dir}/src/ibrowse
12    ${_couchdb_bin_dir}/src/lhttpc
13    ${_couchdb_bin_dir}/src/erlang-oauth deps/erlwsh/ebin deps/gen_smtp/ebin)
14
15  EXECUTE_PROCESS (COMMAND dialyzer --output_plt "${COUCHBASE_PLT}" --build_plt
16    --apps compiler crypto erts inets kernel os_mon sasl ssl stdlib xmerl
17    ${_couchdb_bin_dir}/src/mochiweb
18    ${_couchdb_bin_dir}/src/snappy ${_couchdb_bin_dir}/src/etap
19    # MISSING?  ${_couchdb_bin_dir}/src/ibrowse
20    ${_couchdb_bin_dir}/src/lhttpc
21    ${_couchdb_bin_dir}/src/erlang-oauth deps/erlwsh/ebin deps/gen_smtp/ebin)
22ENDIF (NOT EXISTS "${COUCHBASE_PLT}")
23
24# Compute list of .beam files
25FILE (GLOB beamfiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" ebin/*.beam)
26STRING (REGEX REPLACE "ebin/(couch_log|couch_api_wrap(_httpc)?).beam\;?" "" beamfiles "${beamfiles}")
27
28# If you update the dialyzer command, please also update this echo
29# command so it displays what is invoked. Yes, this is annoying.
30EXECUTE_PROCESS (COMMAND "${CMAKE_COMMAND}" -E echo
31  dialyzer --plt "${COUCHBASE_PLT}" ${DIALYZER_FLAGS}
32  --apps ${beamfiles}
33  deps/ale/ebin
34  ${_couchdb_bin_dir}/src/couchdb ${_couchdb_bin_dir}/src/couch_set_view ${_couchdb_bin_dir}/src/couch_view_parser
35  ${_couchdb_bin_dir}/src/couch_index_merger/ebin
36  ${_couchdb_bin_dir}/src/mapreduce
37  deps/ns_babysitter/ebin
38  deps/ns_ssl_proxy/ebin
39  deps/ns_couchdb/ebin)
40EXECUTE_PROCESS (RESULT_VARIABLE _failure
41  COMMAND dialyzer --plt "${COUCHBASE_PLT}" ${DIALYZER_FLAGS}
42  --apps ${beamfiles}
43  deps/ale/ebin
44  ${_couchdb_bin_dir}/src/couchdb ${_couchdb_bin_dir}/src/couch_set_view ${_couchdb_bin_dir}/src/couch_view_parser
45  ${_couchdb_bin_dir}/src/couch_index_merger/ebin
46  ${_couchdb_bin_dir}/src/mapreduce
47  deps/ns_babysitter/ebin
48  deps/ns_ssl_proxy/ebin
49  deps/ns_couchdb/ebin)
50IF (_failure)
51  MESSAGE (FATAL_ERROR "failed running dialyzer")
52ENDIF (_failure)
53