Skip to content

Commit ca42dde

Browse files
David-LP99pablogs9jamoralpbjsowa4ntn
committed
micro-ROS Humble patch
* micro-ROS changes over dashing * Added and updated security directory (#1) * RCUTILS_NO_FILESYSTEM and RCUTILS_AVOID_DYNAMIC_ALLOCATION (#2) - No filesystem options; default allocators write access - Avoid dynamic allocation and no filesystem on error handling - Error handling template; new allocator approach * Add test_security_directory test from rcl (#3) * Zephyr fixes (#4) * CMake refactor (#5) * Update approach (#6) - Remove target_compile_definitions and refactor flags install - Added RCUTILS_NO_FILESYSTEM on new functions * Updates 17092020 * Fix atomics 64bits (#9) - Add hashing and lock pool * Updates 09102020 * Release micro-ROS Foxy (#8) - Update filesystem; adjust logger level; cleaning * Remove build warning (#10) - avoid not used warnings * Reduce error handling static size (#14) (#15) * Revert "Revert "Install headers to include/${PROJECT_NAME} (ros2#351)"" * Fix atomic 64 b description (#17) (#18) * Add fork checker for humble * Zephyr POSIX time support, cherry-picked from upstream since it was never backported to the ros2/rcutils humble branch - time_unix: add zephyr posix time (ros2#368) - time_unix: uses ZEPHYR_VERSION_CODE instead of KERNELVERSION (ros2#390) * Don't link dl library when not needed (#28) (#30) * Don't export dl library when not used (#33) (#36) * Fix test_error_handling_helpers target_link_libraries (#37) (#38) * Fix tm struct init (#41) * Update CI (backport #43) (#47) - Add CI and nightly for each distro; update git version; skip tests - Change nightly to weekly; change master to rolling in fork checker * Update CI (backport #51) (#55) Co-authored-by: Pablo Garrido <pablogs9@gmail.com> Co-authored-by: Jose Antonio Moral <joseantoniomoralparras@gmail.com> Co-authored-by: Blazej Sowa <bsowa123@gmail.com> Co-authored-by: Anton Casas <antoncasas@eprosima.com> Co-authored-by: Eugenio Collado <eugeniocollado@eprosima.com> Co-authored-by: Carlos Espinoza Curto <148376273+Carlosespicur@users.noreply.github.com> Signed-off-by: David Laseca <davidlaseca@eprosima.com>
1 parent 3214e35 commit ca42dde

25 files changed

Lines changed: 682 additions & 17 deletions

.github/workflows/fork_checker.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: micro-ROS fork Update Checker
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
name:
6+
description: "Manual trigger"
7+
schedule:
8+
- cron: '0 4 * * *'
9+
10+
jobs:
11+
micro_ros_fork_update_check:
12+
runs-on: ubuntu-latest
13+
container: ubuntu:20.04
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
branches: [humble, jazzy, kilted, lyrical, rolling]
18+
steps:
19+
- name: Check
20+
id: check
21+
shell: bash
22+
run: |
23+
apt update; apt install -y git
24+
REPO=$(echo ${{ github.repository }} | awk '{split($0,a,"/"); print a[2]}')
25+
git clone -b ${{ matrix.branches }} https://github.com/micro-ros/$REPO
26+
cd $REPO
27+
git remote add ros2 https://github.com/ros2/$REPO
28+
git fetch ros2
29+
git fetch origin
30+
echo "::set-output name=merge_required::true"
31+
CMP=$(git rev-list --left-right --count ros2/${{ matrix.branches }}...origin/${{ matrix.branches }} | awk '{print $1}')
32+
if [ $CMP = "0" ]; then echo "::set-output name=merge_required::false"; fi
33+
34+
- name: Alert
35+
if: ${{ steps.check.outputs.merge_required == 'true' }}
36+
run: exit 1

.github/workflows/humble-ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: rcutils CI Humble
2+
3+
on:
4+
push:
5+
branches: [ humble ]
6+
pull_request:
7+
branches: [ humble ]
8+
9+
jobs:
10+
humble-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: ${{ github.ref }}
14+
os: ubuntu-22.04
15+
docker-image: ubuntu:jammy
16+
ros-distribution: humble

.github/workflows/jazzy-ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: rcutils CI Jazzy
2+
3+
on:
4+
push:
5+
branches: [ jazzy ]
6+
pull_request:
7+
branches: [ jazzy ]
8+
9+
jobs:
10+
jazzy-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: ${{ github.ref }}
14+
os: ubuntu-24.04
15+
docker-image: ubuntu:noble
16+
ros-distribution: jazzy

.github/workflows/kilted-ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: rcutils CI Kilted
2+
3+
on:
4+
push:
5+
branches: [ kilted ]
6+
pull_request:
7+
branches: [ kilted ]
8+
9+
jobs:
10+
kilted-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: ${{ github.ref }}
14+
os: ubuntu-24.04
15+
docker-image: ubuntu:noble
16+
ros-distribution: kilted

.github/workflows/lyrical-ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: rcutils CI Lyrical
2+
3+
on:
4+
push:
5+
branches: [ lyrical ]
6+
pull_request:
7+
branches: [ lyrical ]
8+
9+
jobs:
10+
lyrical-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: ${{ github.ref }}
14+
os: ubuntu-26.04
15+
docker-image: ubuntu:resolute
16+
ros-distribution: lyrical

.github/workflows/reusable-ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Reusable rcutils CI
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
branch:
7+
description: "The rcutils branch to use for the workflow"
8+
required: true
9+
type: string
10+
os:
11+
description: "The OS to use for the workflow"
12+
required: true
13+
type: string
14+
docker-image:
15+
description: "The docker image to use for the workflow"
16+
required: true
17+
type: string
18+
ros-distribution:
19+
description: "The ROS distribution to use for the workflow"
20+
required: true
21+
type: string
22+
23+
jobs:
24+
build:
25+
runs-on: ${{ inputs.os }}
26+
strategy:
27+
fail-fast: false
28+
container:
29+
image: ${{ inputs.docker-image }}
30+
steps:
31+
32+
- run: |
33+
apt-get update && apt-get install -y git
34+
shell: bash
35+
36+
- name: Sync repository
37+
uses: actions/checkout@v5
38+
with:
39+
ref: ${{ inputs.branch }}
40+
submodules: recursive
41+
42+
- name: Setup ROS 2
43+
uses: ros-tooling/setup-ros@0.7.19
44+
with:
45+
required-ros-distributions: ${{ inputs.ros-distribution }}
46+
47+
- name : Download and install rcutils-dependencies
48+
run: |
49+
apt-get install ros-${{ inputs.ros-distribution }}-mimick-vendor
50+
apt-get -y install ros-${{ inputs.ros-distribution }}-performance-test-fixture
51+
52+
- uses : ros-tooling/action-ros-ci@0.4.8
53+
with:
54+
package-name: "rcutils"
55+
target-ros2-distro: ${{ inputs.ros-distribution }}
56+
skip-tests: true

.github/workflows/rolling-ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: rcutils CI Rolling
2+
3+
on:
4+
push:
5+
branches: [ rolling ]
6+
pull_request:
7+
branches: [ rolling ]
8+
9+
jobs:
10+
rolling-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: ${{ github.ref }}
14+
os: ubuntu-24.04
15+
docker-image: ubuntu:noble
16+
ros-distribution: rolling

.github/workflows/weekly-ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: rcutils weekly CI (all distributions)
2+
3+
on:
4+
schedule:
5+
# Run once per week to detect broken dependencies.
6+
- cron: '59 23 * * 0'
7+
workflow_dispatch:
8+
9+
jobs:
10+
humble-ci:
11+
uses: ./.github/workflows/reusable-ci.yml
12+
with:
13+
branch: humble
14+
os: ubuntu-22.04
15+
docker-image: ubuntu:jammy
16+
ros-distribution: humble
17+
jazzy-ci:
18+
uses: ./.github/workflows/reusable-ci.yml
19+
with:
20+
branch: jazzy
21+
os: ubuntu-24.04
22+
docker-image: ubuntu:noble
23+
ros-distribution: jazzy
24+
kilted-ci:
25+
uses: ./.github/workflows/reusable-ci.yml
26+
with:
27+
branch: kilted
28+
os: ubuntu-24.04
29+
docker-image: ubuntu:noble
30+
ros-distribution: kilted
31+
lyrical-ci:
32+
uses: ./.github/workflows/reusable-ci.yml
33+
with:
34+
branch: lyrical
35+
os: ubuntu-26.04
36+
docker-image: ubuntu:resolute
37+
ros-distribution: lyrical
38+
rolling-ci:
39+
uses: ./.github/workflows/reusable-ci.yml
40+
with:
41+
branch: rolling
42+
os: ubuntu-24.04
43+
docker-image: ubuntu:noble
44+
ros-distribution: rolling

CMakeLists.txt

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.12)
22

33
project(rcutils)
44

5+
option(RCUTILS_NO_THREAD_SUPPORT "Disable thread support." OFF)
6+
option(RCUTILS_NO_FILESYSTEM "Disable filesystem usage." OFF)
7+
option(RCUTILS_AVOID_DYNAMIC_ALLOCATION "Disable dynamic allocations." OFF)
8+
option(RCUTILS_NO_64_ATOMIC "Enable alternative support for 64 bits atomic operations in platforms with no native support." OFF)
9+
option(RCUTILS_MICROROS "Flag for building micro-ROS." ON)
10+
511
# Default to C11
612
if(NOT CMAKE_C_STANDARD)
713
set(CMAKE_C_STANDARD 11)
@@ -30,7 +36,7 @@ if(UNIX AND NOT APPLE)
3036
endif()
3137
endif()
3238

33-
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
39+
if(NOT RCUTILS_MICROROS AND (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
3440
# enables building a static library but later link it into a dynamic library
3541
add_compile_options(-fPIC)
3642
endif()
@@ -75,6 +81,7 @@ set(rcutils_sources
7581
src/time.c
7682
${time_impl_c}
7783
src/uint8_array.c
84+
$<$<BOOL:${RCUTILS_NO_64_ATOMIC}>:src/atomic_64bits.c>
7885
)
7986
set_source_files_properties(
8087
${rcutils_sources}
@@ -129,8 +136,14 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "RCUTILS_BUILDING_DLL")
129136
if(BUILD_TESTING AND NOT RCUTILS_DISABLE_FAULT_INJECTION)
130137
target_compile_definitions(${PROJECT_NAME} PUBLIC RCUTILS_ENABLE_FAULT_INJECTION)
131138
endif()
139+
configure_file(
140+
"${PROJECT_SOURCE_DIR}/include/rcutils/configuration_flags.h.in"
141+
"${PROJECT_BINARY_DIR}/include/rcutils/configuration_flags.h"
142+
)
132143

133-
target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
144+
if(NOT RCUTILS_NO_FILESYSTEM)
145+
target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
146+
endif()
134147

135148
check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMICS)
136149

@@ -282,7 +295,7 @@ if(BUILD_TESTING)
282295
)
283296
if(TARGET test_error_handling_helpers)
284297
target_include_directories(test_error_handling_helpers PUBLIC include)
285-
target_link_libraries(test_error_handling_helpers osrf_testing_tools_cpp::memory_tools)
298+
target_link_libraries(test_error_handling_helpers ${PROJECT_NAME} osrf_testing_tools_cpp::memory_tools)
286299
endif()
287300

288301
rcutils_custom_add_gtest(test_split
@@ -587,7 +600,10 @@ endif()
587600

588601
# Export old-style CMake variables
589602
ament_export_include_directories("include/${PROJECT_NAME}")
590-
ament_export_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
603+
604+
if(NOT RCUTILS_NO_FILESYSTEM)
605+
ament_export_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
606+
endif()
591607

592608
# Export modern CMake targets
593609
ament_export_targets(${PROJECT_NAME})

include/rcutils/allocator.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ RCUTILS_WARN_UNUSED
8585
rcutils_allocator_t
8686
rcutils_get_zero_initialized_allocator(void);
8787

88+
/// Set rcutils default allocators.
89+
/**
90+
* <hr>
91+
* Attribute | Adherence
92+
* ------------------ | -------------
93+
* Allocates Memory | No
94+
* Thread-Safe | Yes
95+
* Uses Atomics | No
96+
* Lock-Free | Yes
97+
*/
98+
RCUTILS_PUBLIC
99+
RCUTILS_WARN_UNUSED
100+
bool
101+
rcutils_set_default_allocator(rcutils_allocator_t * allocator);
102+
88103
/// Return a properly initialized rcutils_allocator_t with default values.
89104
/**
90105
* This defaults to:

0 commit comments

Comments
 (0)