Complete C# server cutover
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
# Stage server/ next to the Host GUI while preserving local runtime state.
|
||||
if(NOT EXISTS "${CO_SERVER_SOURCE_DIR}")
|
||||
message(FATAL_ERROR "Server source directory not found: ${CO_SERVER_SOURCE_DIR}")
|
||||
if(NOT EXISTS "${CO_SERVER_PUBLISH_DIR}")
|
||||
message(FATAL_ERROR "Published C# server directory not found: ${CO_SERVER_PUBLISH_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${CO_SERVER_SOURCE_DIR}/consumer_server_cli.py")
|
||||
message(FATAL_ERROR
|
||||
"Server entrypoint not found: ${CO_SERVER_SOURCE_DIR}/consumer_server_cli.py")
|
||||
if(NOT EXISTS "${CO_SERVER_PUBLISH_DIR}/CommonwealthOnline.Server${CO_SERVER_EXECUTABLE_SUFFIX}")
|
||||
message(FATAL_ERROR "Published C# server entrypoint not found: ${CO_SERVER_PUBLISH_DIR}/CommonwealthOnline.Server${CO_SERVER_EXECUTABLE_SUFFIX}")
|
||||
endif()
|
||||
|
||||
set(_preserve_config "")
|
||||
@@ -27,33 +25,12 @@ endif()
|
||||
|
||||
file(REMOVE_RECURSE "${CO_SERVER_STAGE_DIR}")
|
||||
file(MAKE_DIRECTORY "${CO_SERVER_STAGE_DIR}")
|
||||
|
||||
# Prefer a filtered copy so caches and local runtime state do not ship with the build.
|
||||
file(GLOB _server_entries RELATIVE "${CO_SERVER_SOURCE_DIR}" "${CO_SERVER_SOURCE_DIR}/*")
|
||||
foreach(_entry IN LISTS _server_entries)
|
||||
if(_entry STREQUAL "__pycache__"
|
||||
OR _entry STREQUAL ".pytest_cache"
|
||||
OR _entry STREQUAL ".venv"
|
||||
OR _entry STREQUAL "logs"
|
||||
OR _entry STREQUAL "tests"
|
||||
OR _entry STREQUAL "bans.json"
|
||||
OR _entry STREQUAL ".admin-token")
|
||||
continue()
|
||||
endif()
|
||||
file(COPY "${CO_SERVER_SOURCE_DIR}/${_entry}"
|
||||
DESTINATION "${CO_SERVER_STAGE_DIR}"
|
||||
PATTERN "__pycache__" EXCLUDE
|
||||
PATTERN "*.pyc" EXCLUDE
|
||||
PATTERN ".pytest_cache" EXCLUDE
|
||||
PATTERN ".venv" EXCLUDE
|
||||
PATTERN "logs" EXCLUDE
|
||||
PATTERN "bans.json" EXCLUDE
|
||||
PATTERN ".admin-token" EXCLUDE
|
||||
)
|
||||
endforeach()
|
||||
file(COPY "${CO_SERVER_PUBLISH_DIR}/" DESTINATION "${CO_SERVER_STAGE_DIR}")
|
||||
|
||||
if(NOT "${_preserve_config}" STREQUAL "")
|
||||
file(WRITE "${CO_SERVER_STAGE_CONFIG}" "${_preserve_config}")
|
||||
elseif(EXISTS "${CO_SERVER_SOURCE_DIR}/commonwealth-server.json")
|
||||
file(COPY "${CO_SERVER_SOURCE_DIR}/commonwealth-server.json" DESTINATION "${CO_SERVER_STAGE_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT "${_preserve_bans}" STREQUAL "")
|
||||
@@ -64,7 +41,6 @@ if(NOT "${_preserve_admin_token}" STREQUAL "")
|
||||
file(WRITE "${_stage_admin_token}" "${_preserve_admin_token}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${CO_SERVER_STAGE_DIR}/consumer_server_cli.py")
|
||||
message(FATAL_ERROR
|
||||
"Failed to stage server entrypoint to ${CO_SERVER_STAGE_DIR}/consumer_server_cli.py")
|
||||
if(NOT EXISTS "${CO_SERVER_STAGE_DIR}/CommonwealthOnline.Server${CO_SERVER_EXECUTABLE_SUFFIX}")
|
||||
message(FATAL_ERROR "Failed to stage C# server entrypoint")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user