Remove regeneration from AC files that are themselves regenerated (#3602)

This commit is contained in:
M Starch 2025-05-14 09:54:57 -07:00 committed by GitHub
parent a7d9db1780
commit e63bc77c2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 14 deletions

View File

@ -19,10 +19,6 @@ autocoder_setup_for_individual_sources()
####
function(ai_xml_is_supported AC_INPUT_FILE)
ends_with(IS_SUPPORTED "${AC_INPUT_FILE}" "Ai.xml")
set(PREVIOUSLY_GENERATED)
if (ARGC GREATER_EQUAL 2)
set(PREVIOUSLY_GENERATED ${ARGV2})
endif()
# Don't generate cpp/hpp files that have already been generated
if (IS_SUPPORTED)
@ -31,11 +27,8 @@ function(ai_xml_is_supported AC_INPUT_FILE)
if(("${CPP_FILE}" IN_LIST PREVIOUSLY_GENERATED) AND ("${HPP_FILE}" IN_LIST PREVIOUSLY_GENERATED))
set(IS_SUPPORTED FALSE)
endif()
# If this Ai.xml file was not a generated product, then mark it as requiring a rebuild
if (NOT "${AC_INPUT_FILE}" IN_LIST PREVIOUSLY_GENERATED)
requires_regeneration("${AC_INPUT_FILE}")
endif()
# Requires regeneration checks for GENERATED before requiring regeneration
requires_regeneration("${AC_INPUT_FILE}")
endif()
# Note: set in PARENT_SCOPE in macro is intended. Caller **wants** to set IS_SUPPORTED in their parent's scope.
set(IS_SUPPORTED "${IS_SUPPORTED}" PARENT_SCOPE)

View File

@ -46,12 +46,9 @@ endmacro()
# `AC_INPUT_FILE`: file to mark as tracked
####
function(requires_regeneration AC_INPUT_FILE)
get_property(RECONFIGURE_LIST GLOBAL PROPERTY AUTO_RECONFIGURE_LIST)
get_filename_component(REAL_FILE "${AC_INPUT_FILE}" REALPATH)
if (NOT "${REAL_FILE}" IN_LIST RECONFIGURE_LIST)
get_source_file_property(IS_GENERATED "${AC_INPUT_FILE}" GENERATED)
if (NOT IS_GENERATED)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${AC_INPUT_FILE}")
list(APPEND RECONFIGURE_LIST "${REAL_FILE}")
set_property(GLOBAL PROPERTY AUTO_RECONFIGURE_LIST "${RECONFIGURE_LIST}")
endif()
endfunction()