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/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/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_api_wrap(_httpc)?).beam\;?" "" beamfiles "${beamfiles}")
27
28FILE (GLOB couchdb_beamfiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" deps/ns_couchdb/ebin/*.beam)
29STRING (REGEX REPLACE "deps/ns_couchdb/ebin/couch_log.beam\;?" "" couchdb_beamfiles "${couchdb_beamfiles}")
30
31# If you update the dialyzer command, please also update this echo
32# command so it displays what is invoked. Yes, this is annoying.
33EXECUTE_PROCESS (COMMAND "${CMAKE_COMMAND}" -E echo
34  dialyzer --plt "${COUCHBASE_PLT}" ${DIALYZER_FLAGS}
35  --apps ${beamfiles}
36  deps/ale/ebin
37  ${_couchdb_bin_dir}/src/couchdb ${_couchdb_bin_dir}/src/couch_set_view ${_couchdb_bin_dir}/src/couch_view_parser
38  ${_couchdb_bin_dir}/src/couch_index_merger/ebin
39  ${_couchdb_bin_dir}/src/mapreduce
40  deps/ns_babysitter/ebin
41  deps/ns_ssl_proxy/ebin
42  ${couchdb_beamfiles})
43EXECUTE_PROCESS (RESULT_VARIABLE _failure
44  COMMAND dialyzer --plt "${COUCHBASE_PLT}" ${DIALYZER_FLAGS}
45  --apps ${beamfiles}
46  deps/ale/ebin
47  ${_couchdb_bin_dir}/src/couchdb ${_couchdb_bin_dir}/src/couch_set_view ${_couchdb_bin_dir}/src/couch_view_parser
48  ${_couchdb_bin_dir}/src/couch_index_merger/ebin
49  ${_couchdb_bin_dir}/src/mapreduce
50  deps/ns_babysitter/ebin
51  deps/ns_ssl_proxy/ebin
52  ${couchdb_beamfiles})
53IF (_failure)
54  MESSAGE (FATAL_ERROR "failed running dialyzer")
55ENDIF (_failure)
56