From 5f3ba37ba1883f42873659434bd832ade95e10aa Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Tue, 23 Apr 2024 03:19:34 +0000 Subject: [PATCH 01/10] Add bzlmod support for gz-math8 Signed-off-by: Michael Carroll --- .bazelrc | 12 + .bazelversion | 1 + .gitignore | 3 + BUILD.bazel | 1226 ++++++++++++++++++++++++++++++++++-- MODULE.bazel | 24 + WORKSPACE.bazel | 0 eigen3/BUILD.bazel | 49 +- examples/BUILD.bazel | 23 - include/gz/math/Matrix3.hh | 3 +- test/BUILD.bazel | 13 - 10 files changed, 1205 insertions(+), 149 deletions(-) create mode 100644 .bazelrc create mode 100644 .bazelversion create mode 100644 MODULE.bazel create mode 100644 WORKSPACE.bazel delete mode 100644 examples/BUILD.bazel diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 000000000..f2d06137d --- /dev/null +++ b/.bazelrc @@ -0,0 +1,12 @@ +common --enable_bzlmod +common --lockfile_mode=off + +# Add C++17 compiler flags. +build --cxxopt=-std=c++17 +build --host_cxxopt=-std=c++17 + +build --force_pic +build --strip=never +build --strict_system_includes +build --fission=dbg +build --features=per_object_debug_info diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 000000000..643916c03 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +7.3.1 diff --git a/.gitignore b/.gitignore index 5eca50293..e7f7852aa 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ build_* # Python generaated files *.pyc + +# Bazel generated files +bazel-* diff --git a/BUILD.bazel b/BUILD.bazel index 968198e92..6e03fe30b 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,25 +1,10 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "GZ_VISIBILITY", - "gz_configure_header", - "gz_export_header", - "gz_include_header", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) -load( - "@rules_license//rules:license.bzl", - "license", -) +load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header", "gz_export_header") +load("@rules_license//rules:license.bzl", "license") +load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test") package( - default_applicable_licenses = [GZ_ROOT + "math:license"], - default_visibility = GZ_VISIBILITY, - features = GZ_FEATURES, + default_applicable_licenses = [":license"], + default_visibility = ["//visibility:public"] ) license( @@ -29,75 +14,1188 @@ license( licenses(["notice"]) -exports_files(["LICENSE"]) +exports_files([ + "LICENSE", + "MODULE.bazel", +]) + +gz_export_header( + name = "Export", + out = "include/gz/math/Export.hh", + export_base = "GZ_MATH", + lib_name = "gz-math", +) gz_configure_header( name = "config", src = "include/gz/math/config.hh.in", - cmakelists = ["CMakeLists.txt"], - package = "math", + package_xml = "package.xml", ) -gz_export_header( - name = "include/gz/math/Export.hh", - export_base = "GZ_MATH", - lib_name = "gz-math", - visibility = ["//visibility:private"], +cc_library( + name = "AdditivelySeparableScalarField3", + hdrs = ["include/gz/math/AdditivelySeparableScalarField3.hh"], + includes = ["include"], + deps = [ + ":Region3", + ], ) -public_headers_no_gen = glob([ - "include/gz/math/*.hh", - "include/gz/math/detail/*.hh", - "include/gz/math/graph/*.hh", -]) +cc_test( + name = "AdditivelySeparableScalarField3_TEST", + srcs = ["src/AdditivelySeparableScalarField3_TEST.cc"], + deps = [ + ":AdditivelySeparableScalarField3", + ":Polynomial3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Angle", + srcs = ["src/Angle.cc"], + hdrs = ["include/gz/math/Angle.hh"], + includes = ["include"], + deps = [":Helpers"], +) + +cc_test( + name = "Angle_TEST", + srcs = ["src/Angle_TEST.cc"], + deps = [ + ":Angle", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "AxisAlignedBox", + srcs = ["src/AxisAlignedBox.cc"], + hdrs = ["include/gz/math/AxisAlignedBox.hh"], + includes = ["include"], + deps = [ + ":Helpers", + ":Line3", + ":MassMatrix3", + ":config", + ], +) + +cc_test( + name = "AxisAlignedBox_TEST", + srcs = ["src/AxisAlignedBox_TEST.cc"], + deps = [ + ":AxisAlignedBox", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Box", + hdrs = [ + "include/gz/math/Box.hh", + "include/gz/math/detail/Box.hh", + "include/gz/math/detail/WellOrderedVector.hh", + ], + includes = ["include"], + deps = [ + ":Line2", + ":MassMatrix3", + ":Plane", + ":Triangle3", + ":config", + ], +) + +cc_test( + name = "Box_TEST", + srcs = ["src/Box_TEST.cc"], + deps = [ + ":Box", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Capsule", + hdrs = [ + "include/gz/math/Capsule.hh", + "include/gz/math/detail/Capsule.hh", + ], + includes = ["include"], + deps = [ + ":Inertial", + ":MassMatrix3", + ], +) + +cc_test( + name = "Capsule_TEST", + srcs = ["src/Capsule_TEST.cc"], + deps = [ + ":Capsule", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Color", + srcs = ["src/Color.cc"], + hdrs = [ + "include/gz/math/Color.hh", + ], + includes = ["include"], + deps = [ + ":Helpers", + ":Vector3", + ], +) + +cc_test( + name = "Color_TEST", + srcs = ["src/Color_TEST.cc"], + deps = [ + ":Color", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Cone", + hdrs = [ + "include/gz/math/Cone.hh", + "include/gz/math/detail/Cone.hh", + ], + includes = ["include"], + deps = [ + ":MassMatrix3", + ], +) + +cc_test( + name = "Cone_TEST", + srcs = ["src/Cone_TEST.cc"], + deps = [ + ":Cone", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "CoordinateVector3", + srcs = ["src/CoordinateVector3.cc"], + hdrs = ["include/gz/math/CoordinateVector3.hh"], + includes = ["include"], + deps = [ + ":Angle", + ":Vector3", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "CoordinateVector3_TEST", + srcs = ["src/CoordinateVector3_TEST.cc"], + deps = [ + ":CoordinateVector3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Cylinder", + hdrs = [ + "include/gz/math/Cylinder.hh", + "include/gz/math/detail/Cylinder.hh", + ], + includes = ["include"], + deps = [ + ":MassMatrix3", + ], +) + +cc_test( + name = "Cylinder_TEST", + srcs = ["src/Cylinder_TEST.cc"], + deps = [ + ":Cylinder", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "DiffDriveOdometry", + srcs = ["src/DiffDriveOdometry.cc"], + hdrs = [ + "include/gz/math/DiffDriveOdometry.hh", + ], + includes = ["include"], + deps = [ + ":Angle", + ":RollingMean", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "DiffDriveOdometry_TEST", + srcs = ["src/DiffDriveOdometry_TEST.cc"], + deps = [ + ":DiffDriveOdometry", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Ellipsoid", + hdrs = [ + "include/gz/math/Ellipsoid.hh", + "include/gz/math/detail/Ellipsoid.hh", + ], + includes = ["include"], + deps = [ + ":Inertial", + ":MassMatrix3", + ], +) + +cc_test( + name = "Ellipsoid_TEST", + srcs = ["src/Ellipsoid_TEST.cc"], + deps = [ + ":Ellipsoid", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Filter", + hdrs = ["include/gz/math/Filter.hh"], + includes = ["include"], + deps = [ + ":Helpers", + ":Quaternion", + ":Vector3", + ], +) + +cc_test( + name = "Filter_TEST", + srcs = ["src/Filter_TEST.cc"], + deps = [ + ":Filter", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Frustum", + srcs = ["src/Frustum.cc"], + hdrs = ["include/gz/math/Frustum.hh"], + includes = ["include"], + deps = [ + ":Angle", + ":AxisAlignedBox", + ":Matrix4", + ":Plane", + ":Pose3", + ], +) + +cc_test( + name = "Frustum_TEST", + srcs = ["src/Frustum_TEST.cc"], + deps = [ + ":Frustum", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "GaussMarkovProcess", + srcs = ["src/GaussMarkovProcess.cc"], + hdrs = ["include/gz/math/GaussMarkovProcess.hh"], + includes = ["include"], + deps = [ + ":Export", + ":Rand", + ":config", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "GaussMarkovProcess_TEST", + srcs = ["src/GaussMarkovProcess_TEST.cc"], + deps = [ + ":GaussMarkovProcess", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Helpers", + srcs = ["src/Helpers.cc"], + hdrs = ["include/gz/math/Helpers.hh"], + includes = ["include"], + deps = [ + ":Export", + ":config", + "@gz-utils//:NeverDestroyed", + ], +) + +cc_test( + name = "Helpers_TEST", + srcs = ["src/Helpers_TEST.cc"], + deps = [ + ":Helpers", + ":Rand", + ":Vector3", + "@googletest//:gtest_main", + "@gz-utils//:SuppressWarning", + ], +) + +cc_library( + name = "Inertial", + hdrs = ["include/gz/math/Inertial.hh"], + includes = ["include"], + deps = [ + ":MassMatrix3", + ":Matrix6", + ":Pose3", + ":config", + ], +) + +cc_test( + name = "Inertial_TEST", + srcs = ["src/Inertial_TEST.cc"], + deps = [ + ":Inertial", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "InterpolationPoint", + hdrs = [ + "include/gz/math/detail/AxisIndex.hh", + "include/gz/math/detail/InterpolationPoint.hh", + ], + includes = ["include"], + deps = [ + ":Vector2", + ":Vector3", + ], +) + +cc_test( + name = "InterpolationPoint_TEST", + srcs = ["src/InterpolationPoint_TEST.cc"], + deps = [ + ":InterpolationPoint", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Interval", + hdrs = ["include/gz/math/Interval.hh"], + includes = ["include"], + deps = [ + ":config", + ], +) -private_headers = glob(["src/*.hh"]) +cc_test( + name = "Interval_TEST", + srcs = ["src/Interval_TEST.cc"], + deps = [ + ":Interval", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Kmeans", + srcs = [ + "src/Kmeans.cc", + "src/KmeansPrivate.hh", + ], + hdrs = ["include/gz/math/Kmeans.hh"], + includes = ["include"], + deps = [ + ":Rand", + ":Vector3", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "Kmeans_TEST", + srcs = ["src/Kmeans_TEST.cc"], + deps = [ + ":Kmeans", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Line2", + hdrs = ["include/gz/math/Line2.hh"], + includes = ["include"], + deps = [ + ":Vector2", + ], +) + +cc_test( + name = "Line2_TEST", + srcs = ["src/Line2_TEST.cc"], + deps = [ + ":Line2", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Line3", + hdrs = ["include/gz/math/Line3.hh"], + includes = ["include"], + deps = [ + ":Vector3", + ], +) + +cc_test( + name = "Line3_TEST", + srcs = ["src/Line3_TEST.cc"], + deps = [ + ":Line3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "MassMatrix3", + hdrs = ["include/gz/math/MassMatrix3.hh"], + includes = ["include"], + deps = [ + ":Material", + ":Quaternion", + ":Vector2", + ], +) + +cc_test( + name = "MassMatrix3_TEST", + srcs = ["src/MassMatrix3_TEST.cc"], + deps = [ + ":MassMatrix3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "MaterialType", + hdrs = ["include/gz/math/MaterialType.hh"], + includes = ["include"], +) -sources = glob( - ["src/*.cc"], - exclude = ["src/*_TEST.cc"], +cc_library( + name = "Material", + srcs = [ + "src/Material.cc", + "src/MaterialType.hh", + ], + hdrs = ["include/gz/math/Material.hh"], + includes = ["include"], + deps = [ + ":Export", + ":Helpers", + ":MaterialType", + ":config", + "@gz-utils//:ImplPtr", + ], ) -gz_include_header( - name = "mathhh_genrule", - out = "include/gz/math.hh", - hdrs = public_headers_no_gen + [ - "include/gz/math/config.hh", - "include/gz/math/Export.hh", +cc_library( + name = "Matrix3", + hdrs = ["include/gz/math/Matrix3.hh"], + includes = ["include"], + deps = [ + ":Vector3", ], ) -public_headers = public_headers_no_gen + [ - "include/gz/math/config.hh", - "include/gz/math/Export.hh", - "include/gz/math.hh", -] +cc_test( + name = "Matrix3_TEST", + srcs = ["src/Matrix3_TEST.cc"], + deps = [ + ":Helpers", + ":Matrix3", + ":Quaternion", + "@googletest//:gtest_main", + ], +) cc_library( - name = "math", - srcs = sources + private_headers, - hdrs = public_headers, + name = "Matrix4", + hdrs = ["include/gz/math/Matrix4.hh"], includes = ["include"], deps = [ - GZ_ROOT + "utils", + ":Matrix3", + ":Pose3", + ":Quaternion", + ":Vector3", ], ) -test_sources = glob( - [ - "src/*_TEST.cc", - "src/graph/*_TEST.cc", +cc_test( + name = "Matrix4_TEST", + srcs = ["src/Matrix4_TEST.cc"], + deps = [ + ":Matrix4", + "@googletest//:gtest_main", ], ) -[cc_test( - name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), - srcs = [src], +cc_library( + name = "Matrix6", + hdrs = ["include/gz/math/Matrix6.hh"], + includes = ["include"], deps = [ - ":math", - "@gtest", - "@gtest//:gtest_main", + ":Matrix3", + ":Vector3", ], -) for src in test_sources] +) + +cc_test( + name = "Matrix6_TEST", + srcs = ["src/Matrix6_TEST.cc"], + deps = [ + ":Helpers", + ":Matrix6", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "MecanumDriveOdometry", + srcs = ["src/MecanumDriveOdometry.cc"], + hdrs = ["include/gz/math/MecanumDriveOdometry.hh"], + includes = ["include"], + deps = [ + ":Angle", + ":RollingMean", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "MecanumDriveOdometry_TEST", + srcs = ["src/MecanumDriveOdometry_TEST.cc"], + deps = [ + ":MecanumDriveOdometry", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "MovingWindowFilter", + hdrs = ["include/gz/math/MovingWindowFilter.hh"], + includes = ["include"], + deps = [ + "@gz-utils//:SuppressWarning", + ], +) + +cc_test( + name = "MovingWindowFilter_TEST", + srcs = ["src/MovingWindowFilter_TEST.cc"], + deps = [ + ":MovingWindowFilter", + ":Vector3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "OrientedBox", + hdrs = ["include/gz/math/OrientedBox.hh"], + includes = ["include"], + deps = [ + ":MassMatrix3", + ":Matrix4", + ], +) + +cc_test( + name = "OrientedBox_TEST", + srcs = ["src/OrientedBox_TEST.cc"], + deps = [ + ":Angle", + ":OrientedBox", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "PID", + srcs = ["src/PID.cc"], + hdrs = ["include/gz/math/PID.hh"], + includes = ["include"], + deps = [ + ":Helpers", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "PID_TEST", + srcs = ["src/PID_TEST.cc"], + deps = [ + ":Angle", + ":PID", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "PiecewiseScalarField3", + hdrs = ["include/gz/math/PiecewiseScalarField3.hh"], + includes = ["include"], +) + +cc_test( + name = "PiecewiseScalarField3_TEST", + srcs = ["src/PiecewiseScalarField3_TEST.cc"], + deps = [ + ":AdditivelySeparableScalarField3", + ":PiecewiseScalarField3", + ":Polynomial3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Plane", + hdrs = ["include/gz/math/Plane.hh"], + includes = ["include"], + deps = [ + ":AxisAlignedBox", + ":Line2", + ], +) + +cc_test( + name = "Plane_TEST", + srcs = ["src/Plane_TEST.cc"], + deps = [ + ":Helpers", + ":Plane", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Polynomial3", + hdrs = ["include/gz/math/Polynomial3.hh"], + includes = ["include"], + deps = [ + ":Interval", + ":Vector4", + ], +) + +cc_test( + name = "Polynomial3_TEST", + srcs = ["src/Polynomial3_TEST.cc"], + deps = [ + ":Polynomial3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Pose3", + hdrs = ["include/gz/math/Pose3.hh"], + includes = ["include"], + deps = [":Quaternion"], +) + +cc_test( + name = "Pose_TEST", + srcs = ["src/Pose_TEST.cc"], + deps = [ + ":Helpers", + ":Pose3", + "@googletest//:gtest_main", + "@gz-utils//:SuppressWarning", + ], +) + +cc_library( + name = "Quaternion", + hdrs = ["include/gz/math/Quaternion.hh"], + includes = ["include"], + deps = [ + ":Angle", + ":Matrix3", + ":Vector3", + ], +) + +cc_test( + name = "Quaternion_TEST", + srcs = ["src/Quaternion_TEST.cc"], + deps = [ + ":Helpers", + ":Matrix4", + ":Quaternion", + "@googletest//:gtest_main", + "@gz-utils//:SuppressWarning", + ], +) + +cc_library( + name = "Rand", + srcs = ["src/Rand.cc"], + hdrs = ["include/gz/math/Rand.hh"], + includes = ["include"], + deps = [":Helpers"], +) + +cc_test( + name = "Rand_TEST", + srcs = ["src/Rand_TEST.cc"], + deps = [ + ":Rand", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Region3", + hdrs = ["include/gz/math/Region3.hh"], + includes = ["include"], + deps = [ + ":Interval", + ":Vector3", + ], +) + +cc_test( + name = "Region3_TEST", + srcs = ["src/Region3_TEST.cc"], + deps = [ + ":Region3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "RollingMean", + srcs = ["src/RollingMean.cc"], + hdrs = ["include/gz/math/RollingMean.hh"], + includes = ["include"], + deps = [ + ":Export", + ":config", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "RollingMean_TEST", + srcs = ["src/RollingMean_TEST.cc"], + deps = [ + ":Helpers", + ":RollingMean", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "RotationSpline", + srcs = ["src/RotationSpline.cc"], + hdrs = ["include/gz/math/RotationSpline.hh"], + includes = ["include"], + deps = [ + ":Quaternion", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "RotationSpline_TEST", + srcs = ["src/RotationSpline_TEST.cc"], + deps = [ + ":RotationSpline", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "SemanticVersion", + srcs = ["src/SemanticVersion.cc"], + hdrs = ["include/gz/math/SemanticVersion.hh"], + includes = ["include"], + deps = [ + ":Helpers", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "SemanticVersion_TEST", + srcs = ["src/SemanticVersion_TEST.cc"], + deps = [ + ":SemanticVersion", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "SignalStats", + srcs = ["src/SignalStats.cc"], + hdrs = ["include/gz/math/SignalStats.hh"], + includes = ["include"], + deps = [ + ":Helpers", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "SignalStats_TEST", + srcs = ["src/SignalStats_TEST.cc"], + deps = [ + ":Rand", + ":SignalStats", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "SpeedLimiter", + srcs = ["src/SpeedLimiter.cc"], + hdrs = ["include/gz/math/SpeedLimiter.hh"], + includes = ["include"], + deps = [ + ":Helpers", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "SpeedLimiter_TEST", + srcs = ["src/SpeedLimiter_TEST.cc"], + deps = [ + ":SpeedLimiter", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Sphere", + hdrs = [ + "include/gz/math/Sphere.hh", + "include/gz/math/detail/Sphere.hh", + ], + includes = ["include"], + deps = [ + ":MassMatrix3", + ":Plane", + ], +) + +cc_test( + name = "Sphere_TEST", + srcs = ["src/Sphere_TEST.cc"], + deps = [ + ":Sphere", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "SphericalCoordinates", + srcs = ["src/SphericalCoordinates.cc"], + hdrs = ["include/gz/math/SphericalCoordinates.hh"], + includes = ["include"], + deps = [ + ":Angle", + ":CoordinateVector3", + ":Helpers", + ":Matrix3", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "SphericalCoordinates_TEST", + srcs = ["src/SphericalCoordinates_TEST.cc"], + deps = [ + ":SphericalCoordinates", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Spline", + srcs = [ + "src/Spline.cc", + "src/SplinePrivate.cc", + "src/SplinePrivate.hh", + ], + hdrs = ["include/gz/math/Spline.hh"], + includes = ["include"], + deps = [ + ":Matrix4", + ":Vector4", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "Spline_TEST", + srcs = ["src/Spline_TEST.cc"], + deps = [ + ":Spline", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Stopwatch", + srcs = [ + "src/Stopwatch.cc", + ], + hdrs = ["include/gz/math/Stopwatch.hh"], + includes = ["include"], + deps = [ + ":Export", + ":config", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "Stopwatch_TEST", + srcs = ["src/Stopwatch_TEST.cc"], + deps = [ + ":Stopwatch", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Temperature", + srcs = [ + "src/Temperature.cc", + ], + hdrs = ["include/gz/math/Temperature.hh"], + includes = ["include"], + deps = [ + ":Export", + ":Helpers", + ":config", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "Temperature_TEST", + srcs = ["src/Temperature_TEST.cc"], + deps = [ + ":Temperature", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "TimeVaryingVolumetricGrid", + hdrs = ["include/gz/math/TimeVaryingVolumetricGrid.hh"], + includes = ["include"], + deps = [ + ":TimeVaryingVolumetricGridLookupField", + ], +) + +cc_test( + name = "TimeVaryingVolumetricGrid_TEST", + srcs = ["src/TimeVaryingVolumetricGrid_TEST.cc"], + deps = [ + ":TimeVaryingVolumetricGrid", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "TimeVaryingVolumetricGridLookupField", + hdrs = ["include/gz/math/TimeVaryingVolumetricGridLookupField.hh"], + includes = ["include"], + deps = [ + ":VolumetricGridLookupField", + ], +) + +cc_test( + name = "TimeVaryingVolumetricGridLookupField_TEST", + srcs = ["src/TimeVaryingVolumetricGridLookupField_TEST.cc"], + deps = [ + ":TimeVaryingVolumetricGridLookupField", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Triangle", + hdrs = ["include/gz/math/Triangle.hh"], + includes = ["include"], + deps = [ + ":Helpers", + ":Line2", + ], +) + +cc_test( + name = "Triangle_TEST", + srcs = ["src/Triangle_TEST.cc"], + deps = [ + ":Triangle", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Triangle3", + hdrs = ["include/gz/math/Triangle3.hh"], + includes = ["include"], + deps = [ + ":Helpers", + ":Line3", + ":Plane", + ], +) + +cc_test( + name = "Triangle3_TEST", + srcs = ["src/Triangle3_TEST.cc"], + deps = [ + ":Triangle3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Vector2", + hdrs = ["include/gz/math/Vector2.hh"], + includes = ["include"], + deps = [":Helpers"], +) + +cc_test( + name = "Vector2_TEST", + srcs = ["src/Vector2_TEST.cc"], + deps = [ + ":Helpers", + ":Vector2", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Vector3", + hdrs = ["include/gz/math/Vector3.hh"], + includes = ["include"], + deps = [":Helpers"], +) + +cc_test( + name = "Vector3_TEST", + srcs = ["src/Vector3_TEST.cc"], + deps = [ + ":Vector3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Vector3Stats", + srcs = ["src/Vector3Stats.cc"], + hdrs = ["include/gz/math/Vector3Stats.hh"], + includes = ["include"], + deps = [ + ":Helpers", + ":SignalStats", + ":Vector3", + ], +) + +cc_test( + name = "Vector3Stats_TEST", + srcs = ["src/Vector3Stats_TEST.cc"], + deps = [ + ":Vector3Stats", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Vector4", + hdrs = ["include/gz/math/Vector4.hh"], + includes = ["include"], + deps = [ + ":Matrix4", + ], +) + +cc_test( + name = "Vector4_TEST", + srcs = ["src/Vector4_TEST.cc"], + deps = [ + ":Helpers", + ":Vector4", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "VolumetricGridLookupField", + hdrs = ["include/gz/math/VolumetricGridLookupField.hh"], + includes = ["include"], + deps = [ + ":InterpolationPoint", + ":Vector3", + ], +) + +cc_test( + name = "VolumetricGridLookupField_TEST", + srcs = ["src/VolumetricGridLookupField_TEST.cc"], + deps = [ + ":VolumetricGridLookupField", + "@googletest//:gtest_main", + ], +) + +buildifier( + name = "buildifier.fix", + exclude_patterns = ["./.git/*"], + lint_mode = "fix", + mode = "fix", +) + +buildifier_test( + name = "buildifier.test", + exclude_patterns = ["./.git/*"], + lint_mode = "warn", + mode = "diff", + no_sandbox = True, + workspace = "//:MODULE.bazel", +) -add_lint_tests() diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 000000000..f6ef7f6a4 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,24 @@ +## MODULE.bazel +module( + name = "gz-math", + repo_name = "org_gazebosim_gz-math", +) + +bazel_dep(name = "buildifier_prebuilt", version = "6.1.2") +bazel_dep(name = "googletest", version = "1.14.0") +bazel_dep(name = "rules_license", version = "0.0.8") +bazel_dep(name = "eigen", version = "3.4.0") + +# Gazebo Dependencies +bazel_dep(name = "rules_gazebo") +bazel_dep(name = "gz-utils") + +local_path_override( + module_name = "rules_gazebo", + path = "/usr/local/google/home/mjcarroll/workspaces/gz_ionic_bazel/rules_gazebo", +) + +local_path_override( + module_name = "gz-utils", + path = "/usr/local/google/home/mjcarroll/workspaces/gz_ionic_bazel/gz-utils", +) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel new file mode 100644 index 000000000..e69de29bb diff --git a/eigen3/BUILD.bazel b/eigen3/BUILD.bazel index 4107f59b8..17b531532 100644 --- a/eigen3/BUILD.bazel +++ b/eigen3/BUILD.bazel @@ -1,48 +1,3 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_ROOT", - "GZ_VISIBILITY", - "gz_include_header", +package( + default_applicable_licenses = ["//:license"], ) - -package(default_applicable_licenses = [GZ_ROOT + "math:license"]) - -public_headers = glob([ - "include/gz/math/eigen3/*.hh", -]) - -gz_include_header( - name = "eigen3_hh_genrule", - out = "include/gz/math/eigen3.hh", - hdrs = public_headers, -) - -cc_library( - name = "eigen3", - srcs = public_headers, - hdrs = public_headers + [ - "include/gz/math/eigen3.hh", - ], - includes = ["include"], - visibility = GZ_VISIBILITY, - deps = [ - GZ_ROOT + "math", - "@eigen3", - ], -) - -test_sources = glob( - [ - "src/*_TEST.cc", - ], -) - -[cc_test( - name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), - srcs = [src], - deps = [ - ":eigen3", - "@gtest", - "@gtest//:gtest_main", - ], -) for src in test_sources] diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel deleted file mode 100644 index c3902e6a3..000000000 --- a/examples/BUILD.bazel +++ /dev/null @@ -1,23 +0,0 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_ROOT", - "GZ_VISIBILITY", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) - -sources = glob( - ["*.cc"], -) - -[cc_binary( - name = src.replace(".cc", ""), - srcs = [src], - deps = [ - GZ_ROOT + "math", - ], -) for src in sources] - -add_lint_tests() diff --git a/include/gz/math/Matrix3.hh b/include/gz/math/Matrix3.hh index 3f27b072b..e257f20a2 100644 --- a/include/gz/math/Matrix3.hh +++ b/include/gz/math/Matrix3.hh @@ -21,9 +21,8 @@ #include #include #include -#include -#include #include +#include namespace gz::math { diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 9000f4abc..e69de29bb 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -1,13 +0,0 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_VISIBILITY", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) - -# Currently test directory only applies to CMake builds - -add_lint_tests() From 0a73f01c65b483c73aa44682eb9459bae8c99412 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Wed, 16 Oct 2024 15:47:27 +0000 Subject: [PATCH 02/10] Use upstream gz-utils Signed-off-by: Michael Carroll --- BUILD.bazel | 5 ++--- MODULE.bazel | 17 ++++++----------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 6e03fe30b..c57bfb055 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,10 +1,10 @@ +load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test") load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header", "gz_export_header") load("@rules_license//rules:license.bzl", "license") -load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test") package( default_applicable_licenses = [":license"], - default_visibility = ["//visibility:public"] + default_visibility = ["//visibility:public"], ) license( @@ -1198,4 +1198,3 @@ buildifier_test( no_sandbox = True, workspace = "//:MODULE.bazel", ) - diff --git a/MODULE.bazel b/MODULE.bazel index f6ef7f6a4..239703093 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,21 +4,16 @@ module( repo_name = "org_gazebosim_gz-math", ) -bazel_dep(name = "buildifier_prebuilt", version = "6.1.2") +bazel_dep(name = "buildifier_prebuilt", version = "7.3.1") bazel_dep(name = "googletest", version = "1.14.0") -bazel_dep(name = "rules_license", version = "0.0.8") +bazel_dep(name = "rules_license", version = "1.0.0") bazel_dep(name = "eigen", version = "3.4.0") # Gazebo Dependencies -bazel_dep(name = "rules_gazebo") +bazel_dep(name = "rules_gazebo", version = "0.0.2") bazel_dep(name = "gz-utils") - -local_path_override( - module_name = "rules_gazebo", - path = "/usr/local/google/home/mjcarroll/workspaces/gz_ionic_bazel/rules_gazebo", -) - -local_path_override( +archive_override( module_name = "gz-utils", - path = "/usr/local/google/home/mjcarroll/workspaces/gz_ionic_bazel/gz-utils", + strip_prefix = "gz-utils-gz-utils3", + urls = ["https://github.com/gazebosim/gz-utils/archive/refs/heads/gz-utils3.tar.gz"], ) From bc8ac137b170a46f7fbdd37e8d0048b58dcc7cc9 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Wed, 16 Oct 2024 15:59:39 +0000 Subject: [PATCH 03/10] Add eigen3 targets Signed-off-by: Michael Carroll --- eigen3/BUILD.bazel | 56 ++++++++++++++++++++++++++++++++++++++++++++++ test/BUILD.bazel | 0 2 files changed, 56 insertions(+) delete mode 100644 test/BUILD.bazel diff --git a/eigen3/BUILD.bazel b/eigen3/BUILD.bazel index 17b531532..6f2ce0f16 100644 --- a/eigen3/BUILD.bazel +++ b/eigen3/BUILD.bazel @@ -1,3 +1,59 @@ +load("@rules_license//rules:license.bzl", "license") + package( default_applicable_licenses = ["//:license"], ) + +license( + name = "license", + package_name = "gz-math-eigen3", +) + +cc_library( + name = "Conversions", + hdrs = ["include/gz/math/eigen3/Conversions.hh"], + includes = ["include"], + deps = [ + "//:AxisAlignedBox", + "//:Matrix3", + "//:Matrix6", + "//:Pose3", + "//:Quaternion", + "//:Vector3", + "@eigen", + ], +) + +cc_test( + name = "Conversions_TEST", + srcs = ["src/Conversions_TEST.cc"], + deps = [ + ":Conversions", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Util", + hdrs = ["include/gz/math/eigen3/Util.hh"], + includes = ["include"], + deps = [ + ":Conversions", + "//:AxisAlignedBox", + "//:Matrix3", + "//:OrientedBox", + "//:Pose3", + "//:Quaternion", + "//:Vector3", + "@eigen", + ], +) + +cc_test( + name = "Util_TEST", + srcs = ["src/Util_TEST.cc"], + deps = [ + ":Util", + "@googletest//:gtest_main", + ], +) diff --git a/test/BUILD.bazel b/test/BUILD.bazel deleted file mode 100644 index e69de29bb..000000000 From 0c4a47b23f14ffda6af8989eda8589129ea389de Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Wed, 16 Oct 2024 16:18:12 +0000 Subject: [PATCH 04/10] Add examples and graph Signed-off-by: Michael Carroll --- BUILD.bazel | 80 +++++++++++++++++ examples/BUILD.bazel | 162 +++++++++++++++++++++++++++++++++++ examples/graph_example.cc | 3 +- examples/triangle_example.cc | 3 +- examples/vector2_example.cc | 2 +- 5 files changed, 247 insertions(+), 3 deletions(-) create mode 100644 examples/BUILD.bazel diff --git a/BUILD.bazel b/BUILD.bazel index c57bfb055..beebc9333 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -333,6 +333,86 @@ cc_test( ], ) +cc_library( + name = "Graph", + hdrs = [ + "include/gz/math/graph/Edge.hh", + "include/gz/math/graph/Graph.hh", + "include/gz/math/graph/Vertex.hh", + ], + includes = ["include"], + deps = [ + ":Helpers", + ":config", + ], +) + +cc_test( + name = "Edge_TEST", + srcs = ["src/graph/Edge_TEST.cc"], + deps = [ + ":Graph", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Graph_TEST", + srcs = ["src/graph/Graph_TEST.cc"], + deps = [ + ":Graph", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "GraphAlgorithms_TEST", + srcs = ["src/graph/GraphAlgorithms_TEST.cc"], + deps = [ + ":GraphAlgorithms", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "GraphDirected_TEST", + srcs = ["src/graph/GraphDirected_TEST.cc"], + deps = [ + ":Graph", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "GraphUndirected_TEST", + srcs = ["src/graph/GraphUndirected_TEST.cc"], + deps = [ + ":Graph", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Vertex_TEST", + srcs = ["src/graph/Vertex_TEST.cc"], + deps = [ + ":Graph", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "GraphAlgorithms", + hdrs = [ + "include/gz/math/graph/GraphAlgorithms.hh", + ], + includes = ["include"], + deps = [ + ":Graph", + ":config", + ], +) + cc_library( name = "Helpers", srcs = ["src/Helpers.cc"], diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel new file mode 100644 index 000000000..90332a71d --- /dev/null +++ b/examples/BUILD.bazel @@ -0,0 +1,162 @@ +load("@rules_license//rules:license.bzl", "license") + +package( + default_applicable_licenses = ["//:license"], +) + +license( + name = "license", + package_name = "gz-math-examples", +) + +cc_binary( + name = "additively_separable_scalar_field3", + srcs = ["additively_separable_scalar_field3_example.cc"], + deps = [ + "//:AdditivelySeparableScalarField3", + "//:Polynomial3", + ], +) + +cc_binary( + name = "angle", + srcs = ["angle_example.cc"], + deps = [ + "//:Angle", + ], +) + +cc_binary( + name = "box", + srcs = ["box_example.cc"], + deps = [ + "//:Box", + ], +) + +cc_binary( + name = "color", + srcs = ["color_example.cc"], + deps = [ + "//:Color", + ], +) + +cc_binary( + name = "diff_drive", + srcs = ["diff_drive_odometry.cc"], + deps = [ + "//:DiffDriveOdometry", + ], +) + +cc_binary( + name = "gauss_markov_process", + srcs = ["gauss_markov_process_example.cc"], + deps = [ + "//:GaussMarkovProcess", + ], +) + +cc_binary( + name = "graph", + srcs = ["graph_example.cc"], + deps = ["//:Graph"], +) + +cc_binary( + name = "helpers", + srcs = ["helpers_example.cc"], + deps = [ + "//:Helpers", + "//:Quaternion", + ], +) + +cc_binary( + name = "interval", + srcs = ["interval_example.cc"], + deps = ["//:Interval"], +) + +cc_binary( + name = "kmeans", + srcs = ["kmeans.cc"], + deps = ["//:Kmeans"], +) + +cc_binary( + name = "matrix3", + srcs = ["matrix3_example.cc"], + deps = ["//:Matrix3"], +) + +cc_binary( + name = "piecewise_scalar_field3", + srcs = ["piecewise_scalar_field3_example.cc"], + deps = [ + "//:AdditivelySeparableScalarField3", + "//:PiecewiseScalarField3", + "//:Polynomial3", + ], +) + +cc_binary( + name = "polynomial3", + srcs = ["polynomial3_example.cc"], + deps = ["//:Polynomial3"], +) + +cc_binary( + name = "pose3", + srcs = ["pose3_example.cc"], + deps = ["//:Pose3"], +) + +cc_binary( + name = "quaternion", + srcs = ["quaternion_example.cc"], + deps = ["//:Quaternion"], +) + +cc_binary( + name = "quaternion_from_euler", + srcs = ["quaternion_from_euler.cc"], + deps = ["//:Quaternion"], +) + +cc_binary( + name = "quaternion_to_euler", + srcs = ["quaternion_to_euler.cc"], + deps = ["//:Quaternion"], +) + +cc_binary( + name = "rand", + srcs = ["rand_example.cc"], + deps = ["//:Rand"], +) + +cc_binary( + name = "region3", + srcs = ["region3_example.cc"], + deps = ["//:Region3"], +) + +cc_binary( + name = "temperature", + srcs = ["temperature_example.cc"], + deps = ["//:Temperature"], +) + +cc_binary( + name = "triangle", + srcs = ["triangle_example.cc"], + deps = ["//:Triangle"], +) + +cc_binary( + name = "vector2", + srcs = ["vector2_example.cc"], + deps = ["//:Vector2"], +) diff --git a/examples/graph_example.cc b/examples/graph_example.cc index 6552ecc0c..b96f00a71 100644 --- a/examples/graph_example.cc +++ b/examples/graph_example.cc @@ -16,7 +16,8 @@ */ #include -#include + +#include int main(int argc, char **argv) { diff --git a/examples/triangle_example.cc b/examples/triangle_example.cc index d59948e0d..cebc725ba 100644 --- a/examples/triangle_example.cc +++ b/examples/triangle_example.cc @@ -16,7 +16,8 @@ */ #include -#include + +#include int main(int argc, char **argv) { diff --git a/examples/vector2_example.cc b/examples/vector2_example.cc index e6f9df1d1..17413d618 100644 --- a/examples/vector2_example.cc +++ b/examples/vector2_example.cc @@ -16,7 +16,7 @@ */ //! [complete] #include -#include +#include int main(int argc, char **argv) { From 324d5114ad2f22ba955f99269c29de8883a47fc7 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Wed, 16 Oct 2024 16:25:17 +0000 Subject: [PATCH 05/10] Add missing Quaternion header Signed-off-by: Michael Carroll --- src/python_pybind11/src/Matrix3.hh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/python_pybind11/src/Matrix3.hh b/src/python_pybind11/src/Matrix3.hh index fd8c4193d..4ab6acd2a 100644 --- a/src/python_pybind11/src/Matrix3.hh +++ b/src/python_pybind11/src/Matrix3.hh @@ -25,6 +25,7 @@ #include #include +#include namespace py = pybind11; using namespace pybind11::literals; From 7ad2223813510fd40790ea0dc9b2e59b400b87b2 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Thu, 17 Oct 2024 15:44:06 +0000 Subject: [PATCH 06/10] config -> Config Signed-off-by: Michael Carroll --- BUILD.bazel | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index beebc9333..bd4878650 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -27,7 +27,7 @@ gz_export_header( ) gz_configure_header( - name = "config", + name = "Config", src = "include/gz/math/config.hh.in", package_xml = "package.xml", ) @@ -74,10 +74,10 @@ cc_library( hdrs = ["include/gz/math/AxisAlignedBox.hh"], includes = ["include"], deps = [ + ":Config", ":Helpers", ":Line3", ":MassMatrix3", - ":config", ], ) @@ -99,11 +99,11 @@ cc_library( ], includes = ["include"], deps = [ + ":Config", ":Line2", ":MassMatrix3", ":Plane", ":Triangle3", - ":config", ], ) @@ -317,9 +317,9 @@ cc_library( hdrs = ["include/gz/math/GaussMarkovProcess.hh"], includes = ["include"], deps = [ + ":Config", ":Export", ":Rand", - ":config", "@gz-utils//:ImplPtr", ], ) @@ -342,8 +342,8 @@ cc_library( ], includes = ["include"], deps = [ + ":Config", ":Helpers", - ":config", ], ) @@ -408,8 +408,8 @@ cc_library( ], includes = ["include"], deps = [ + ":Config", ":Graph", - ":config", ], ) @@ -419,8 +419,8 @@ cc_library( hdrs = ["include/gz/math/Helpers.hh"], includes = ["include"], deps = [ + ":Config", ":Export", - ":config", "@gz-utils//:NeverDestroyed", ], ) @@ -442,10 +442,10 @@ cc_library( hdrs = ["include/gz/math/Inertial.hh"], includes = ["include"], deps = [ + ":Config", ":MassMatrix3", ":Matrix6", ":Pose3", - ":config", ], ) @@ -485,7 +485,7 @@ cc_library( hdrs = ["include/gz/math/Interval.hh"], includes = ["include"], deps = [ - ":config", + ":Config", ], ) @@ -593,10 +593,10 @@ cc_library( hdrs = ["include/gz/math/Material.hh"], includes = ["include"], deps = [ + ":Config", ":Export", ":Helpers", ":MaterialType", - ":config", "@gz-utils//:ImplPtr", ], ) @@ -882,8 +882,8 @@ cc_library( hdrs = ["include/gz/math/RollingMean.hh"], includes = ["include"], deps = [ + ":Config", ":Export", - ":config", "@gz-utils//:ImplPtr", ], ) @@ -1057,8 +1057,8 @@ cc_library( hdrs = ["include/gz/math/Stopwatch.hh"], includes = ["include"], deps = [ + ":Config", ":Export", - ":config", "@gz-utils//:ImplPtr", ], ) @@ -1080,9 +1080,9 @@ cc_library( hdrs = ["include/gz/math/Temperature.hh"], includes = ["include"], deps = [ + ":Config", ":Export", ":Helpers", - ":config", "@gz-utils//:ImplPtr", ], ) From f6e7d4af016b6cebbba958f9b27ff64da9d11795 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Thu, 17 Oct 2024 15:46:18 +0000 Subject: [PATCH 07/10] Enable layering_check Signed-off-by: Michael Carroll --- BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.bazel b/BUILD.bazel index bd4878650..f3fb8ad93 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -5,6 +5,7 @@ load("@rules_license//rules:license.bzl", "license") package( default_applicable_licenses = [":license"], default_visibility = ["//visibility:public"], + features = ["layering_check"], ) license( From b07680532284f54f5fd3c8f180e5eec47ff58135 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Wed, 16 Oct 2024 15:51:10 +0000 Subject: [PATCH 08/10] Add CI for bzlmod Signed-off-by: Michael Carroll --- .github/workflows/bazel.yml | 24 ++++++++++++++++++++++++ .github/workflows/ci.bazelrc | 15 +++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .github/workflows/bazel.yml create mode 100644 .github/workflows/ci.bazelrc diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml new file mode 100644 index 000000000..f45108d18 --- /dev/null +++ b/.github/workflows/bazel.yml @@ -0,0 +1,24 @@ +name: Bazel CI +on: + push: + branches: [gz-math8, main] + pull_request: + branches: [gz-math8, main] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v6 + with: + folders: | + [ + ".", + ] + exclude: | + [ + {"bazelversion": "6.4.0"} + {"bazelversion": "5.4.0"}, + ] diff --git a/.github/workflows/ci.bazelrc b/.github/workflows/ci.bazelrc new file mode 100644 index 000000000..3b4aad2af --- /dev/null +++ b/.github/workflows/ci.bazelrc @@ -0,0 +1,15 @@ +# This file contains Bazel settings to apply on CI only. +# It is referenced with a --bazelrc option in the call to bazel in ci.yaml + +# Debug where options came from +build --announce_rc +# This directory is configured in GitHub actions to be persisted between runs. +# We do not enable the repository cache to cache downloaded external artifacts +# as these are generally faster to download again than to fetch them from the +# GitHub actions cache. +build --disk_cache=~/.cache/bazel +# Don't rely on test logs being easily accessible from the test runner, +# though it makes the log noisier. +test --test_output=errors +# Allows tests to run bazelisk-in-bazel, since this is the cache folder used +test --test_env=XDG_CACHE_HOME From b31aefc25c0c3e07baacad669ad92a0973998094 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Wed, 16 Oct 2024 17:14:52 +0000 Subject: [PATCH 09/10] Fix workflow Signed-off-by: Michael Carroll --- .github/workflows/bazel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index f45108d18..45e775cbd 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -19,6 +19,6 @@ jobs: ] exclude: | [ - {"bazelversion": "6.4.0"} - {"bazelversion": "5.4.0"}, + {"bazelversion": "6.4.0"}, + {"bazelversion": "5.4.0"} ] From 2f13dec330a1e599d8ac7027e7dc50eea165e20e Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Wed, 16 Oct 2024 17:17:12 +0000 Subject: [PATCH 10/10] Only test with bzlmod Signed-off-by: Michael Carroll --- .github/workflows/bazel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 45e775cbd..b78ebc8ff 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -19,6 +19,7 @@ jobs: ] exclude: | [ + {"folder": ".", "bzlmodEnabled": false}, {"bazelversion": "6.4.0"}, {"bazelversion": "5.4.0"} ]