From c5f3770e540cfba92135f141ca02935a66f31f82 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Sun, 12 Jun 2022 22:06:39 -0700 Subject: [PATCH] Migrate CLI Signed-off-by: methylDragon --- BUILD.bazel | 4 ++-- CMakeLists.txt | 6 +++--- Changelog.md | 8 ++++---- Migration.md | 2 +- README.md | 8 ++++---- conf/CMakeLists.txt | 4 ++-- conf/msgs.yaml.in | 2 +- src/CMakeLists.txt | 6 +++--- src/cmd/CMakeLists.txt | 4 ++-- src/cmd/cmdmsgs.rb.in | 4 ++-- src/gz.cc | 2 +- src/gz.hh | 4 ++-- tools/CMakeLists.txt | 6 +++--- tools/gz_TEST.cc | 16 ++++++++-------- tutorials/install.md | 6 +++--- 15 files changed, 41 insertions(+), 41 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 59babb77..6fbf5262 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -137,8 +137,8 @@ cc_library( cc_binary( name = "libignition-msgs.so", srcs = [ - "src/ign.cc", - "src/ign.hh", + "src/gz.cc", + "src/gz.hh", ], includes = ["include"], linkshared = True, diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ddb697a..56a6a31a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,8 +88,8 @@ ign_find_package(ignition-math7 REQUIRED) set(IGN_MATH_VER ${ignition-math7_VERSION_MAJOR}) #-------------------------------------- -# Find if ign command is available -find_program(HAVE_IGN_TOOLS ign) +# Find if gz command is available +find_program(HAVE_GZ_TOOLS gz) #-------------------------------------- # Find Tinyxml2 @@ -101,7 +101,7 @@ ign_find_package(TINYXML2 REQUIRED PRIVATE PRETTY tinyxml2) ign_configure_build(QUIT_IF_BUILD_ERRORS) #============================================================================ -# ign command line support +# gz command line support #============================================================================ add_subdirectory(conf) diff --git a/Changelog.md b/Changelog.md index 6858e945..05b4625f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -104,7 +104,7 @@ 1. Adds PerformanceSensorMetrics proto message. * [Pull request #172](https://github.com/gazebosim/gz-msgs/pull/172) -1. Detect ign instead of using cmake module to check for ignition-tools +1. Detect gz instead of using cmake module to check for ignition-tools * [Pull request #166](https://github.com/gazebosim/gz-msgs/pull/166) 1. Bazel build support @@ -164,7 +164,7 @@ 1. Adds PerformanceSensorMetrics proto message. * [Pull request #172](https://github.com/gazebosim/gz-msgs/pull/172) -1. Detect ign instead of using cmake module to check for ignition-tools +1. Detect gz instead of using cmake module to check for ignition-tools * [Pull request #166](https://github.com/gazebosim/gz-msgs/pull/166) 1. Bazel build support for ign-msgs6 @@ -280,7 +280,7 @@ 1. Adds PerformanceSensorMetrics proto message. * [Pull request #172](https://github.com/gazebosim/gz-msgs/pull/172) -1. Detect ign instead of using cmake module to check for ignition-tools +1. Detect gz instead of using cmake module to check for ignition-tools * [Pull request #166](https://github.com/gazebosim/gz-msgs/pull/166) 1. Remove tools/code\_check and update codecov @@ -499,7 +499,7 @@ 1. Updated `model.proto` with more documentation. Position, velocity, force, and acceleration information for joint have been moved to the `axis.proto` - message, see the Migration guide. The `ign.hh` header file is no longer + message, see the Migration guide. The `gz.hh` header file is no longer installed. * [BitBucket pull request 104](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-msgs/pull-requests/104) diff --git a/Migration.md b/Migration.md index ab11e3b2..a9fbc2ba 100644 --- a/Migration.md +++ b/Migration.md @@ -87,7 +87,7 @@ release will remove the deprecated code. ### Removals -1. **include/gz/msgs/ign.hh** is no longer installed. +1. **include/gz/msgs/gz.hh** is no longer installed. ## Gazebo Msgs 2.X to 3.X diff --git a/README.md b/README.md index 7829e874..2a9b89a7 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ A workaround for a single package is to define the environment variable `GZ_CONFIG_PATH` to point to the location of the Ignition library installation, where the YAML file for the package is found, such as ``` -export GZ_CONFIG_PATH=/usr/local/share/ignition +export GZ_CONFIG_PATH=/usr/local/share/gz ``` However, that environment variable only takes a single path, which means if the @@ -41,9 +41,9 @@ line is using symbolic links to each library's YAML file. ``` mkdir ~/.ignition/tools/configs -p cd ~/.ignition/tools/configs/ -ln -s /usr/local/share/ignition/fuel8.yaml . -ln -s /usr/local/share/ignition/transport12.yaml . -ln -s /usr/local/share/ignition/transportlog12.yaml . +ln -s /usr/local/share/gz/fuel8.yaml . +ln -s /usr/local/share/gz/transport12.yaml . +ln -s /usr/local/share/gz/transportlog12.yaml . ... export GZ_CONFIG_PATH=$HOME/.ignition/tools/configs ``` diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index 6c02f688..49497f7a 100644 --- a/conf/CMakeLists.txt +++ b/conf/CMakeLists.txt @@ -1,5 +1,5 @@ # Used only for internal testing. -set(ign_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. @@ -9,7 +9,7 @@ configure_file( "${CMAKE_BINARY_DIR}/test/conf/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml" @ONLY) # Used for the installed version. -set(ign_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/conf/msgs.yaml.in b/conf/msgs.yaml.in index 37d877df..3bf58fb7 100644 --- a/conf/msgs.yaml.in +++ b/conf/msgs.yaml.in @@ -2,7 +2,7 @@ format: 1.0.0 library_name: @PROJECT_NAME_NO_VERSION_LOWER@ library_version: @PROJECT_VERSION_FULL@ -library_path: @ign_library_path@ +library_path: @gz_library_path@ commands: - msg : Print information about messages. --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 659d98b7..b48c3bd7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,7 +14,7 @@ endif() if(INSTALL_GZ_MSGS_GEN_EXECUTABLE) set_target_properties(gz_msgs_gen PROPERTIES VERSION ${PROJECT_VERSION_FULL}) install(TARGETS gz_msgs_gen DESTINATION ${IGN_BIN_INSTALL_DIR}) - + # TODO(chapulina) Deprecated. Remove on v10. install(FILES $ DESTINATION ${IGN_BIN_INSTALL_DIR} RENAME ign_msgs_gen PERMISSIONS OWNER_EXECUTE) endif() @@ -178,7 +178,7 @@ ign_create_core_library(SOURCES ${gen_sources} ${PROJECT_SOURCE_DIR}/src/Factory.cc ${PROJECT_SOURCE_DIR}/src/Filesystem.cc - ${PROJECT_SOURCE_DIR}/src/ign.cc + ${PROJECT_SOURCE_DIR}/src/gz.cc ${PROJECT_SOURCE_DIR}/src/Utility.cc CXX_STANDARD 17) @@ -219,7 +219,7 @@ ign_build_tests(TYPE UNIT ) ################################################## -# ign msgs command +# gz msgs command if(NOT WIN32) add_subdirectory(cmd) endif() diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index 643bb0d4..634a31d5 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -2,7 +2,7 @@ # Generate the ruby script for internal testing. # Note that the major version of the library is included in the name. # Ex: cmdtransport0.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 "${cmd_script_generated_test}.configured") # Set the library_location variable to the full path of the library file within @@ -41,4 +41,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/src/cmd/cmdmsgs.rb.in b/src/cmd/cmdmsgs.rb.in index 5bd150a9..1f1d1037 100644 --- a/src/cmd/cmdmsgs.rb.in +++ b/src/cmd/cmdmsgs.rb.in @@ -36,7 +36,7 @@ COMMON_OPTIONS = ' --versions Show the available versions.' COMMANDS = { 'msg' => "Print information about ignition messages.\n\n" + - " ign msg [options]\n\n" + + " gz msg [options]\n\n" + "Options:\n\n" + " -i [ --info ] arg " + "Get info about the specified message type.\n" + @@ -151,7 +151,7 @@ class Cmd end else puts 'Command error: I do not have an implementation for '\ - "command [ign #{options['command']}]." + "command [gz #{options['command']}]." end rescue puts "Library error: Problem running [#{options['command']}]() "\ diff --git a/src/gz.cc b/src/gz.cc index fac6eeb9..f61975df 100644 --- a/src/gz.cc +++ b/src/gz.cc @@ -25,7 +25,7 @@ #pragma warning(pop) #endif -#include "ign.hh" +#include "gz.hh" #include #include diff --git a/src/gz.hh b/src/gz.hh index 3df68de2..00e9459f 100644 --- a/src/gz.hh +++ b/src/gz.hh @@ -21,11 +21,11 @@ #include #include "gz/msgs/Export.hh" -/// \brief External hook to execute 'ign msg -i' from the command line. +/// \brief External hook to execute 'gz msg -i' from the command line. /// \param[in] _msg Message type name. extern "C" GZ_MSGS_VISIBLE void cmdMsgInfo(const char *_msg); -/// \brief External hook to execute 'ign msg -l' from the command line. +/// \brief External hook to execute 'gz msg -l' from the command line. extern "C" GZ_MSGS_VISIBLE void cmdMsgList(); /// \brief External hook to read the library version. diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index e0b57d10..3b6600b4 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -3,16 +3,16 @@ include_directories( ${CMAKE_BINARY_DIR}/test ) set (test_sources - ign_TEST.cc + gz_TEST.cc ) # Skip command line tests for Windows, see # https://github.com/gazebosim/gz-msgs/issues/28 if (MSVC) - list(REMOVE_ITEM test_sources ign_TEST.cc) + list(REMOVE_ITEM test_sources gz_TEST.cc) endif() -if (HAVE_IGN_TOOLS) +if (HAVE_GZ_TOOLS) ign_build_tests(TYPE UNIT SOURCES ${test_sources}) endif () diff --git a/tools/gz_TEST.cc b/tools/gz_TEST.cc index a704a870..80cc8bd2 100644 --- a/tools/gz_TEST.cc +++ b/tools/gz_TEST.cc @@ -52,8 +52,8 @@ std::string custom_exec_str(std::string _cmd) ///////////////////////////////////////////////// TEST(CmdLine, Versions) { - auto outputDebug = custom_exec_str("ign"); - auto output = custom_exec_str("ign msg --versions"); + auto outputDebug = custom_exec_str("gz"); + auto output = custom_exec_str("gz msg --versions"); EXPECT_NE(std::string::npos, output.find(g_version)); } @@ -61,20 +61,20 @@ TEST(CmdLine, Versions) TEST(CmdLine, Help) { auto output = - custom_exec_str("ign msg --force-version " + g_version + " --help"); + custom_exec_str("gz msg --force-version " + g_version + " --help"); EXPECT_NE(std::string::npos, output.find("list")); - output = custom_exec_str("ign msg --force-version " + g_version + " -h"); + output = custom_exec_str("gz msg --force-version " + g_version + " -h"); EXPECT_NE(std::string::npos, output.find("list")); - output = custom_exec_str("ign msg --force-version " + g_version); + output = custom_exec_str("gz msg --force-version " + g_version); EXPECT_NE(std::string::npos, output.find("list")); } ///////////////////////////////////////////////// TEST(CmdLine, MsgList) { - auto output = custom_exec_str("ign msg --list --force-version " + + auto output = custom_exec_str("gz msg --list --force-version " + g_version); EXPECT_NE(std::string::npos, output.find("gz_msgs.WorldControl")) << output; @@ -83,7 +83,7 @@ TEST(CmdLine, MsgList) ///////////////////////////////////////////////// TEST(CmdLine, MsgInfo) { - auto output = custom_exec_str("ign msg --info gz_msgs.WorldControl " + auto output = custom_exec_str("gz msg --info gz_msgs.WorldControl " "--force-version " + g_version); EXPECT_NE(std::string::npos, output.find("message WorldControl {")) << output; @@ -99,7 +99,7 @@ int main(int argc, char **argv) // Make sure that we load the library recently built and not the one installed // in your system. - // Add the directory where ignition msgs has been built. + // Add the directory where gz msgs has been built. std::string value = std::string(GZ_TEST_LIBRARY_PATH); // Save the current value of LD_LIBRARY_PATH. auto cvalue = std::getenv("LD_LIBRARY_PATH"); diff --git a/tutorials/install.md b/tutorials/install.md index 83382fe7..86ab0bc0 100644 --- a/tutorials/install.md +++ b/tutorials/install.md @@ -44,8 +44,8 @@ Miniconda suffices. Create if necessary, and activate a Conda environment: ``` -conda create -n ign-ws -conda activate ign-ws +conda create -n gz-ws +conda activate gz-ws ``` Install `ignition-msgs`: @@ -132,7 +132,7 @@ Navigate to `condabin` if necessary to use the `conda` command (i.e., if Conda i Activate the Conda environment: ``` -conda activate ign-ws +conda activate gz-ws ``` Install prerequisites: