Add build step to verify json formatting
This will run autojson during the build to verify
that all files are formatted correctly.
Tested: Before this change build failed, after
fixing json file, it passed
Change-Id: I119cc898536a972bb7a248143b40d695f880ff2f
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 214db49..c6f7d8a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,6 +117,19 @@
target_link_libraries (entityManagerTests ${Boost_LIBRARIES})
target_link_libraries (entityManagerTests sdbusplus)
+ find_package (PythonInterp REQUIRED)
+ find_package (Git REQUIRED)
+ execute_process (COMMAND ${PYTHON_EXECUTABLE}
+ ${CMAKE_CURRENT_SOURCE_DIR}/scripts/autojson.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/configurations)
+ execute_process (COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}
+ diff
+ --quiet configurations
+ RESULT_VARIABLE ret)
+ if (ret EQUAL "1")
+ message (FATAL_ERROR
+ "Invalid JSON Format, Please rerun scripts/autojson.")
+ endif ()
endif ()
add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY)