54 lines
2.8 KiB
CMake
54 lines
2.8 KiB
CMake
if(NOT DEFINED ADMINIVE_BINARY_DIR)
|
|
message(FATAL_ERROR "ADMINIVE_BINARY_DIR is required")
|
|
endif()
|
|
if(NOT DEFINED ADMINIVE_CONFIG OR ADMINIVE_CONFIG STREQUAL "")
|
|
set(ADMINIVE_CONFIG Release)
|
|
endif()
|
|
get_filename_component(adminive_root "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
|
|
set(adminive_zip "${adminive_root}/Adminive.zip")
|
|
execute_process(COMMAND "${CMAKE_COMMAND}" --build "${ADMINIVE_BINARY_DIR}" --target package_zip --config "${ADMINIVE_CONFIG}" RESULT_VARIABLE build_result)
|
|
if(NOT build_result EQUAL 0)
|
|
message(FATAL_ERROR "package_zip build failed: ${build_result}")
|
|
endif()
|
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E tar tf "${adminive_zip}" OUTPUT_VARIABLE archive_list RESULT_VARIABLE list_result)
|
|
if(NOT list_result EQUAL 0)
|
|
message(FATAL_ERROR "package_zip listing failed: ${list_result}")
|
|
endif()
|
|
string(REPLACE "\r\n" "\n" archive_list "${archive_list}")
|
|
string(REPLACE "\n" ";" archive_entries "${archive_list}")
|
|
set(root_cmake_count 0)
|
|
set(root_readme_count 0)
|
|
set(root_gitignore_count 0)
|
|
set(root_agents_count 0)
|
|
set(adminive_skill_count 0)
|
|
set(structive_agents_count 0)
|
|
set(structive_skill_count 0)
|
|
foreach(entry IN LISTS archive_entries)
|
|
if(entry MATCHES "^Adminive/")
|
|
message(FATAL_ERROR "package_zip contains nested stale project entry: ${entry}")
|
|
endif()
|
|
if(entry STREQUAL "CMakeLists.txt")
|
|
math(EXPR root_cmake_count "${root_cmake_count} + 1")
|
|
elseif(entry STREQUAL "README.md")
|
|
math(EXPR root_readme_count "${root_readme_count} + 1")
|
|
elseif(entry STREQUAL ".gitignore")
|
|
math(EXPR root_gitignore_count "${root_gitignore_count} + 1")
|
|
elseif(entry STREQUAL "AGENTS.md")
|
|
math(EXPR root_agents_count "${root_agents_count} + 1")
|
|
elseif(entry STREQUAL ".agents/skills/adminive-development/SKILL.md")
|
|
math(EXPR adminive_skill_count "${adminive_skill_count} + 1")
|
|
elseif(entry STREQUAL "third_party/Structive/AGENTS.md")
|
|
math(EXPR structive_agents_count "${structive_agents_count} + 1")
|
|
elseif(entry STREQUAL "third_party/Structive/.agents/skills/structive-development/SKILL.md")
|
|
math(EXPR structive_skill_count "${structive_skill_count} + 1")
|
|
elseif(entry STREQUAL "backend/library/include/adminive/synchronized.hpp" OR entry STREQUAL "backend/service/tests/synchronized_test.cpp")
|
|
message(FATAL_ERROR "package_zip contains removed synchronized implementation: ${entry}")
|
|
endif()
|
|
endforeach()
|
|
if(NOT root_cmake_count EQUAL 1 OR NOT root_readme_count EQUAL 1 OR NOT root_gitignore_count EQUAL 1)
|
|
message(FATAL_ERROR "package_zip root exact-file selection is invalid")
|
|
endif()
|
|
if(NOT root_agents_count EQUAL 1 OR NOT adminive_skill_count EQUAL 1 OR NOT structive_agents_count EQUAL 1 OR NOT structive_skill_count EQUAL 1)
|
|
message(FATAL_ERROR "package_zip is missing Codex repository guidance")
|
|
endif()
|