More fixes of plugins.xml generation (#9942)

* Further fixes of plugins.xml generation
1) Unregistration is done by name (e.g. CPU), not by file name (ov_cpu_plugin)
2) Unregistered line is searched by name="MULTI" instead of just 'MULTI' to not conflict with MULTI_WORK_MODE_AS_AUTO entry
3) Removed list of all possible plugins from ov_runtime as logic shall not rely on this (not possible to add 3rd party plugins)

* Revert ov_runtime - some CI jobs require plugins.xml even though plugins are not built

Registration - if some entry already exists in XML - don't copy it.
E.g.
- Registration of 'TEMPLATE' is performed
- Registration loops through existing plugins.xml
   - If name="TEMPLATE" is found - don't take it to newContent
   - If name like "myCustomPlugin" is found - take it
- As result - "myCustomPlugin" will exist after update, but old "TEMPLATE" will be removed

* Add missing change
This commit is contained in:
Mikhail Nosov authored and GitHub committed 2022-01-27 16:54:21 +03:00
1 parent 1d5352dae3
commit cf328d299f
3 files changed
+33 -15

No files matched your search

@@ -186,21 +186,24 @@ macro(ie_register_plugins_dynamic)
# Unregister <device_name>.xml files for plugins from current build tree
set(plugins_to_remove ${IE_REGISTER_POSSIBLE_PLUGINS})
# Remove legacy plugin names from plugins.xml in case of incremental build
set(plugins_to_remove ${plugins_to_remove} AutoPlugin MultiDevicePlugin HeteroPlugin clDNNPlugin GNAPlugin MKLDNNPlugin myriadPlugin)
set(config_output_file "$<TARGET_FILE_DIR:${IE_REGISTER_MAIN_TARGET}>/plugins.xml")
foreach(plugin IN LISTS plugins_to_remove)
foreach(name IN LISTS PLUGIN_FILES)
string(REPLACE ":" ";" name "${name}")
list(LENGTH name length)
if(NOT ${length} EQUAL 2)
message(FATAL_ERROR "Unexpected error, please, contact developer of this script")
endif()
list(GET name 0 device_name)
add_custom_command(TARGET ${IE_REGISTER_MAIN_TARGET} POST_BUILD
COMMAND
"${CMAKE_COMMAND}"
-D "IE_CONFIG_OUTPUT_FILE=${config_output_file}"
-D "IE_PLUGIN_NAME=${plugin}"
-D "IE_PLUGIN_NAME=${device_name}"
-D "IE_CONFIGS_DIR=${CMAKE_BINARY_DIR}/plugins"
-P "${IEDevScripts_DIR}/plugins/unregister_plugin_cmake.cmake"
COMMENT
"Remove ${plugin} from the plugins.xml file"
"Remove ${device_name} from the plugins.xml file"
VERBATIM)
endforeach()
@@ -46,19 +46,34 @@ endforeach()
set(newContent "")
file(STRINGS "${IE_CONFIG_OUTPUT_FILE}" content)
set(already_exists_in_xml OFF)
foreach(line IN LISTS content)
if("${line}" MATCHES "</plugins>")
if(NOT already_exists_in_xml)
foreach(plugin_file IN LISTS plugin_files_to_add)
file(READ "${plugin_file}" content)
set(newContent "${newContent}
${content}")
get_filename_component(plugin_name "${plugin_file}" NAME_WE)
if("${line}" MATCHES "name=\"${plugin_name}\"")
set(already_exists_in_xml ON)
endif()
endforeach()
endif()
if (NOT already_exists_in_xml)
if("${line}" MATCHES "</plugins>")
foreach(plugin_file IN LISTS plugin_files_to_add)
file(READ "${plugin_file}" content)
set(newContent "${newContent}
${content}")
endforeach()
endif()
if(newContent)
set(newContent "${newContent}\n${line}")
else()
set(newContent "${line}")
if(newContent)
set(newContent "${newContent}\n${line}")
else()
set(newContent "${line}")
endif()
endif()
if("${line}" MATCHES "</plugin>")
set(already_exists_in_xml OFF)
endif()
endforeach()
@@ -15,7 +15,7 @@ file(STRINGS "${IE_CONFIG_OUTPUT_FILE}" content)
set(skip_plugin OFF)
foreach(line IN LISTS content)
if("${line}" MATCHES "${IE_PLUGIN_NAME}")
if("${line}" MATCHES "name=\"${IE_PLUGIN_NAME}\"")
set(skip_plugin ON)
endif()