From 74f9ccb0dbc52d96999589a2cf19455c5bdd3659 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Sat, 11 Jun 2022 19:38:24 -0700 Subject: [PATCH 1/3] Move CLI files Signed-off-by: methylDragon --- loader/src/cmd/{ign.cc => gz.cc} | 0 loader/src/cmd/{ign.hh => gz.hh} | 0 loader/src/{ign_TEST.cc => gz_TEST.cc} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename loader/src/cmd/{ign.cc => gz.cc} (100%) rename loader/src/cmd/{ign.hh => gz.hh} (100%) rename loader/src/{ign_TEST.cc => gz_TEST.cc} (100%) diff --git a/loader/src/cmd/ign.cc b/loader/src/cmd/gz.cc similarity index 100% rename from loader/src/cmd/ign.cc rename to loader/src/cmd/gz.cc diff --git a/loader/src/cmd/ign.hh b/loader/src/cmd/gz.hh similarity index 100% rename from loader/src/cmd/ign.hh rename to loader/src/cmd/gz.hh diff --git a/loader/src/ign_TEST.cc b/loader/src/gz_TEST.cc similarity index 100% rename from loader/src/ign_TEST.cc rename to loader/src/gz_TEST.cc From a50c6c93e024bc738f36352324fb6b9f0c1792a6 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Sun, 12 Jun 2022 22:06:40 -0700 Subject: [PATCH 2/3] Migrate ign executable to gz Signed-off-by: methylDragon --- CMakeLists.txt | 2 +- Changelog.md | 4 ++-- README.md | 2 +- loader/CMakeLists.txt | 10 +++++----- loader/conf/CMakeLists.txt | 4 ++-- loader/src/cmd/CMakeLists.txt | 12 ++++++------ loader/src/cmd/gz.cc | 2 +- loader/src/cmd/plugin_main.cc | 2 +- loader/src/gz_TEST.cc | 24 ++++++++++++------------ tutorials/02_installation.md | 6 +++--- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 354f210d..c3bba23a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ gz_find_package(DL #-------------------------------------- # Find ignition-tools -find_program(GZ_TOOLS_PROGRAM ign) +find_program(GZ_TOOLS_PROGRAM gz) #-------------------------------------- diff --git a/Changelog.md b/Changelog.md index 54180054..b4dce546 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,7 +10,7 @@ * [Pull request #52](https://github.com/gazebosim/gz-plugin/pull/52) * [Pull request #51](https://github.com/gazebosim/gz-plugin/pull/51) -1. Find ign program instead of ignition-tools +1. Find gz program instead of ignition-tools * [Pull request #57](https://github.com/gazebosim/gz-plugin/pull/57) 1. Remove ign-tools from CMakeLists.txt. Not used @@ -37,7 +37,7 @@ 1. Fix downstream Windows builds * [Pull request #38](https://github.com/gazebosim/gz-plugin/pull/38) -1. Add `ign plugin --info` to print plugin info +1. Add `gz plugin --info` to print plugin info * [Pull request #32](https://github.com/gazebosim/gz-plugin/pull/32) 1. Add Windows installation diff --git a/README.md b/README.md index c558b164..7e021238 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ of libraries designed to rapidly develop robot applications. * Querying of interfaces **by C++ type or name string**. * **Dynamically load** plugins at runtime according to the interfaces they provide. * **Reference counting** of plugin objects to unload libraries no longer in use. -* **Command line tool** `ign plugin` to inspect plugins. +* **Command line tool** `gz plugin` to inspect plugins. ## Installation diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 49ea3c23..68283289 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -2,9 +2,9 @@ # "tests" variable gz_get_libsources_and_unittests(sources tests) -# Disable ign_TEST if ignition-tools is not found +# Disable gz_TEST if ignition-tools is not found if (MSVC OR NOT GZ_TOOLS_PROGRAM) - list(REMOVE_ITEM tests src/ign_TEST.cc) + list(REMOVE_ITEM tests src/gz_TEST.cc) endif() # Create the library target @@ -40,11 +40,11 @@ foreach(test ${test_targets}) endforeach() -if(TARGET UNIT_ign_TEST) +if(TARGET UNIT_gz_TEST) set(_env_vars) list(APPEND _env_vars "GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$") - set_tests_properties(UNIT_ign_TEST PROPERTIES + set_tests_properties(UNIT_gz_TEST PROPERTIES ENVIRONMENT "${_env_vars}") endif() @@ -53,7 +53,7 @@ install( DESTINATION ${IGN_INCLUDE_INSTALL_DIR_FULL}) #============================================================================ -# ign command line support +# gz command line support #============================================================================ add_subdirectory(conf) add_subdirectory(src) diff --git a/loader/conf/CMakeLists.txt b/loader/conf/CMakeLists.txt index f5dd31fd..9df9116b 100644 --- a/loader/conf/CMakeLists.txt +++ b/loader/conf/CMakeLists.txt @@ -1,5 +1,5 @@ # Used only for internal testing. -set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/$/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}") +set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/$/ruby/gz/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}") # Generate a configuration file for internal testing. # Note that the major version of the library is included in the name. @@ -13,7 +13,7 @@ file(GENERATE INPUT "${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml.configured") # Used for the installed version. -set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}") +set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/gz/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}") # Generate the configuration file that is installed. # Note that the major version of the library is included in the name. diff --git a/loader/src/cmd/CMakeLists.txt b/loader/src/cmd/CMakeLists.txt index 3a11fbdd..7a5b1e9a 100644 --- a/loader/src/cmd/CMakeLists.txt +++ b/loader/src/cmd/CMakeLists.txt @@ -1,13 +1,13 @@ -add_library(ign STATIC ign.cc) -target_include_directories(ign PUBLIC ${CMAKE_SOURCE_DIR}/loader/include) -target_link_libraries(ign PUBLIC +add_library(gz STATIC gz.cc) +target_include_directories(gz PUBLIC ${CMAKE_SOURCE_DIR}/loader/include) +target_link_libraries(gz PUBLIC ${PROJECT_LIBRARY_TARGET_NAME} ) set(plugin_executable ign-plugin) add_executable(${plugin_executable} plugin_main.cc) target_link_libraries(${plugin_executable} - ign + gz ignition-utils${IGN_UTILS_VER}::cli ${loader} ) @@ -25,7 +25,7 @@ install( # Generate the ruby script for internal testing. # Note that the major version of the library is included in the name. # Ex: cmdplugin2.rb -set(cmd_script_generated_test "${CMAKE_BINARY_DIR}/test/lib/$/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb") +set(cmd_script_generated_test "${CMAKE_BINARY_DIR}/test/lib/$/ruby/gz/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb") set(cmd_script_configured_test "${CMAKE_CURRENT_BINARY_DIR}/test_cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb.configured") # Set the library_location variable to the full path of the library file within @@ -64,4 +64,4 @@ file(GENERATE INPUT "${cmd_script_configured}") # Install the ruby command line library in an unversioned location. -install(FILES ${cmd_script_generated} DESTINATION lib/ruby/ignition) +install(FILES ${cmd_script_generated} DESTINATION lib/ruby/gz) diff --git a/loader/src/cmd/gz.cc b/loader/src/cmd/gz.cc index aa6af1a2..64709378 100644 --- a/loader/src/cmd/gz.cc +++ b/loader/src/cmd/gz.cc @@ -22,7 +22,7 @@ #include "gz/plugin/Loader.hh" #include "gz/plugin/config.hh" -#include "ign.hh" +#include "gz.hh" ////////////////////////////////////////////////// extern "C" void cmdPluginInfo( diff --git a/loader/src/cmd/plugin_main.cc b/loader/src/cmd/plugin_main.cc index 3855104c..9327ea71 100644 --- a/loader/src/cmd/plugin_main.cc +++ b/loader/src/cmd/plugin_main.cc @@ -16,7 +16,7 @@ */ #include -#include "ign.hh" +#include "gz.hh" ////////////////////////////////////////////////// /// \brief Enumeration of available commands diff --git a/loader/src/gz_TEST.cc b/loader/src/gz_TEST.cc index ab9e84db..13327ac0 100644 --- a/loader/src/gz_TEST.cc +++ b/loader/src/gz_TEST.cc @@ -54,10 +54,10 @@ std::string custom_exec_str(std::string _cmd) } ////////////////////////////////////////////////// -/// \brief Check 'ign plugin --help'. +/// \brief Check 'gz plugin --help'. TEST(ignTest, IgnPluginHelp) { - // Path to ign executable + // Path to gz executable std::string ign = std::string(GZ_PATH); std::string output = custom_exec_str(ign + " plugin --help"); EXPECT_NE(std::string::npos, @@ -77,10 +77,10 @@ TEST(ignTest, IgnPluginHelp) } ////////////////////////////////////////////////// -/// \brief Check 'ign plugin --info' for a non-existent file. +/// \brief Check 'gz plugin --info' for a non-existent file. TEST(ignTest, PluginInfoNonexistentLibrary) { - // Path to ign executable + // Path to gz executable std::string ign = std::string(GZ_PATH); std::string output = custom_exec_str(ign + " plugin --info --plugin " + @@ -95,10 +95,10 @@ TEST(ignTest, PluginInfoNonexistentLibrary) } ////////////////////////////////////////////////// -/// \brief Check 'ign plugin --info' for a file that isn't a shared library. +/// \brief Check 'gz plugin --info' for a file that isn't a shared library. TEST(ignTest, PluginInfoNonLibrary) { - // Path to ign executable + // Path to gz executable std::string ign = std::string(GZ_PATH); std::string output = custom_exec_str(ign + " plugin --info --plugin " + @@ -113,10 +113,10 @@ TEST(ignTest, PluginInfoNonLibrary) } ////////////////////////////////////////////////// -/// \brief Check 'ign plugin --info' for a library that has no plugins. +/// \brief Check 'gz plugin --info' for a library that has no plugins. TEST(ignTest, PluginInfoNonPluginLibrary) { - // Path to ign executable + // Path to gz executable std::string ign = std::string(GZ_PATH); std::string output = custom_exec_str(ign + " plugin --info --plugin " + @@ -132,10 +132,10 @@ TEST(ignTest, PluginInfoNonPluginLibrary) } ////////////////////////////////////////////////// -/// \brief Check 'ign plugin --info' for a library with plugins. +/// \brief Check 'gz plugin --info' for a library with plugins. TEST(ignTest, PluginInfoDummyPlugins) { - // Path to ign executable + // Path to gz executable std::string ign = std::string(GZ_PATH); std::string output = custom_exec_str(ign + " plugin --info --plugin " + @@ -171,10 +171,10 @@ TEST(ignTest, PluginInfoDummyPlugins) } ////////////////////////////////////////////////// -/// \brief Check 'ign plugin --info' with verbose output. +/// \brief Check 'gz plugin --info' with verbose output. TEST(ignTest, PluginInfoVerboseDummyPlugins) { - // Path to ign executable + // Path to gz executable std::string ign = std::string(GZ_PATH); std::string output = custom_exec_str(ign + " plugin --info --plugin " + diff --git a/tutorials/02_installation.md b/tutorials/02_installation.md index b5d1744f..5aa3ea9c 100644 --- a/tutorials/02_installation.md +++ b/tutorials/02_installation.md @@ -45,7 +45,7 @@ sudo apt install libignition-plugin2-dev sudo apt-get install libignition-cmake3-dev libignition-tools2-dev libignition-utils2-cli-dev ``` -1. Install Gazebo Tools if you want to use the `ign plugin` command line tool: +1. Install Gazebo Tools if you want to use the `gz plugin` command line tool: ```bash sudo apt-get install ignition-tools2 @@ -128,8 +128,8 @@ Navigate to `condabin` if necessary to use the `conda` command (i.e., if Conda i Create if necessary, and activate a Conda environment: ```bash -conda create -n ign-ws -conda activate ign-ws +conda create -n gz-ws +conda activate gz-ws ``` ## Binary Installation From 6be72f6e5d5cc6438c5df0a288397a6685a9f03e Mon Sep 17 00:00:00 2001 From: methylDragon Date: Sun, 12 Jun 2022 22:43:56 -0700 Subject: [PATCH 3/3] Migrate ignTest to gzTest Signed-off-by: methylDragon --- loader/src/gz_TEST.cc | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/loader/src/gz_TEST.cc b/loader/src/gz_TEST.cc index 13327ac0..69d266ab 100644 --- a/loader/src/gz_TEST.cc +++ b/loader/src/gz_TEST.cc @@ -28,7 +28,7 @@ using namespace gz; -static const std::string g_ignVersion("--force-version " + // NOLINT(*) +static const std::string g_gzVersion("--force-version " + // NOLINT(*) std::string(GZ_VERSION_FULL)); ///////////////////////////////////////////////// @@ -55,11 +55,11 @@ std::string custom_exec_str(std::string _cmd) ////////////////////////////////////////////////// /// \brief Check 'gz plugin --help'. -TEST(ignTest, IgnPluginHelp) +TEST(gzTest, IgnPluginHelp) { // Path to gz executable - std::string ign = std::string(GZ_PATH); - std::string output = custom_exec_str(ign + " plugin --help"); + std::string gz = std::string(GZ_PATH); + std::string output = custom_exec_str(gz + " plugin --help"); EXPECT_NE(std::string::npos, output.find("-i,--info Get info about a plugin.")) << output; @@ -67,7 +67,7 @@ TEST(ignTest, IgnPluginHelp) output.find("-p,--plugin TEXT Needs: --info")) << output; - output = custom_exec_str(ign + " plugin"); + output = custom_exec_str(gz + " plugin"); EXPECT_NE(std::string::npos, output.find("-i,--info Get info about a plugin.")) << output; @@ -78,12 +78,12 @@ TEST(ignTest, IgnPluginHelp) ////////////////////////////////////////////////// /// \brief Check 'gz plugin --info' for a non-existent file. -TEST(ignTest, PluginInfoNonexistentLibrary) +TEST(gzTest, PluginInfoNonexistentLibrary) { // Path to gz executable - std::string ign = std::string(GZ_PATH); + std::string gz = std::string(GZ_PATH); - std::string output = custom_exec_str(ign + " plugin --info --plugin " + + std::string output = custom_exec_str(gz + " plugin --info --plugin " + "/path/to/libDoesNotExist.so"); EXPECT_NE(std::string::npos, output.find("Error while loading the library")) @@ -96,12 +96,12 @@ TEST(ignTest, PluginInfoNonexistentLibrary) ////////////////////////////////////////////////// /// \brief Check 'gz plugin --info' for a file that isn't a shared library. -TEST(ignTest, PluginInfoNonLibrary) +TEST(gzTest, PluginInfoNonLibrary) { // Path to gz executable - std::string ign = std::string(GZ_PATH); + std::string gz = std::string(GZ_PATH); - std::string output = custom_exec_str(ign + " plugin --info --plugin " + + std::string output = custom_exec_str(gz + " plugin --info --plugin " + std::string(GZ_PLUGIN_SOURCE_DIR) + "/core/src/Plugin.cc"); EXPECT_NE(std::string::npos, output.find("Error while loading the library")) @@ -114,12 +114,12 @@ TEST(ignTest, PluginInfoNonLibrary) ////////////////////////////////////////////////// /// \brief Check 'gz plugin --info' for a library that has no plugins. -TEST(ignTest, PluginInfoNonPluginLibrary) +TEST(gzTest, PluginInfoNonPluginLibrary) { // Path to gz executable - std::string ign = std::string(GZ_PATH); + std::string gz = std::string(GZ_PATH); - std::string output = custom_exec_str(ign + " plugin --info --plugin " + + std::string output = custom_exec_str(gz + " plugin --info --plugin " + GZ_PLUGIN_LIB); EXPECT_NE(std::string::npos, output.find("does not export any plugins. The " @@ -133,12 +133,12 @@ TEST(ignTest, PluginInfoNonPluginLibrary) ////////////////////////////////////////////////// /// \brief Check 'gz plugin --info' for a library with plugins. -TEST(ignTest, PluginInfoDummyPlugins) +TEST(gzTest, PluginInfoDummyPlugins) { // Path to gz executable - std::string ign = std::string(GZ_PATH); + std::string gz = std::string(GZ_PATH); - std::string output = custom_exec_str(ign + " plugin --info --plugin " + + std::string output = custom_exec_str(gz + " plugin --info --plugin " + GzDummyPlugins_LIB); EXPECT_NE(std::string::npos, output.find("Found 3 plugins in library file")) @@ -172,12 +172,12 @@ TEST(ignTest, PluginInfoDummyPlugins) ////////////////////////////////////////////////// /// \brief Check 'gz plugin --info' with verbose output. -TEST(ignTest, PluginInfoVerboseDummyPlugins) +TEST(gzTest, PluginInfoVerboseDummyPlugins) { // Path to gz executable - std::string ign = std::string(GZ_PATH); + std::string gz = std::string(GZ_PATH); - std::string output = custom_exec_str(ign + " plugin --info --plugin " + + std::string output = custom_exec_str(gz + " plugin --info --plugin " + GzDummyPlugins_LIB + " --verbose"); EXPECT_NE(std::string::npos, output.find("Known Interfaces: 7"))