Add frozen TikZRefinery demo baseline and build pipeline
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
# Invoked on every build; replace generated files only when the identity changes.
|
||||
set(strCheckpoint "unavailable")
|
||||
set(strSourceState "source state unavailable")
|
||||
if(GIT_EXECUTABLE AND EXISTS "${GIT_EXECUTABLE}")
|
||||
execute_process(COMMAND "${GIT_EXECUTABLE}" -C "${SOURCE_ROOT}" rev-parse HEAD
|
||||
OUTPUT_VARIABLE strHash OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE iGitResult)
|
||||
if(iGitResult EQUAL 0 AND strHash MATCHES "^[0-9a-f]+$")
|
||||
set(strCheckpoint "${strHash}")
|
||||
execute_process(COMMAND "${GIT_EXECUTABLE}" -C "${SOURCE_ROOT}" status --porcelain --untracked-files=normal
|
||||
OUTPUT_VARIABLE strStatus OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE iStatusResult)
|
||||
if(iStatusResult EQUAL 0)
|
||||
if(strStatus STREQUAL "")
|
||||
set(strSourceState "clean checkpoint")
|
||||
else()
|
||||
set(strSourceState "modified working tree")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT REPORT_VERSION)
|
||||
set(REPORT_VERSION "${PROJECT_VERSION}")
|
||||
endif()
|
||||
set(strShortCheckpoint "${strCheckpoint}")
|
||||
set(iShortCheckpointLength 12)
|
||||
if(NOT strCheckpoint STREQUAL "unavailable")
|
||||
string(SUBSTRING "${strCheckpoint}" 0 ${iShortCheckpointLength} strShortCheckpoint)
|
||||
endif()
|
||||
file(MAKE_DIRECTORY "${BINARY_ROOT}/generated")
|
||||
set(strHeader "#pragma once\nnamespace TikzRefinery::BuildInfo {\ninline constexpr char pVersion[] = \"${REPORT_VERSION}\";\ninline constexpr char pMaturity[] = \"Alpha\";\ninline constexpr char pCheckpoint[] = \"${strCheckpoint}\";\ninline constexpr char pShortCheckpoint[] = \"${strShortCheckpoint}\";\ninline constexpr char pSourceState[] = \"${strSourceState}\";\n}\n")
|
||||
set(strJson "{\n \"applicationVersion\": \"${REPORT_VERSION}\",\n \"maturity\": \"Alpha\",\n \"sourceCheckpoint\": \"${strCheckpoint}\",\n \"sourceCheckpointShort\": \"${strShortCheckpoint}\",\n \"sourceState\": \"${strSourceState}\"\n}\n")
|
||||
foreach(strOutput IN ITEMS header json)
|
||||
if(strOutput STREQUAL "header")
|
||||
set(strPath "${BINARY_ROOT}/generated/BuildInfo.h")
|
||||
set(strContent "${strHeader}")
|
||||
else()
|
||||
set(strPath "${BINARY_ROOT}/build-info.json")
|
||||
set(strContent "${strJson}")
|
||||
endif()
|
||||
if(EXISTS "${strPath}")
|
||||
file(READ "${strPath}" strExisting)
|
||||
else()
|
||||
set(strExisting "")
|
||||
endif()
|
||||
if(NOT strExisting STREQUAL strContent)
|
||||
file(WRITE "${strPath}" "${strContent}")
|
||||
endif()
|
||||
endforeach()
|
||||
Reference in New Issue
Block a user