Преглед изворни кода

Sanity checks for library and plug-in target names.

Plug-in target names must contain at least one '_' and library target
names most not contain any '_' character. This convention has already
been used implicitly. Enforcing it now.

A warning is now printed if the plug-in directory name does not match
the plug-in project (target) name.
Sascha Zelzer пре 13 година
родитељ
комит
9007390b59
54 измењених фајлова са 28 додато и 7 уклоњено
  1. 7 0
      CMake/ctkMacroBuildLib.cmake
  2. 17 3
      CMake/ctkMacroBuildPlugin.cmake
  3. 4 4
      Libs/PluginFramework/Testing/CMakeLists.txt
  4. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/CMakeLists.txt
  5. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator.cpp
  6. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator_p.h
  7. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationAdminTestSuite.cpp
  8. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationAdminTestSuite_p.h
  9. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationListenerTestSuite.cpp
  10. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationListenerTestSuite_p.h
  11. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationPluginTestSuite.cpp
  12. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationPluginTestSuite_p.h
  13. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkManagedServiceFactoryTestSuite.cpp
  14. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkManagedServiceFactoryTestSuite_p.h
  15. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkManagedServiceTestSuite.cpp
  16. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkManagedServiceTestSuite_p.h
  17. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/manifest_headers.cmake
  18. 0 0
      Libs/PluginFramework/Testing/org.commontk.configadmintest/target_libraries.cmake
  19. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/CMakeLists.txt
  20. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite.cpp
  21. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite_p.h
  22. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario2TestSuite.cpp
  23. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario2TestSuite_p.h
  24. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario3TestSuite.cpp
  25. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario3TestSuite_p.h
  26. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario4TestSuite.cpp
  27. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario4TestSuite_p.h
  28. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEATopicWildcardTestSuite.cpp
  29. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEATopicWildcardTestSuite_p.h
  30. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator.cpp
  31. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator_p.h
  32. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/manifest_headers.cmake
  33. 0 0
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/target_libraries.cmake
  34. 0 0
      Libs/PluginFramework/Testing/org.commontk.metatypetest/CMakeLists.txt
  35. 0 0
      Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMTAttrPasswordTestSuite.cpp
  36. 0 0
      Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMTAttrPasswordTestSuite_p.h
  37. 0 0
      Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMTLocaleTestSuite.cpp
  38. 0 0
      Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMTLocaleTestSuite_p.h
  39. 0 0
      Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator.cpp
  40. 0 0
      Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator_p.h
  41. 0 0
      Libs/PluginFramework/Testing/org.commontk.metatypetest/manifest_headers.cmake
  42. 0 0
      Libs/PluginFramework/Testing/org.commontk.metatypetest/target_libraries.cmake
  43. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/CMakeLists.txt
  44. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator.cpp
  45. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator_p.h
  46. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestMain.cpp
  47. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestSuite.cpp
  48. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestSuite_p.h
  49. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkServiceListenerTestSuite.cpp
  50. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkServiceListenerTestSuite_p.h
  51. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkServiceTrackerTestSuite.cpp
  52. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkServiceTrackerTestSuite_p.h
  53. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/manifest_headers.cmake
  54. 0 0
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/target_libraries.cmake

+ 7 - 0
CMake/ctkMacroBuildLib.cmake

@@ -23,6 +23,8 @@
 #  CTK/CMake/ctkMacroParseArguments.cmake
 #
 
+#! \brief Build a CTK library.
+#!
 #! \ingroup CMakeAPI
 macro(ctkMacroBuildLib)
   ctkMacroParseArguments(MY
@@ -48,6 +50,11 @@ macro(ctkMacroBuildLib)
 
   # Define library name
   set(lib_name ${MY_NAME})
+  
+  # Library target names must not contain a '_' (reserved for plug-in target names)
+  if(lib_name MATCHES _)
+    message(FATAL_ERROR "The library name ${lib_name} must not contain a '_' character.")
+  endif()
 
   # --------------------------------------------------------------------------
   # Include dirs

+ 17 - 3
CMake/ctkMacroBuildPlugin.cmake

@@ -23,6 +23,8 @@
 #  CTK/CMake/ctkMacroParseArguments.cmake
 #  CTK/CMake/ctkMacroGeneratePluginManifest.cmake
 #
+#! \brief Build a CTK plug-in.
+#!
 #! This macro takes the usual arguments for building
 #! a shared library using Qt. Additionally, it generates
 #! plugin meta-data by creating a MANIFEST.MF text file
@@ -57,12 +59,24 @@ macro(ctkMacroBuildPlugin)
   if(NOT DEFINED MY_EXPORT_DIRECTIVE)
     message(FATAL_ERROR "EXPORT_DIRECTIVE is mandatory")
   endif()
-
-  # Plugin are expected to be shared library
-  set(MY_LIBRARY_TYPE "SHARED")
+  
+  # Print a warning if the project name does not match the directory name
+  get_filename_component(_dir_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+  string(REPLACE "." "_" _dir_name_with_ ${_dir_name})
+  if(NOT _dir_name_with_ STREQUAL ${PROJECT_NAME})
+    message(WARNING "Discouraged mismatch of plug-in project name [${PROJECT_NAME}] and top-level directory name [${CMAKE_CURRENT_SOURCE_DIR}].")
+  endif()
 
   # Define library name
   set(lib_name ${PROJECT_NAME})
+  
+  # Plug-in target names must contain at leas one _
+  if(NOT lib_name MATCHES _)
+    message(FATAL_ERROR "The plug-in project name ${lib_name} must contain at least one '_' character")
+  endif()
+  
+  # Plugin are expected to be shared library
+  set(MY_LIBRARY_TYPE "SHARED")
 
   # Clear the variables for the manifest headers
   set(Plugin-ActivationPolicy )

+ 4 - 4
Libs/PluginFramework/Testing/CMakeLists.txt

@@ -19,11 +19,11 @@ set(metatypetest_plugins
   pluginAttrPwd_test
 )
 
-add_subdirectory(FrameworkTest)
+add_subdirectory(org.commontk.pluginfwtest)
 add_subdirectory(FrameworkTestPlugins)
 
-add_subdirectory(ConfigAdminTest)
-add_subdirectory(EventAdminTest)
+add_subdirectory(org.commontk.configadmintest)
+add_subdirectory(org.commontk.eventadmintest)
 
-add_subdirectory(MetaTypeTest)
+add_subdirectory(org.commontk.metatypetest)
 add_subdirectory(MetaTypeTestPlugins)

Libs/PluginFramework/Testing/ConfigAdminTest/CMakeLists.txt → Libs/PluginFramework/Testing/org.commontk.configadmintest/CMakeLists.txt


Libs/PluginFramework/Testing/ConfigAdminTest/ctkConfigAdminTestActivator.cpp → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator.cpp


Libs/PluginFramework/Testing/ConfigAdminTest/ctkConfigAdminTestActivator_p.h → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator_p.h


Libs/PluginFramework/Testing/ConfigAdminTest/ctkConfigurationAdminTestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationAdminTestSuite.cpp


Libs/PluginFramework/Testing/ConfigAdminTest/ctkConfigurationAdminTestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationAdminTestSuite_p.h


Libs/PluginFramework/Testing/ConfigAdminTest/ctkConfigurationListenerTestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationListenerTestSuite.cpp


Libs/PluginFramework/Testing/ConfigAdminTest/ctkConfigurationListenerTestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationListenerTestSuite_p.h


Libs/PluginFramework/Testing/ConfigAdminTest/ctkConfigurationPluginTestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationPluginTestSuite.cpp


Libs/PluginFramework/Testing/ConfigAdminTest/ctkConfigurationPluginTestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationPluginTestSuite_p.h


Libs/PluginFramework/Testing/ConfigAdminTest/ctkManagedServiceFactoryTestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkManagedServiceFactoryTestSuite.cpp


Libs/PluginFramework/Testing/ConfigAdminTest/ctkManagedServiceFactoryTestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkManagedServiceFactoryTestSuite_p.h


Libs/PluginFramework/Testing/ConfigAdminTest/ctkManagedServiceTestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkManagedServiceTestSuite.cpp


Libs/PluginFramework/Testing/ConfigAdminTest/ctkManagedServiceTestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkManagedServiceTestSuite_p.h


Libs/PluginFramework/Testing/ConfigAdminTest/manifest_headers.cmake → Libs/PluginFramework/Testing/org.commontk.configadmintest/manifest_headers.cmake


Libs/PluginFramework/Testing/ConfigAdminTest/target_libraries.cmake → Libs/PluginFramework/Testing/org.commontk.configadmintest/target_libraries.cmake


Libs/PluginFramework/Testing/EventAdminTest/CMakeLists.txt → Libs/PluginFramework/Testing/org.commontk.eventadmintest/CMakeLists.txt


Libs/PluginFramework/Testing/EventAdminTest/ctkEAScenario1TestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite.cpp


Libs/PluginFramework/Testing/EventAdminTest/ctkEAScenario1TestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite_p.h


Libs/PluginFramework/Testing/EventAdminTest/ctkEAScenario2TestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario2TestSuite.cpp


Libs/PluginFramework/Testing/EventAdminTest/ctkEAScenario2TestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario2TestSuite_p.h


Libs/PluginFramework/Testing/EventAdminTest/ctkEAScenario3TestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario3TestSuite.cpp


Libs/PluginFramework/Testing/EventAdminTest/ctkEAScenario3TestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario3TestSuite_p.h


Libs/PluginFramework/Testing/EventAdminTest/ctkEAScenario4TestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario4TestSuite.cpp


Libs/PluginFramework/Testing/EventAdminTest/ctkEAScenario4TestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario4TestSuite_p.h


Libs/PluginFramework/Testing/EventAdminTest/ctkEATopicWildcardTestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEATopicWildcardTestSuite.cpp


Libs/PluginFramework/Testing/EventAdminTest/ctkEATopicWildcardTestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEATopicWildcardTestSuite_p.h


Libs/PluginFramework/Testing/EventAdminTest/ctkEventAdminTestActivator.cpp → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator.cpp


Libs/PluginFramework/Testing/EventAdminTest/ctkEventAdminTestActivator_p.h → Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator_p.h


Libs/PluginFramework/Testing/EventAdminTest/manifest_headers.cmake → Libs/PluginFramework/Testing/org.commontk.eventadmintest/manifest_headers.cmake


Libs/PluginFramework/Testing/EventAdminTest/target_libraries.cmake → Libs/PluginFramework/Testing/org.commontk.eventadmintest/target_libraries.cmake


Libs/PluginFramework/Testing/MetaTypeTest/CMakeLists.txt → Libs/PluginFramework/Testing/org.commontk.metatypetest/CMakeLists.txt


Libs/PluginFramework/Testing/MetaTypeTest/ctkMTAttrPasswordTestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMTAttrPasswordTestSuite.cpp


Libs/PluginFramework/Testing/MetaTypeTest/ctkMTAttrPasswordTestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMTAttrPasswordTestSuite_p.h


Libs/PluginFramework/Testing/MetaTypeTest/ctkMTLocaleTestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMTLocaleTestSuite.cpp


Libs/PluginFramework/Testing/MetaTypeTest/ctkMTLocaleTestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMTLocaleTestSuite_p.h


Libs/PluginFramework/Testing/MetaTypeTest/ctkMetaTypeTestActivator.cpp → Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator.cpp


Libs/PluginFramework/Testing/MetaTypeTest/ctkMetaTypeTestActivator_p.h → Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator_p.h


Libs/PluginFramework/Testing/MetaTypeTest/manifest_headers.cmake → Libs/PluginFramework/Testing/org.commontk.metatypetest/manifest_headers.cmake


Libs/PluginFramework/Testing/FrameworkTest/target_libraries.cmake → Libs/PluginFramework/Testing/org.commontk.metatypetest/target_libraries.cmake


Libs/PluginFramework/Testing/FrameworkTest/CMakeLists.txt → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/CMakeLists.txt


Libs/PluginFramework/Testing/FrameworkTest/ctkPluginFrameworkTestActivator.cpp → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator.cpp


Libs/PluginFramework/Testing/FrameworkTest/ctkPluginFrameworkTestActivator_p.h → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator_p.h


Libs/PluginFramework/Testing/FrameworkTest/ctkPluginFrameworkTestMain.cpp → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestMain.cpp


Libs/PluginFramework/Testing/FrameworkTest/ctkPluginFrameworkTestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestSuite.cpp


Libs/PluginFramework/Testing/FrameworkTest/ctkPluginFrameworkTestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestSuite_p.h


Libs/PluginFramework/Testing/FrameworkTest/ctkServiceListenerTestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkServiceListenerTestSuite.cpp


Libs/PluginFramework/Testing/FrameworkTest/ctkServiceListenerTestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkServiceListenerTestSuite_p.h


Libs/PluginFramework/Testing/FrameworkTest/ctkServiceTrackerTestSuite.cpp → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkServiceTrackerTestSuite.cpp


Libs/PluginFramework/Testing/FrameworkTest/ctkServiceTrackerTestSuite_p.h → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkServiceTrackerTestSuite_p.h


Libs/PluginFramework/Testing/FrameworkTest/manifest_headers.cmake → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/manifest_headers.cmake


Libs/PluginFramework/Testing/MetaTypeTest/target_libraries.cmake → Libs/PluginFramework/Testing/org.commontk.pluginfwtest/target_libraries.cmake