Stop regenerating openapitools.json in multiple folders

This commit is contained in:
2026-06-11 19:41:49 -04:00
parent f2aa8d5c15
commit e87c0fe8ec
4 changed files with 23 additions and 9 deletions
+5 -3
View File
@@ -56,9 +56,10 @@ function(_cppbessot_require_npm_package npm_executable package_name)
# - package_name: Package name to validate.
# Outputs:
# - No return value; raises FATAL_ERROR when package is not installed.
cppbessot_get_module_root(_module_root)
execute_process(
COMMAND "${npm_executable}" list --depth=0 "${package_name}"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
WORKING_DIRECTORY "${_module_root}"
RESULT_VARIABLE _local_result
OUTPUT_QUIET
ERROR_QUIET
@@ -90,9 +91,10 @@ function(_cppbessot_require_npx_package_executable npx_executable package_execut
# - package_executable: Executable name exposed by a package.
# Outputs:
# - No return value; raises FATAL_ERROR if execution fails.
cppbessot_get_module_root(_module_root)
execute_process(
COMMAND "${npx_executable}" --no-install "${package_executable}" --help
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
WORKING_DIRECTORY "${_module_root}"
RESULT_VARIABLE _help_result
OUTPUT_QUIET
ERROR_VARIABLE _help_stderr
@@ -105,7 +107,7 @@ function(_cppbessot_require_npx_package_executable npx_executable package_execut
# Some CLIs return non-zero for --help; verify with version as fallback.
execute_process(
COMMAND "${npx_executable}" --no-install "${package_executable}" version
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
WORKING_DIRECTORY "${_module_root}"
RESULT_VARIABLE _version_result
OUTPUT_QUIET
ERROR_VARIABLE _version_stderr
+2 -6
View File
@@ -1,7 +1,6 @@
include_guard(GLOBAL)
include("${CMAKE_CURRENT_LIST_DIR}/dbGenerationCommon.cmake")
set(_CPPBESSOT_DB_GEN_CPP_DIR "${CMAKE_CURRENT_LIST_DIR}")
function(cppbessot_add_db_gen_cpp_target schema_dir)
# Purpose: Register C++ model generation target using checked-in templates.
@@ -13,11 +12,7 @@ function(cppbessot_add_db_gen_cpp_target schema_dir)
# - Files under `<schema_dir>/generated-cpp-source`.
cppbessot_validate_schema_dir_name("${schema_dir}")
cppbessot_get_schema_dir_path(_version_dir "${schema_dir}")
if(DEFINED CPPBESSOT_MODULE_ROOT AND NOT "${CPPBESSOT_MODULE_ROOT}" STREQUAL "")
set(_module_root "${CPPBESSOT_MODULE_ROOT}")
else()
get_filename_component(_module_root "${_CPPBESSOT_DB_GEN_CPP_DIR}/.." ABSOLUTE)
endif()
cppbessot_get_module_root(_module_root)
set(_openapi_file "${_version_dir}/openapi/openapi.yaml")
set(_template_dir "${_module_root}/openapi/templates/cpp-odb-json")
@@ -40,6 +35,7 @@ function(cppbessot_add_db_gen_cpp_target schema_dir)
-o "${_output_dir}"
--global-property models
DEPENDS "${_openapi_file}" ${_template_inputs}
WORKING_DIRECTORY "${_module_root}"
COMMENT "Generating C++ model headers/sources for ${schema_dir}"
VERBATIM
)
+2
View File
@@ -12,6 +12,7 @@ function(cppbessot_add_db_gen_ts_target schema_dir)
# - Files under `<schema_dir>/generated-ts-types`.
cppbessot_validate_schema_dir_name("${schema_dir}")
cppbessot_get_schema_dir_path(_version_dir "${schema_dir}")
cppbessot_get_module_root(_module_root)
set(_openapi_file "${_version_dir}/openapi/openapi.yaml")
set(_output_dir "${_version_dir}/generated-ts-types")
@@ -22,6 +23,7 @@ function(cppbessot_add_db_gen_ts_target schema_dir)
-i "${_openapi_file}"
-g typescript-fetch
-o "${_output_dir}"
WORKING_DIRECTORY "${_module_root}"
COMMENT "Generating TypeScript types for ${schema_dir}"
VERBATIM
)
+14
View File
@@ -41,6 +41,20 @@ function(cppbessot_initialize_paths)
set(CPPBESSOT_WORKDIR_ABS "${CPPBESSOT_WORKDIR_ABS}" PARENT_SCOPE)
endfunction()
function(cppbessot_get_module_root out_var)
# Purpose: Resolve the CppBeSSOT module root, respecting parent overrides.
# Inputs:
# - CPPBESSOT_MODULE_ROOT (optional): Parent-provided module root path.
# Outputs:
# - <out_var> (PARENT_SCOPE): Absolute module root path.
if(DEFINED CPPBESSOT_MODULE_ROOT AND NOT "${CPPBESSOT_MODULE_ROOT}" STREQUAL "")
get_filename_component(_module_root "${CPPBESSOT_MODULE_ROOT}" ABSOLUTE)
else()
get_filename_component(_module_root "${_CPPBESSOT_GENERATION_COMMON_DIR}/.." ABSOLUTE)
endif()
set(${out_var} "${_module_root}" PARENT_SCOPE)
endfunction()
function(cppbessot_require_var var_name)
# Purpose: Fail fast if a required CMake variable is missing/empty.
# Inputs: