OleksandrKvl / sbepp

C++ implementation of the FIX Simple Binary Encoding
https://oleksandrkvl.github.io/sbepp/
MIT License
43 stars 4 forks source link

Generator does not regenerate the parser if XML schema file is revereted #74

Closed ujos closed 3 hours ago

ujos commented 4 hours ago

I have a CMakeLists.txt file with the following content:

cmake_minimum_required(VERSION 3.15)

project(SomeProject.Schema CXX)

sbeppc_compile_schema(
    TARGET_NAME ${PROJECT_NAME}
    SCHEMA_FILE "${CMAKE_CURRENT_LIST_DIR}/protocol.xml"
)

On our build server GIT is configured to update the file timestamp to the timestamp of the commit. So the timestamps can increase and decrease.

The problem is that SBEPP C++ Parser Generator does not regenerate the C++ code if timestamp of the SBE XML Schema file is decreased.

How to reproduce the issue:

  1. Create sample project and compile it.
  2. Go to the SBE XML Schema file folder
  3. Modify the SBE XML schema (add or remove message)
  4. Execute the following command line, so the timestamp of the file goes back to the past.
    touch -t 202409010000 protocol.xml
  5. Compile the project again

Expected: the C++ code is regenerated In fact: Either CMake or SBEPP Generator do not regenerate the C++ code

ujos commented 3 hours ago

Looks like it is the issue on the GNU Make side, not SBEPP

OleksandrKvl commented 1 hour ago

I never thought about this but I'd expect that make (or any other build system) should trigger rebuild if prev_timestamp != current_timestamp, it would be a surprise if it checks if it's greater/lower. You can try to test if ninja behaves in the same way.