Release: cut over Echoion 2.0 components
Modular container CI / release-build (push) Has been cancelled
Modular container CI / release-build (push) Has been cancelled
This commit is contained in:
169 files changed
+3069
-32261
No files matched your search
+115
-25
@@ -1,46 +1,136 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
set(ECHOION_COMPONENT_REGISTRY
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../components.json"
|
||||
CACHE FILEPATH "Echoion component repository registry")
|
||||
set(ECHOION_COMPONENT_LOCK
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../components.lock.json"
|
||||
CACHE FILEPATH "Echoion component repository lock file")
|
||||
CACHE FILEPATH "Echoion component release lock")
|
||||
option(ECHOION_RELEASE_BUILD
|
||||
"Resolve Echoion components at exact revisions from components.lock.json"
|
||||
OFF)
|
||||
|
||||
if(NOT EXISTS "${ECHOION_COMPONENT_LOCK}")
|
||||
message(FATAL_ERROR
|
||||
"Echoion component lock does not exist: ${ECHOION_COMPONENT_LOCK}")
|
||||
endif()
|
||||
foreach(_echoionComponentFile IN ITEMS
|
||||
"${ECHOION_COMPONENT_REGISTRY}" "${ECHOION_COMPONENT_LOCK}")
|
||||
if(NOT EXISTS "${_echoionComponentFile}")
|
||||
message(FATAL_ERROR
|
||||
"Echoion component metadata does not exist: "
|
||||
"${_echoionComponentFile}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
file(READ "${ECHOION_COMPONENT_REGISTRY}" _echoionComponentRegistryJson)
|
||||
file(READ "${ECHOION_COMPONENT_LOCK}" _echoionComponentLockJson)
|
||||
string(JSON _echoionComponentLockSchema ERROR_VARIABLE _echoionLockError
|
||||
|
||||
string(JSON _echoionRegistrySchema ERROR_VARIABLE _echoionRegistryError
|
||||
GET "${_echoionComponentRegistryJson}" schemaVersion)
|
||||
string(JSON _echoionLockSchema ERROR_VARIABLE _echoionLockError
|
||||
GET "${_echoionComponentLockJson}" schemaVersion)
|
||||
if(_echoionLockError OR NOT _echoionComponentLockSchema EQUAL 1)
|
||||
if(_echoionRegistryError OR NOT _echoionRegistrySchema EQUAL 1)
|
||||
message(FATAL_ERROR
|
||||
"Unsupported Echoion component registry: "
|
||||
"${ECHOION_COMPONENT_REGISTRY}")
|
||||
endif()
|
||||
if(_echoionLockError OR NOT _echoionLockSchema EQUAL 2)
|
||||
message(FATAL_ERROR
|
||||
"Unsupported Echoion component lock: ${ECHOION_COMPONENT_LOCK}")
|
||||
endif()
|
||||
|
||||
string(JSON _echoionLockedProductVersion
|
||||
GET "${_echoionComponentLockJson}" productVersion)
|
||||
if(ECHOION_RELEASE_BUILD AND
|
||||
NOT _echoionLockedProductVersion STREQUAL ECHOION_PRODUCT_VERSION)
|
||||
message(FATAL_ERROR
|
||||
"components.lock.json productVersion "
|
||||
"${_echoionLockedProductVersion} does not match root version "
|
||||
"${ECHOION_PRODUCT_VERSION}")
|
||||
endif()
|
||||
|
||||
function(echoion_add_component component)
|
||||
string(JSON repository ERROR_VARIABLE repositoryError
|
||||
GET "${_echoionComponentLockJson}" components "${component}" url)
|
||||
string(JSON revision ERROR_VARIABLE revisionError
|
||||
GET "${_echoionComponentLockJson}" components "${component}" revision)
|
||||
if(repositoryError OR revisionError OR repository STREQUAL "" OR
|
||||
revision STREQUAL "")
|
||||
GET "${_echoionComponentRegistryJson}"
|
||||
components "${component}" url)
|
||||
string(JSON branch ERROR_VARIABLE branchError
|
||||
GET "${_echoionComponentRegistryJson}"
|
||||
components "${component}" branch)
|
||||
if(repositoryError OR branchError OR repository STREQUAL "" OR
|
||||
branch STREQUAL "")
|
||||
message(FATAL_ERROR
|
||||
"Component ${component} is incomplete in "
|
||||
"${ECHOION_COMPONENT_LOCK}")
|
||||
"${ECHOION_COMPONENT_REGISTRY}")
|
||||
endif()
|
||||
|
||||
# A workspace created by scripts/sync-components.py or by the Gitea
|
||||
# workflow wins over network fetching. This keeps private credentials out
|
||||
# of Docker while a clean public checkout can still resolve through CPM.
|
||||
set(localSource "${CMAKE_SOURCE_DIR}/${component}")
|
||||
if(EXISTS "${localSource}/CMakeLists.txt")
|
||||
set("CPM_${component}_SOURCE" "${localSource}" CACHE PATH
|
||||
"Local ${component} source directory")
|
||||
set(sourceVariable "CPM_${component}_SOURCE")
|
||||
if(DEFINED ${sourceVariable} AND
|
||||
NOT "${${sourceVariable}}" STREQUAL "")
|
||||
set(revision "${branch}")
|
||||
message(STATUS
|
||||
"Echoion component ${component}: local override "
|
||||
"${${sourceVariable}}")
|
||||
elseif(ECHOION_RELEASE_BUILD)
|
||||
string(JSON revision ERROR_VARIABLE revisionError
|
||||
GET "${_echoionComponentLockJson}"
|
||||
components "${component}" revision)
|
||||
if(revisionError OR revision STREQUAL "")
|
||||
message(FATAL_ERROR
|
||||
"Component ${component} has no locked release revision")
|
||||
endif()
|
||||
message(STATUS
|
||||
"Echoion component ${component}: locked ${revision}")
|
||||
else()
|
||||
set(revision "${branch}")
|
||||
message(STATUS
|
||||
"Echoion component ${component}: development ${branch}")
|
||||
endif()
|
||||
|
||||
CPMAddPackage(
|
||||
NAME "${component}"
|
||||
GIT_REPOSITORY "${repository}"
|
||||
GIT_TAG "${revision}"
|
||||
)
|
||||
if(ECHOION_RELEASE_BUILD)
|
||||
string(JSON componentVersion ERROR_VARIABLE componentVersionError
|
||||
GET "${_echoionComponentLockJson}"
|
||||
components "${component}" componentVersion)
|
||||
if(componentVersionError OR componentVersion STREQUAL "")
|
||||
message(FATAL_ERROR
|
||||
"Component ${component} has no locked component version")
|
||||
endif()
|
||||
# Component projects intentionally accept ECHOION_PRODUCT_VERSION when
|
||||
# embedded. Scope the independently derived version to this CPM call;
|
||||
# the root product version remains unchanged for the next component.
|
||||
set(ECHOION_PRODUCT_VERSION "${componentVersion}")
|
||||
set(ECHOION_COMPONENT_VERSION "${componentVersion}")
|
||||
message(STATUS
|
||||
"Echoion component ${component}: version ${componentVersion}")
|
||||
endif()
|
||||
|
||||
set(componentOptions "")
|
||||
string(JSON optionCount ERROR_VARIABLE optionsError
|
||||
LENGTH "${_echoionComponentRegistryJson}"
|
||||
components "${component}" buildOptions)
|
||||
if(NOT optionsError AND optionCount GREATER 0)
|
||||
math(EXPR optionLast "${optionCount} - 1")
|
||||
foreach(optionIndex RANGE 0 ${optionLast})
|
||||
string(JSON optionName MEMBER
|
||||
"${_echoionComponentRegistryJson}"
|
||||
components "${component}" buildOptions ${optionIndex})
|
||||
string(JSON optionValue GET
|
||||
"${_echoionComponentRegistryJson}"
|
||||
components "${component}" buildOptions "${optionName}")
|
||||
list(APPEND componentOptions "${optionName} ${optionValue}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(componentOptions)
|
||||
CPMAddPackage(
|
||||
NAME "${component}"
|
||||
GIT_REPOSITORY "${repository}"
|
||||
GIT_TAG "${revision}"
|
||||
OPTIONS ${componentOptions})
|
||||
else()
|
||||
CPMAddPackage(
|
||||
NAME "${component}"
|
||||
GIT_REPOSITORY "${repository}"
|
||||
GIT_TAG "${revision}")
|
||||
endif()
|
||||
|
||||
if(DEFINED ${component}_SOURCE_DIR)
|
||||
set(${component}_SOURCE_DIR "${${component}_SOURCE_DIR}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
Reference in new issue
Block a user