Skip to content

Commit 1777f47

Browse files
authored
Bump gz-cmake and others in jetty (#175)
* Bumping gz-cmake and others except gz-tools. * Disable jammy CI, codecov * Change exe target name to avoid name collision * Improve robustness to whitespace in gz_TEST The amount of indentation in `gz plugin --help` can vary, so add a helper function that looks for two substrings separated only by spaces and use it instead of hard-coding the expected amount of whitespace. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
1 parent b899bff commit 1777f47

File tree

11 files changed

+59
-54
lines changed

11 files changed

+59
-54
lines changed

.github/ci/packages.apt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
libgz-cmake4-dev
1+
libgz-cmake5-dev
22
libgz-tools2-dev
3-
libgz-utils3-cli-dev
3+
libgz-utils4-cli-dev

.github/workflows/ci.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,6 @@ on:
99
- 'main'
1010

1111
jobs:
12-
jammy-ci:
13-
runs-on: ubuntu-latest
14-
name: Ubuntu Jammy CI
15-
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v4
18-
- name: Compile and test
19-
id: ci
20-
uses: gazebo-tooling/action-gz-ci@jammy
21-
with:
22-
codecov-enabled: true
2312
noble-ci:
2413
runs-on: ubuntu-latest
2514
name: Ubuntu Noble CI
@@ -30,6 +19,7 @@ jobs:
3019
id: ci
3120
uses: gazebo-tooling/action-gz-ci@noble
3221
with:
22+
# codecov-enabled: true
3323
cppcheck-enabled: true
3424
cpplint-enabled: true
3525
doxygen-enabled: true

CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
33
#============================================================================
44
# Initialize the project
55
#============================================================================
6-
project(gz-plugin4 VERSION 4.0.0)
6+
project(gz-plugin VERSION 4.0.0)
77

88
#============================================================================
99
# Find gz-cmake
1010
#============================================================================
11-
find_package(gz-cmake4 REQUIRED)
12-
set(GZ_CMAKE_VER ${gz-cmake4_VERSION_MAJOR})
11+
find_package(gz-cmake REQUIRED)
1312

1413
#============================================================================
1514
# Configure the project
@@ -49,8 +48,7 @@ set(GZ_TOOLS_VER 2)
4948

5049
#--------------------------------------
5150
# Find gz-utils
52-
gz_find_package(gz-utils3 REQUIRED COMPONENTS cli)
53-
set(GZ_UTILS_VER ${gz-utils3_VERSION_MAJOR})
51+
gz_find_package(gz-utils REQUIRED COMPONENTS cli)
5452

5553
#============================================================================
5654
# Configure the build

MigrationFromCommon.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ framework. Some of the instructions here may also be useful to new adopters of
1111
just wants to use `PluginPtr` objects can link to `core`, e.g.:
1212

1313
```
14-
target_link_libraries(my_target PUBLIC gz-plugin3::core)
14+
target_link_libraries(my_target PUBLIC gz-plugin::core)
1515
```
1616

1717
However, if your code wants to be able to load plugins, it should link to the
1818
`loader` component. In most cases, it should probably link privately, unless you
1919
need the `gz::plugin::Loader` class to be part of your library's API:
2020

2121
```
22-
target_link_libraries(my_target PRIVATE gz-plugin3::loader)
22+
target_link_libraries(my_target PRIVATE gz-plugin::loader)
2323
```
2424

2525
If `gz::plugin::PluginPtr` objects are part of your library's API, then
@@ -28,9 +28,9 @@ you may want `loader` to be private while `core` is public:
2828
```
2929
target_link_libraries(my_target
3030
PUBLIC
31-
gz-plugin3::core
31+
gz-plugin::core
3232
PRIVATE
33-
gz-plugin3::loader
33+
gz-plugin::loader
3434
)
3535
```
3636

@@ -39,7 +39,7 @@ then you should link against the `register` component. This should almost always
3939
be a private link, since plugin registration is purely internal for a library:
4040

4141
```
42-
target_link_libraries(my_plugin PRIVATE gz-plugin3::register)
42+
target_link_libraries(my_plugin PRIVATE gz-plugin::register)
4343
```
4444

4545
# Registering a plugin

core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ gz_create_core_library(
88
)
99

1010
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
11-
PUBLIC gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER})
11+
PUBLIC gz-utils::gz-utils)
1212

1313
# Build the unit tests
1414
gz_build_tests(

examples/CMakeLists.txt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(examples)
44

5-
find_package(gz-plugin4 QUIET REQUIRED COMPONENTS all)
6-
set(GZ_PLUGIN_VER ${gz-plugin4_VERSION_MAJOR})
5+
find_package(gz-plugin QUIET REQUIRED COMPONENTS all)
76

8-
find_package(gz-common6 QUIET)
9-
set(GZ_COMMON_VER ${gz-common6_VERSION_MAJOR})
7+
find_package(gz-common QUIET)
108

11-
find_package(gz-math8 QUIET)
12-
set(GZ_MATH_VER ${gz-math8_VERSION_MAJOR})
9+
find_package(gz-math QUIET)
1310

1411
add_subdirectory(plugins)
1512

@@ -30,9 +27,9 @@ foreach(example_file ${example_files})
3027

3128
target_link_libraries(${example}
3229
PRIVATE
33-
gz-plugin${GZ_PLUGIN_VER}::loader
34-
gz-common${GZ_COMMON_VER}::core
35-
gz-math${GZ_MATH_VER}::core
30+
gz-plugin::loader
31+
gz-common::core
32+
gz-math::core
3633
)
3734

3835
# This is only needed for the examples that use plugins, but it doesn't hurt

examples/plugins/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ foreach(plugin_file ${plugin_files})
1313

1414
target_link_libraries(${plugin}
1515
PRIVATE
16-
gz-plugin${GZ_PLUGIN_VER}::register
17-
gz-math${GZ_MATH_VER}::core)
16+
gz-plugin::register
17+
gz-math::core)
1818

1919
# All these libraries will go into the same directory, so it's sufficient for
2020
# us to grab the last one.

loader/src/cmd/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ target_link_libraries(gz PUBLIC
44
${PROJECT_LIBRARY_TARGET_NAME}
55
)
66

7-
set(plugin_executable gz-plugin)
7+
# Define the desired output name of the executable
8+
set(plugin_executable_output_name gz-plugin)
9+
# Append "-exe" to cmake target name to differ from the library target name
10+
set(plugin_executable gz-plugin-exe)
811
add_executable(${plugin_executable} plugin_main.cc)
12+
set_target_properties(${plugin_executable}
13+
PROPERTIES OUTPUT_NAME ${plugin_executable_output_name})
14+
915
target_link_libraries(${plugin_executable}
1016
gz
11-
gz-utils${GZ_UTILS_VER}::cli
17+
gz-utils::cli
1218
${loader}
1319
)
1420

loader/src/gz_TEST.cc

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,41 @@ std::string custom_exec_str(std::string _cmd)
5757
return result;
5858
}
5959

60+
//////////////////////////////////////////////////
61+
/// \brief Verify that two substrings are found within a larger string,
62+
/// separated only by spaces
63+
void verifySpaceSeparatedSubstrings(const std::string &_stringToSearch,
64+
const std::string &_substring1,
65+
const std::string &_substring2)
66+
{
67+
auto iterator1 = _stringToSearch.find(_substring1);
68+
EXPECT_NE(std::string::npos, iterator1)
69+
<< " failed to find \"" << _substring1 << "\" in:\n" << _stringToSearch;
70+
ASSERT_LE(iterator1 + _substring1.size(), _stringToSearch.size());
71+
auto iterator2 =
72+
_stringToSearch.find_first_not_of(' ', iterator1 + _substring1.size());
73+
EXPECT_NE(std::string::npos, iterator2);
74+
ASSERT_LE(iterator2 + _substring2.size(), _stringToSearch.size());
75+
EXPECT_EQ(_substring2, _stringToSearch.substr(iterator2, _substring2.size()));
76+
}
77+
6078
//////////////////////////////////////////////////
6179
/// \brief Check 'gz plugin --help'.
62-
TEST(gzTest, IgnPluginHelp)
80+
TEST(gzTest, GzPluginHelp)
6381
{
6482
// Path to gz executable
6583
std::string gz = std::string(GZ_PATH);
6684
std::string output = custom_exec_str(gz + " plugin --help");
67-
EXPECT_NE(std::string::npos,
68-
output.find("-i [--info] Get info about a plugin."))
69-
<< output;
70-
EXPECT_NE(std::string::npos,
71-
output.find("-p [--plugin] TEXT Path to a plugin."))
72-
<< output;
85+
verifySpaceSeparatedSubstrings(
86+
output, "-i [--info]", "Get info about a plugin.");
87+
verifySpaceSeparatedSubstrings(
88+
output, "-p [--plugin] TEXT", "Path to a plugin.");
7389

7490
output = custom_exec_str(gz + " plugin");
75-
EXPECT_NE(std::string::npos,
76-
output.find("-i [--info] Get info about a plugin."))
77-
<< output;
78-
EXPECT_NE(std::string::npos,
79-
output.find("-p [--plugin] TEXT Path to a plugin."))
80-
<< output;
91+
verifySpaceSeparatedSubstrings(
92+
output, "-i [--info]", "Get info about a plugin.");
93+
verifySpaceSeparatedSubstrings(
94+
output, "-p [--plugin] TEXT", "Path to a plugin.");
8195
}
8296

8397
//////////////////////////////////////////////////

package.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="2">
4-
<name>gz-plugin4</name>
4+
<name>gz-plugin</name>
55
<version>4.0.0</version>
66
<description>Gazebo Plugin : Cross-platform C++ library for dynamically loading plugins.</description>
77
<maintainer email="ahcorde@gmail.com">Alejandro Hernández Cordero</maintainer>
@@ -10,10 +10,10 @@
1010

1111
<buildtool_depend>cmake</buildtool_depend>
1212

13-
<build_depend>gz-cmake4</build_depend>
13+
<build_depend>gz-cmake</build_depend>
1414

1515
<depend>gz-tools2</depend>
16-
<depend>gz-utils3</depend>
16+
<depend>gz-utils</depend>
1717

1818
<export>
1919
<build_type>cmake</build_type>

0 commit comments

Comments
 (0)