Skip to content

Commit

Permalink
[ign to gz] Deprecate IGN_GUI_PLUGIN_PATH in favor of GZ_GUI_PLUGIN_P…
Browse files Browse the repository at this point in the history
…ATH (#384)

Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina authored Apr 14, 2022
1 parent 8bfb596 commit 57894fc
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 16 deletions.
4 changes: 4 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Deprecated code produces compile-time warnings. These warning serve as
notification to users that their code should be upgraded. The next major
release will remove the deprecated code.

## Ignition GUI 6.X to 7.X

* The environment variable `IGN_GUI_PLUGIN_PATH` is deprecated. Use `GZ_GUI_PLUGIN_PATH` instead.

## Ignition GUI 6.2 to 6.3

* New QML dependencies, only needed for the NavSatMap plugin: `qml-module-qtlocation`, `qml-module-qtpositioning`
Expand Down
4 changes: 2 additions & 2 deletions examples/plugin/custom_context_menu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
Standalone

cd build
export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -s CustomContext
export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -s CustomContext

Or open an empty window and insert from menu

cd build
export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui
export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui
# Choose CustomContext from menu
4 changes: 2 additions & 2 deletions examples/plugin/dialog_from_plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ a modal dialog attached to the main window from a plugin.
Standalone

cd build
export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -s DialogFromPlugin
export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -s DialogFromPlugin

Or open an empty window and insert from menu

cd build
export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui
export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui
# Choose DialogFromPlugin from menu
6 changes: 3 additions & 3 deletions examples/plugin/hello_plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ configuration from XML.
Standalone:

cd build
export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -s HelloPlugin
export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -s HelloPlugin

Within a window where other plugins can also be inserted, using a custom
configuration:

cd build
export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -c ../HelloPlugin.config
export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -c ../HelloPlugin.config

Or open an empty window and insert from menu:

cd build
export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui
export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui
# Choose HelloPlugin from menu
4 changes: 2 additions & 2 deletions examples/plugin/ign_components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ useful for downstream developers.
Standalone:

cd build
export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -s IgnComponents
export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -s IgnComponents

Within a window where other plugins can also be inserted, using a custom
configuration:

cd build
export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -c ../IgnComponents.config
export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -c ../IgnComponents.config

2 changes: 1 addition & 1 deletion examples/plugin/multiple_qml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ This example shows how to compose a single plugin from multiple QML files.
Quickly check try your plugin as follows:

cd build
export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -s MultipleQml
export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -s MultipleQml

35 changes: 30 additions & 5 deletions src/Application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ namespace ignition
/// these until it is ok to unload the plugin's shared library.
public: std::vector<std::shared_ptr<Plugin>> pluginsAdded;

/// \brief Deprecated environment variable which holds paths to look for
/// plugins
public: std::string pluginPathEnvDeprecated = "IGN_GUI_PLUGIN_PATH";

/// \brief Environment variable which holds paths to look for plugins
public: std::string pluginPathEnv = "IGN_GUI_PLUGIN_PATH";
public: std::string pluginPathEnv = "GZ_GUI_PLUGIN_PATH";

/// \brief Vector of paths to look for plugins
public: std::vector<std::string> pluginPaths;
Expand Down Expand Up @@ -192,7 +196,7 @@ Application::~Application()
std::swap(this->dataPtr->pluginsToAdd, empty);
this->dataPtr->pluginsAdded.clear();
this->dataPtr->pluginPaths.clear();
this->dataPtr->pluginPathEnv = "IGN_GUI_PLUGIN_PATH";
this->dataPtr->pluginPathEnv = "GZ_GUI_PLUGIN_PATH";
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -435,9 +439,23 @@ bool Application::LoadPlugin(const std::string &_filename,
auto pathToLib = systemPaths.FindSharedLibrary(_filename);
if (pathToLib.empty())
{
ignerr << "Failed to load plugin [" << _filename <<
"] : couldn't find shared library." << std::endl;
return false;
// Try deprecated environment variable
common::SystemPaths systemPathsDep;
systemPathsDep.SetPluginPathEnv(this->dataPtr->pluginPathEnvDeprecated);
pathToLib = systemPathsDep.FindSharedLibrary(_filename);
if (pathToLib.empty())
{
ignerr << "Failed to load plugin [" << _filename <<
"] : couldn't find shared library." << std::endl;
return false;
}
else
{
ignwarn << "Found plugin [" << _filename
<< "] using deprecated environment variable ["
<< this->dataPtr->pluginPathEnvDeprecated << "]. Please use ["
<< this->dataPtr->pluginPathEnv << "] instead." << std::endl;
}
}

// Load plugin
Expand Down Expand Up @@ -699,6 +717,13 @@ std::vector<std::pair<std::string, std::vector<std::string>>>
// 1. Paths from env variable
auto paths = common::SystemPaths::PathsFromEnv(this->dataPtr->pluginPathEnv);

// 1.5 Paths from deprecated env variable
auto pathsDeprecated =
common::SystemPaths::PathsFromEnv(this->dataPtr->pluginPathEnvDeprecated);

for (auto const &path : pathsDeprecated)
paths.push_back(path);

// 2. Paths added by calling addPluginPath
for (auto const &path : this->dataPtr->pluginPaths)
paths.push_back(path);
Expand Down
2 changes: 1 addition & 1 deletion tutorials/03_plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ for an example.

Ignition GUI will look for plugins on the following paths, in this order:

1. All paths set on the `IGN_GUI_PLUGIN_PATH` environment variable
1. All paths set on the `GZ_GUI_PLUGIN_PATH` environment variable
2. All paths added by calling `ignition::gui::addPluginPath`
3. `~/.ignition/gui/plugins`
4. [Plugins which are installed with Ignition GUI](https://ignitionrobotics.org/api/gui/6.0/namespaceignition_1_1gui_1_1plugins.html)
Expand Down

0 comments on commit 57894fc

Please sign in to comment.