Skip to content

Commit

Permalink
Make systems and tests include headers they use (#2100)
Browse files Browse the repository at this point in the history
* Update for new message generation and iwyu (#2087)

Signed-off-by: Michael Carroll <mjcarroll@intrinsic.ai>
  • Loading branch information
mjcarroll authored Aug 31, 2023
1 parent 8614184 commit 5846393
Show file tree
Hide file tree
Showing 50 changed files with 237 additions and 55 deletions.
3 changes: 3 additions & 0 deletions src/AddedMass_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

#include <gtest/gtest.h>

#include <gz/msgs/boolean.pb.h>
#include <gz/msgs/world_control.pb.h>

#include <gz/transport/Node.hh>
#include <gz/sim/components/AngularVelocity.hh>
#include <gz/sim/components/AngularVelocityCmd.hh>
Expand Down
49 changes: 32 additions & 17 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
add_subdirectory(rendering)
add_subdirectory(gui)
add_subdirectory(systems)
add_subdirectory(msgs)

set_source_files_properties(
${PROTO_PRIVATE_SRC}
${PROTO_PRIVATE_HEADERS}
PROPERTIES GENERATED TRUE
file(GLOB gz_msgs_proto_files
${CMAKE_CURRENT_SOURCE_DIR}/proto/gz/sim/private_msgs/*.proto
)

# Suppress compiler warnings in generated protobuf C++ code.
if(NOT MSVC)
set_source_files_properties(
${PROTO_PRIVATE_SRC}
COMPILE_FLAGS -Wno-unused-parameter
)
endif()
get_target_property(msgs_desc_file
gz-msgs${GZ_MSGS_VER}::gz-msgs${GZ_MSGS_VER} GZ_MSGS_DESC_FILE)

gz_msgs_generate_messages_impl(
MSGS_GEN_SCRIPT
${gz-msgs10_PROTO_GENERATOR_SCRIPT}
FACTORY_GEN_SCRIPT
${gz-msgs10_FACTORY_GENERATOR_SCRIPT}
GZ_PROTOC_PLUGIN
${gz-msgs10_PROTO_GENERATOR_PLUGIN}
INPUT_PROTOS
${gz_msgs_proto_files}
PROTO_PACKAGE
"gz.sim.private_msgs"
PROTO_PATH
${CMAKE_CURRENT_SOURCE_DIR}/proto
OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/gz_msgs_gen
OUTPUT_SOURCES
msgs_sources
OUTPUT_HEADERS
msgs_headers
OUTPUT_DETAIL_HEADERS
msgs_detail_headers
OUTPUT_PYTHON
msgs_python
DEPENDENCY_DESCRIPTIONS ${msgs_desc_file}
)

set(network_sources
network/NetworkConfig.cc
Expand Down Expand Up @@ -70,9 +88,9 @@ set (sources
Util.cc
View.cc
World.cc
${PROTO_PRIVATE_SRC}
${network_sources}
${comms_sources}
${msgs_sources}
)

set (gtest_sources
Expand Down Expand Up @@ -204,10 +222,7 @@ endif()
target_include_directories(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)

add_dependencies(${PROJECT_LIBRARY_TARGET_NAME}
gz-sim_private_msgs
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/gz_msgs_gen>
)

set(GZ_SIM_PLUGIN_INSTALL_DIR
Expand Down
6 changes: 6 additions & 0 deletions src/Server_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
*/

#include <gtest/gtest.h>

#include <gz/msgs/boolean.pb.h>
#include <gz/msgs/server_control.pb.h>
#include <gz/msgs/stringmsg.pb.h>
#include <gz/msgs/stringmsg_v.pb.h>

#include <csignal>
#include <vector>
#include <gz/common/StringUtils.hh>
Expand Down
8 changes: 7 additions & 1 deletion src/SimulationRunner_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
*/

#include <gtest/gtest.h>

#include <tinyxml2.h>

#include <gz/msgs/clock.pb.h>
#include <gz/msgs/gui.pb.h>
#include <gz/msgs/sdf_generator_config.pb.h>
#include <gz/msgs/stringmsg.pb.h>

#include <gz/common/Console.hh>
#include <gz/common/Util.hh>
#include <gz/transport/Node.hh>
Expand All @@ -32,8 +38,8 @@
#include <sdf/Root.hh>
#include <sdf/Sphere.hh>


#include "test_config.hh"

#include "gz/sim/components/CanonicalLink.hh"
#include "gz/sim/components/ChildLinkName.hh"
#include "gz/sim/components/Collision.hh"
Expand Down
7 changes: 4 additions & 3 deletions src/cmd/ModelCommandAPI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

#include "ModelCommandAPI.hh"

#include <gz/msgs/serialized.pb.h>
#include <gz/msgs/serialized_map.pb.h>
#include <gz/msgs/stringmsg_v.pb.h>

#include <string>
#include <vector>
#include <map>
Expand All @@ -30,9 +34,6 @@
#include <sdf/Noise.hh>
#include <sdf/Sensor.hh>

#include <gz/msgs/serialized.pb.h>
#include <gz/msgs/stringmsg.pb.h>

#include <gz/common/Console.hh>
#include <gz/common/Filesystem.hh>
#include <gz/sim/EntityComponentManager.hh>
Expand Down
12 changes: 11 additions & 1 deletion src/gui/plugins/component_inspector/ComponentInspector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
*
*/

#include "ComponentInspector.hh"

#include <gz/msgs/boolean.pb.h>
#include <gz/msgs/entity_plugin_v.pb.h>
#include <gz/msgs/light.pb.h>
#include <gz/msgs/physics.pb.h>
#include <gz/msgs/visual.pb.h>
#include <gz/msgs/spherical_coordinates.pb.h>
#include <gz/msgs/empty.pb.h>

#include <iostream>
#include <list>
#include <regex>
Expand All @@ -27,6 +37,7 @@
#include <gz/math/Color.hh>
#include <gz/math/SphericalCoordinates.hh>
#include <gz/math/Vector3.hh>

#include <gz/plugin/Register.hh>

#include "gz/sim/components/Actor.hh"
Expand Down Expand Up @@ -78,7 +89,6 @@
#include "gz/sim/EntityComponentManager.hh"
#include "gz/sim/gui/GuiEvents.hh"

#include "ComponentInspector.hh"
#include "Inertial.hh"
#include "Pose3d.hh"
#include "SystemPluginInfo.hh"
Expand Down
2 changes: 1 addition & 1 deletion src/gui/plugins/playback_scrubber/PlaybackScrubber.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "PlaybackScrubber.hh"

#include <gz/msgs/boolean.pb.h>
#include <gz/msgs/stringmsg.pb.h>
#include <gz/msgs/log_playback_control.pb.h>

#include <chrono>
#include <ctime>
Expand Down
7 changes: 5 additions & 2 deletions src/gui/plugins/visualize_contacts/VisualizeContacts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
*
*/

#include "VisualizeContacts.hh"

#include <gz/msgs/boolean.pb.h>
#include <gz/msgs/contact.pb.h>
#include <gz/msgs/contacts.pb.h>
#include <gz/msgs/entity.pb.h>
#include <gz/msgs/marker.pb.h>

#include <string>
#include <vector>
Expand Down Expand Up @@ -46,8 +51,6 @@
#include "gz/sim/gui/GuiEvents.hh"
#include "gz/sim/rendering/RenderUtil.hh"

#include "VisualizeContacts.hh"

namespace gz
{
namespace sim
Expand Down
13 changes: 0 additions & 13 deletions src/msgs/CMakeLists.txt

This file was deleted.

8 changes: 5 additions & 3 deletions src/network/NetworkManagerPrimary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

#include "NetworkManagerPrimary.hh"

#include <gz/msgs/world_stats.pb.h>
#include <gz/msgs/serialized_map.pb.h>
#include "gz/sim/private_msgs/peer_control.pb.h"
#include "gz/sim/private_msgs/simulation_step.pb.h"

#include <algorithm>
#include <future>
#include <set>
Expand All @@ -27,9 +32,6 @@
#include <gz/common/Util.hh>
#include <gz/common/Profiler.hh>

#include "msgs/peer_control.pb.h"
#include "msgs/simulation_step.pb.h"

#include "gz/sim/components/PerformerAffinity.hh"
#include "gz/sim/components/PerformerLevels.hh"
#include "gz/sim/Conversions.hh"
Expand Down
2 changes: 1 addition & 1 deletion src/network/NetworkManagerPrimary.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define GZ_SIM_NETWORK_NETWORKMANAGERPRIMARY_HH_

#include <gz/msgs/serialized_map.pb.h>
#include "gz/sim/private_msgs/simulation_step.pb.h"

#include <atomic>
#include <future>
Expand All @@ -31,7 +32,6 @@
#include <gz/sim/Entity.hh>
#include <gz/transport/Node.hh>

#include "msgs/simulation_step.pb.h"

#include "NetworkManager.hh"

Expand Down
6 changes: 4 additions & 2 deletions src/network/NetworkManagerSecondary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
*
*/

#include <gz/msgs/serialized_map.pb.h>
#include "gz/sim/private_msgs/peer_control.pb.h"
#include "gz/sim/private_msgs/simulation_step.pb.h"

#include <algorithm>
#include <string>

#include <gz/common/Console.hh>
#include <gz/common/Util.hh>
#include <gz/common/Profiler.hh>

#include "msgs/peer_control.pb.h"

#include "gz/sim/components/ParentEntity.hh"
#include "gz/sim/Conversions.hh"
#include "gz/sim/Entity.hh"
Expand Down
4 changes: 2 additions & 2 deletions src/network/NetworkManagerSecondary.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include <gz/sim/Export.hh>
#include <gz/transport/Node.hh>

#include "msgs/simulation_step.pb.h"
#include "msgs/peer_control.pb.h"
#include "gz/sim/private_msgs/simulation_step.pb.h"
#include "gz/sim/private_msgs/peer_control.pb.h"

#include "NetworkManager.hh"

Expand Down
2 changes: 1 addition & 1 deletion src/network/PeerInfo.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <gz/sim/Export.hh>

#include "NetworkRole.hh"
#include "msgs/peer_info.pb.h"
#include "gz/sim/private_msgs/peer_info.pb.h"

namespace gz
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ syntax = "proto3";
package gz.sim.private_msgs;

import "gz/msgs/world_stats.proto";
import "performer_affinity.proto";
import "gz/sim/private_msgs/performer_affinity.proto";

/// \brief Message to contain simulation step information for distributed
/// simulation.
Expand All @@ -33,5 +33,5 @@ message SimulationStep

/// \brief Updated performer affinities. It will be empty if there are no
/// affinity changes.
repeated PerformerAffinity affinity = 2;
repeated gz.sim.private_msgs.PerformerAffinity affinity = 2;
}
6 changes: 6 additions & 0 deletions src/systems/ackermann_steering/AckermannSteering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
#include "AckermannSteering.hh"

#include <gz/msgs/actuators.pb.h>
#include <gz/msgs/double.pb.h>
#include <gz/msgs/odometry.pb.h>
#include <gz/msgs/pose.pb.h>
#include <gz/msgs/pose_v.pb.h>
#include <gz/msgs/twist.pb.h>

#include <mutex>
#include <set>
Expand All @@ -30,6 +34,8 @@
#include <gz/math/Quaternion.hh>
#include <gz/math/Angle.hh>
#include <gz/math/SpeedLimiter.hh>


#include <gz/plugin/Register.hh>
#include <gz/transport/Node.hh>

Expand Down
5 changes: 5 additions & 0 deletions src/systems/camera_video_recorder/CameraVideoRecorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
*
*/

#include <gz/msgs/boolean.pb.h>
#include <gz/msgs/image.pb.h>
#include <gz/msgs/time.pb.h>
#include <gz/msgs/video_record.pb.h>

#include <regex>
#include <set>
#include <string>
Expand Down
5 changes: 5 additions & 0 deletions src/systems/diff_drive/DiffDrive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@

#include "DiffDrive.hh"

#include <gz/msgs/boolean.pb.h>
#include <gz/msgs/odometry.pb.h>
#include <gz/msgs/pose.pb.h>
#include <gz/msgs/pose_v.pb.h>
#include <gz/msgs/time.pb.h>
#include <gz/msgs/twist.pb.h>

#include <limits>
#include <mutex>
Expand Down
3 changes: 3 additions & 0 deletions src/systems/log_video_recorder/LogVideoRecorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@

#include "LogVideoRecorder.hh"

#include <gz/msgs/boolean.pb.h>
#include <gz/msgs/log_playback_control.pb.h>
#include <gz/msgs/scene.pb.h>
#include <gz/msgs/stringmsg.pb.h>
#include <gz/msgs/video_record.pb.h>

#include <chrono>
#include <set>
Expand Down
2 changes: 2 additions & 0 deletions src/systems/mecanum_drive/MecanumDrive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "MecanumDrive.hh"

#include <gz/msgs/odometry.pb.h>
#include <gz/msgs/pose_v.pb.h>
#include <gz/msgs/twist.pb.h>

#include <limits>
#include <mutex>
Expand Down
2 changes: 2 additions & 0 deletions src/systems/odometry_publisher/OdometryPublisher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

#include "OdometryPublisher.hh"

#include <gz/msgs/header.pb.h>
#include <gz/msgs/odometry.pb.h>
#include <gz/msgs/odometry_with_covariance.pb.h>
#include <gz/msgs/pose_v.pb.h>

#include <limits>
#include <string>
Expand Down
Loading

0 comments on commit 5846393

Please sign in to comment.