Skip to content

Commit

Permalink
Merge pull request #152 from gazebosim/merge_3_main_20241004
Browse files Browse the repository at this point in the history
Merge 3 -> main
  • Loading branch information
iche033 authored Oct 8, 2024
2 parents 5d28def + ddbed6d commit 1496919
Show file tree
Hide file tree
Showing 18 changed files with 518 additions and 111 deletions.
12 changes: 12 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.3.1
24 changes: 24 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Bazel CI
on:
push:
branches: [gz-utils3, main]
pull_request:
branches: [gz-utils3, 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"},
]
15 changes: 15 additions & 0 deletions .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ build_*
# OS generated files
.DS_Store
*.swp

# Bazel generated files
bazel-bin/
bazel-out/
bazel-testlogs/
bazel-*
168 changes: 100 additions & 68 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,70 +1,99 @@
load(
"@gz//bazel/skylark:build_defs.bzl",
"GZ_FEATURES",
"GZ_ROOT",
"GZ_VISIBILITY",
"gz_configure_header",
"gz_export_header",
"gz_include_header",
)
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")

package(
default_applicable_licenses = [GZ_ROOT + "utils:license"],
default_visibility = GZ_VISIBILITY,
features = GZ_FEATURES,
default_applicable_licenses = [":license"],
default_visibility = ["__subpackages__"],
features = ["layering_check"],
)

license(
name = "license",
package_name = "gz-utils",
)

licenses(["notice"])
exports_files([
"LICENSE",
"MODULE.bazel",
])

exports_files(["LICENSE"])
gz_export_header(
name = "Export",
out = "include/gz/utils/Export.hh",
export_base = "GZ_UTILS",
lib_name = "gz-utils",
)

gz_configure_header(
name = "config",
name = "Config",
src = "include/gz/utils/config.hh.in",
cmakelists = ["CMakeLists.txt"],
package = "utils",
package_xml = "package.xml",
)

gz_export_header(
name = "include/gz/utils/Export.hh",
export_base = "GZ_UTILS",
lib_name = "gz-utils",
visibility = ["//visibility:private"],
cc_library(
name = "Environment",
srcs = ["src/Environment.cc"],
hdrs = ["include/gz/utils/Environment.hh"],
includes = ["include"],
deps = [
":Config",
":Export",
],
)

public_headers_no_gen = glob([
"include/gz/utils/*.hh",
"include/gz/utils/detail/*.hh",
"include/gz/utils/detail/*.h",
])

gz_include_header(
name = "utilshh_genrule",
out = "include/gz/utils.hh",
hdrs = public_headers_no_gen + [
"include/gz/utils/Export.hh",
"include/gz/utils/config.hh",
cc_library(
name = "ImplPtr",
hdrs = [
"include/gz/utils/ImplPtr.hh",
"include/gz/utils/detail/DefaultOps.hh",
"include/gz/utils/detail/ImplPtr.hh",
],
includes = ["include"],
visibility = ["//visibility:public"],
deps = [
":Export",
":SuppressWarning",
],
)

public_headers = public_headers_no_gen + [
"include/gz/utils/config.hh",
"include/gz/utils/Export.hh",
"include/gz/utils.hh",
]
cc_library(
name = "NeverDestroyed",
hdrs = ["include/gz/utils/NeverDestroyed.hh"],
includes = ["include"],
visibility = ["//visibility:public"],
)

cc_library(
name = "utils",
srcs = ["src/Environment.cc"],
hdrs = public_headers,
copts = ["-fexceptions"],
name = "SuppressWarning",
hdrs = [
"include/gz/utils/SuppressWarning.hh",
"include/gz/utils/detail/SuppressWarning.hh",
],
includes = ["include"],
visibility = ["//visibility:public"],
)

cc_library(
name = "Subprocess",
hdrs = [
"include/gz/utils/Subprocess.hh",
"include/gz/utils/detail/subprocess.h",
],
includes = ["include"],
visibility = ["//visibility:public"],
)

cc_library(
name = "gz-utils",
visibility = ["//visibility:public"],
deps = [
":Environment",
":ImplPtr",
":NeverDestroyed",
":Subprocess",
":SuppressWarning",
],
)

# Tests
Expand All @@ -77,7 +106,7 @@ cc_library(
"test/integration/implptr/implptr_test_classes.hh",
],
includes = ["test/integration/implptr"],
deps = [":utils"],
deps = [":ImplPtr"],
)

cc_test(
Expand All @@ -86,48 +115,51 @@ cc_test(
srcs = ["test/integration/implptr/ImplPtr_TEST.cc"],
deps = [
":implptr_test_classes",
"@gtest",
"@gtest//:gtest_main",
"@googletest//:gtest_main",
],
)

cc_test(
name = "Environment_TEST",
srcs = ["src/Environment_TEST.cc"],
deps = [
":utils",
"@gtest",
"@gtest//:gtest_main",
":Environment",
"@googletest//:gtest_main",
],
)

cc_test(
name = "NeverDestroyed_TEST",
srcs = ["src/NeverDestroyed_TEST.cc"],
copts = ["-fexceptions"],
cc_binary(
name = "subprocess_main",
srcs = ["test/integration/subprocess/subprocess_main.cc"],
deps = [
":utils",
"@gtest",
"@gtest//:gtest_main",
":Environment",
"//cli",
],
)

cc_binary(
name = "subprocess_main",
srcs = ["test/integration/subprocess/subprocess_main.cc"],
deps = [
GZ_ROOT + "utils/cli",
]
)

cc_test(
name = "subprocess_TEST",
srcs = ["test/integration/subprocess_TEST.cc"],
local_defines = ['SUBPROCESS_EXECUTABLE_PATH=\\"subprocess_main\\"'],
deps = [
":utils",
":gz-utils",
":subprocess_main",
"@gtest",
"@gtest//:gtest_main",
"@googletest//:gtest_main",
],
local_defines = ['SUBPROCESS_EXECUTABLE_PATH=\\"utils/subprocess_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",
)
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ find_package(gz-cmake4 REQUIRED)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

gz_configure_project(VERSION_SUFFIX pre1)
gz_configure_project(VERSION_SUFFIX)

#============================================================================
# Set project-specific options
Expand Down
29 changes: 28 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
## Gazebo Utils 3.x

## Gazebo Utils 3.0.0 (20XX-XX-XX)
## Gazebo Utils 3.0.0 (2024-09-25)

1. **Baseline:** this includes all changes from 2.2.0 and earlier.

1. Add EoL and use SetConsoleSinkLevel in example
* [Pull request #148](https://github.com/gazebosim/gz-utils/pull/148)

1. Catch spdlog exception thrown when creating file
* [Pull request #145](https://github.com/gazebosim/gz-utils/pull/145)

1. Include file name in log format
* [Pull request #144](https://github.com/gazebosim/gz-utils/pull/144)

1. Update logger level and flush_on values
* [Pull request #142](https://github.com/gazebosim/gz-utils/pull/142)

1. Use common formatter for console and file sinks
* [Pull request #141](https://github.com/gazebosim/gz-utils/pull/141)

1. Logger updates
* [Pull request #139](https://github.com/gazebosim/gz-utils/pull/139)

1. Update badges to point to gz-utils3 branch
* [Pull request #137](https://github.com/gazebosim/gz-utils/pull/137)
* [Pull request #138](https://github.com/gazebosim/gz-utils/pull/138)

1. Update changelog and add prepare for prereleases
* [Pull request #136](https://github.com/gazebosim/gz-utils/pull/136)

1. Move spdlog::logger to gz-utils
* [Pull request #134](https://github.com/gazebosim/gz-utils/pull/134)
Expand Down
12 changes: 12 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"gz-utils"

module(
name = "gz-utils",
repo_name = "org_gazebosim_gz-utils",
)

bazel_dep(name = "buildifier_prebuilt", version = "7.3.1")
bazel_dep(name = "googletest", version = "1.14.0")
bazel_dep(name = "rules_gazebo", version = "0.0.2")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "spdlog", version = "1.14.1")
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

Build | Status
-- | --
Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-utils/branch/main/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-utils)
Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-utils/branch/main/graph/badge.svg)](https://app.codecov.io/gh/gazebosim/gz-utils/tree/main)
Ubuntu Noble | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_utils-ci-main-noble-amd64)](https://build.osrfoundation.org/job/gz_utils-ci-main-noble-amd64)
Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_utils-ci-main-homebrew-amd64)](https://build.osrfoundation.org/job/gz_utils-ci-main-homebrew-amd64)
Windows | [![Build Status](https://build.osrfoundation.org/job/gz_utils-main-win/badge/icon)](https://build.osrfoundation.org/job/ign_utils-ci-win/)
Windows | [![Build Status](https://build.osrfoundation.org/job/gz_utils-main-win/badge/icon)](https://build.osrfoundation.org/job/gz_utils-main-win/)

Gazebo Utils, a component of [Gazebo](https://gazebosim.org), provides general purpose
classes and functions designed for robotic applications.
Expand Down
Empty file added WORKSPACE
Empty file.
Loading

0 comments on commit 1496919

Please sign in to comment.