Skip to content

Commit

Permalink
Migrate CLI
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Jun 16, 2022
1 parent 4e5ca49 commit c5f3770
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 41 deletions.
4 changes: 2 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
1. Adds PerformanceSensorMetrics proto message.
* [Pull request #172](https:/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:/gazebosim/gz-msgs/pull/166)

1. Bazel build support
Expand Down Expand Up @@ -164,7 +164,7 @@
1. Adds PerformanceSensorMetrics proto message.
* [Pull request #172](https:/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:/gazebosim/gz-msgs/pull/166)

1. Bazel build support for ign-msgs6
Expand Down Expand Up @@ -280,7 +280,7 @@
1. Adds PerformanceSensorMetrics proto message.
* [Pull request #172](https:/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:/gazebosim/gz-msgs/pull/166)

1. Remove tools/code\_check and update codecov
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```
Expand Down
4 changes: 2 additions & 2 deletions conf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion conf/msgs.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.
---
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_FILE:gz_msgs_gen> DESTINATION ${IGN_BIN_INSTALL_DIR} RENAME ign_msgs_gen PERMISSIONS OWNER_EXECUTE)
endif()
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -219,7 +219,7 @@ ign_build_tests(TYPE UNIT
)

##################################################
# ign msgs command
# gz msgs command
if(NOT WIN32)
add_subdirectory(cmd)
endif()
4 changes: 2 additions & 2 deletions src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions src/cmd/cmdmsgs.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -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" +
Expand Down Expand Up @@ -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']}]() "\
Expand Down
2 changes: 1 addition & 1 deletion src/gz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#pragma warning(pop)
#endif

#include "ign.hh"
#include "gz.hh"

#include <iostream>
#include <string>
Expand Down
4 changes: 2 additions & 2 deletions src/gz.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#include <cstring>
#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.
Expand Down
6 changes: 3 additions & 3 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:/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 ()
16 changes: 8 additions & 8 deletions tools/gz_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,29 @@ 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));
}

/////////////////////////////////////////////////
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;
Expand All @@ -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;
Expand All @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions tutorials/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit c5f3770

Please sign in to comment.