Skip to content

Commit

Permalink
Migrate ign executable to gz
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Jun 13, 2022
1 parent 8b28014 commit e6b0131
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 65 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ign_find_package(DL

#--------------------------------------
# Find ignition-tools
find_program(GZ_TOOLS_PROGRAM ign)
find_program(GZ_TOOLS_PROGRAM gz)


#--------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# "tests" variable
ign_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
Expand Down Expand Up @@ -41,11 +41,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/$<CONFIG>")

set_tests_properties(UNIT_ign_TEST PROPERTIES
set_tests_properties(UNIT_gz_TEST PROPERTIES
ENVIRONMENT "${_env_vars}")
endif()

Expand All @@ -54,7 +54,7 @@ install(
DESTINATION ${IGN_INCLUDE_INSTALL_DIR_FULL})

#============================================================================
# ign command line support
# gz command line support
#============================================================================
add_subdirectory(conf)
add_subdirectory(src)
4 changes: 2 additions & 2 deletions loader/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/$<CONFIG>/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}")
set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/$<CONFIG>/ruby/ignition/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 @@ -13,7 +13,7 @@ file(GENERATE
INPUT "${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml.configured")

# 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 loader/conf/plugin.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@
library_version: @PROJECT_VERSION_FULL@
library_path: @ign_library_path@
library_path: @gz_library_path@
commands:
- plugin : Print information about plugins.
---
8 changes: 4 additions & 4 deletions loader/src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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}
)

Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion loader/src/cmd/gz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "gz/plugin/Loader.hh"
#include "gz/plugin/config.hh"
#include "ign.hh"
#include "gz.hh"

//////////////////////////////////////////////////
extern "C" void cmdPluginInfo(
Expand Down
2 changes: 1 addition & 1 deletion loader/src/cmd/plugin_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
#include <gz/utils/cli/CLI.hpp>

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

//////////////////////////////////////////////////
/// \brief Enumeration of available commands
Expand Down
24 changes: 12 additions & 12 deletions loader/src/gz_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 " +
Expand All @@ -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 " +
Expand All @@ -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 " +
Expand All @@ -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 " +
Expand Down Expand Up @@ -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 " +
Expand Down
14 changes: 7 additions & 7 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ ign_build_tests(
foreach(test ${test_targets})

foreach(plugin_target
IGNBadPluginAlign
IGNBadPluginAPIVersionNew
IGNBadPluginAPIVersionOld
IGNBadPluginNoInfo
IGNBadPluginSize
GzBadPluginAlign
GzBadPluginAPIVersionNew
GzBadPluginAPIVersionOld
GzBadPluginNoInfo
GzBadPluginSize
GzDummyPlugins
IGNFactoryPlugins
IGNTemplatedPlugins)
GzFactoryPlugins
GzTemplatedPlugins)

target_compile_definitions(${test} PRIVATE
"${plugin_target}_LIB=\"$<TARGET_FILE:${plugin_target}>\"")
Expand Down
8 changes: 4 additions & 4 deletions test/integration/factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ using namespace test::util;
TEST(Factory, Inspect)
{
gz::plugin::Loader pl;
pl.LoadLib(IGNFactoryPlugins_LIB);
pl.LoadLib(GzFactoryPlugins_LIB);

std::cout << pl.PrettyStr() << std::endl;

Expand All @@ -43,7 +43,7 @@ TEST(Factory, Inspect)
TEST(Factory, Construct)
{
gz::plugin::Loader pl;
pl.LoadLib(IGNFactoryPlugins_LIB);
pl.LoadLib(GzFactoryPlugins_LIB);

auto nameFactory = pl.Factory<NameFactory>("test::util::DummyNameForward");
ASSERT_NE(nullptr, nameFactory);
Expand Down Expand Up @@ -100,7 +100,7 @@ TEST(Factory, Construct)
TEST(Factory, Alias)
{
gz::plugin::Loader pl;
pl.LoadLib(IGNFactoryPlugins_LIB);
pl.LoadLib(GzFactoryPlugins_LIB);

std::string symbolName;
for (const std::string &name : pl.AllPlugins())
Expand Down Expand Up @@ -137,7 +137,7 @@ TEST(Factory, Alias)
/////////////////////////////////////////////////
TEST(Factory, LibraryManagement)
{
const std::string &libraryPath = IGNFactoryPlugins_LIB;
const std::string &libraryPath = GzFactoryPlugins_LIB;

// Test that a single ProductPtr will keep the library loaded and correctly
// manage the lifecycle of the product.
Expand Down
10 changes: 5 additions & 5 deletions test/integration/plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
TEST(Loader, LoadBadPlugins)
{
std::vector<std::string> libraries = {
IGNBadPluginAPIVersionOld_LIB,
IGNBadPluginAPIVersionNew_LIB,
IGNBadPluginAlign_LIB,
IGNBadPluginNoInfo_LIB,
IGNBadPluginSize_LIB};
GzBadPluginAPIVersionOld_LIB,
GzBadPluginAPIVersionNew_LIB,
GzBadPluginAlign_LIB,
GzBadPluginNoInfo_LIB,
GzBadPluginSize_LIB};
for (auto const & library : libraries)
{
gz::plugin::Loader pl;
Expand Down
4 changes: 2 additions & 2 deletions test/integration/templated_plugins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ using namespace test::plugins;
TEST(TemplatedPlugins, InterfaceCount)
{
gz::plugin::Loader pl;
pl.LoadLib(IGNTemplatedPlugins_LIB);
pl.LoadLib(GzTemplatedPlugins_LIB);

const std::size_t getIntCount =
pl.PluginsImplementing< TemplatedGetInterface<int> >().size();
Expand Down Expand Up @@ -107,7 +107,7 @@ void TestSetAndGet(const gz::plugin::Loader &_pl,
TEST(TemplatedPlugins, SetAndGet)
{
gz::plugin::Loader pl;
pl.LoadLib(IGNTemplatedPlugins_LIB);
pl.LoadLib(GzTemplatedPlugins_LIB);

TestSetAndGet<int>(pl, 120);
TestSetAndGet<std::string>(pl, "some amazing string");
Expand Down
28 changes: 14 additions & 14 deletions test/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
add_library(IGNBadPluginAlign SHARED BadPluginAlign.cc)
add_library(IGNBadPluginAPIVersionNew SHARED BadPluginAPIVersionNew.cc)
add_library(IGNBadPluginAPIVersionOld SHARED BadPluginAPIVersionOld.cc)
add_library(IGNBadPluginNoInfo SHARED BadPluginNoInfo.cc)
add_library(IGNBadPluginSize SHARED BadPluginSize.cc)
add_library(IGNFactoryPlugins SHARED FactoryPlugins.cc)
add_library(IGNTemplatedPlugins SHARED TemplatedPlugins.cc)
add_library(GzBadPluginAlign SHARED BadPluginAlign.cc)
add_library(GzBadPluginAPIVersionNew SHARED BadPluginAPIVersionNew.cc)
add_library(GzBadPluginAPIVersionOld SHARED BadPluginAPIVersionOld.cc)
add_library(GzBadPluginNoInfo SHARED BadPluginNoInfo.cc)
add_library(GzBadPluginSize SHARED BadPluginSize.cc)
add_library(GzFactoryPlugins SHARED FactoryPlugins.cc)
add_library(GzTemplatedPlugins SHARED TemplatedPlugins.cc)

add_library(GzDummyPlugins SHARED
DummyPlugins.cc
Expand All @@ -13,14 +13,14 @@ add_library(GzDummyPlugins SHARED
# Create a variable for the name of the header which will contain the dummy plugin path.
# This variable gets put in the cache so that it is available at generation time.
foreach(plugin_target
IGNBadPluginAlign
IGNBadPluginAPIVersionNew
IGNBadPluginAPIVersionOld
IGNBadPluginNoInfo
IGNBadPluginSize
GzBadPluginAlign
GzBadPluginAPIVersionNew
GzBadPluginAPIVersionOld
GzBadPluginNoInfo
GzBadPluginSize
GzDummyPlugins
IGNFactoryPlugins
IGNTemplatedPlugins)
GzFactoryPlugins
GzTemplatedPlugins)

target_link_libraries(${plugin_target} PRIVATE
${PROJECT_LIBRARY_TARGET_NAME}-register)
Expand Down
6 changes: 3 additions & 3 deletions tutorials/02_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e6b0131

Please sign in to comment.