1# Generate .plt file, if it doesn't exist
2GET_FILENAME_COMPONENT (_real_couchdb_src "${COUCHDB_SRC}" 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_SRC}/src/mochiweb
10    ${COUCHDB_SRC}/src/snappy ${COUCHDB_SRC}/src/etap
11    # MISSING?  ${_real_couchdb_src}/src/ibrowse
12    ${_real_couchdb_src}/src/lhttpc
13    ${COUCHDB_SRC}/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_SRC}/src/mochiweb
18    ${COUCHDB_SRC}/src/snappy ${COUCHDB_SRC}/src/etap
19    # MISSING?  ${_real_couchdb_src}/src/ibrowse
20    ${_real_couchdb_src}/src/lhttpc
21    ${COUCHDB_SRC}/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_SRC}/src/couchdb ${COUCHDB_SRC}/src/couch_set_view ${COUCHDB_SRC}/src/couch_view_parser
35  ${COUCHDB_SRC}/src/couch_index_merger/ebin
36  ${_real_couchdb_src}/src/mapreduce
37  deps/ns_babysitter/ebin
38  deps/ns_ssl_proxy/ebin)
39EXECUTE_PROCESS (RESULT_VARIABLE _failure
40  COMMAND dialyzer --plt "${COUCHBASE_PLT}" ${DIALYZER_FLAGS}
41  --apps ${beamfiles}
42  deps/ale/ebin
43  ${COUCHDB_SRC}/src/couchdb ${COUCHDB_SRC}/src/couch_set_view ${COUCHDB_SRC}/src/couch_view_parser
44  ${COUCHDB_SRC}/src/couch_index_merger/ebin
45  ${_real_couchdb_src}/src/mapreduce
46  deps/ns_babysitter/ebin
47  deps/ns_ssl_proxy/ebin)
48IF (_failure)
49  MESSAGE (FATAL_ERROR "failed running dialyzer")
50ENDIF (_failure)
51