Skip to content

Commit b3663d2

Browse files
fix: Auto-generate development_config.cpp from template if missing
This allows fresh checkouts and CI builds to succeed even without the git-ignored development_config.cpp file containing credentials.
1 parent 47c9279 commit b3663d2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

sdk/runanywhere-commons/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,26 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
8686
endif()
8787
endif()
8888

89+
# =============================================================================
90+
# AUTO-GENERATE DEVELOPMENT CONFIG IF MISSING
91+
# =============================================================================
92+
# development_config.cpp is git-ignored because it can contain secrets.
93+
# For CI builds or fresh checkouts, we auto-generate a stub from the template.
94+
95+
set(DEV_CONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/infrastructure/network/development_config.cpp")
96+
set(DEV_CONFIG_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/src/infrastructure/network/development_config.cpp.template")
97+
98+
if(NOT EXISTS "${DEV_CONFIG_FILE}")
99+
if(EXISTS "${DEV_CONFIG_TEMPLATE}")
100+
message(STATUS "development_config.cpp not found, generating stub from template...")
101+
file(READ "${DEV_CONFIG_TEMPLATE}" DEV_CONFIG_CONTENT)
102+
file(WRITE "${DEV_CONFIG_FILE}" "${DEV_CONFIG_CONTENT}")
103+
message(STATUS "Generated: ${DEV_CONFIG_FILE}")
104+
else()
105+
message(FATAL_ERROR "Neither development_config.cpp nor .template found!")
106+
endif()
107+
endif()
108+
89109
# =============================================================================
90110
# SOURCE FILES
91111
# =============================================================================

0 commit comments

Comments
 (0)