Skip to content

Commit f40bb29

Browse files
David-LP99pablogs9jamoralpbjsowa4ntn
committed
micro-ROS Kilted 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 * Don't link dl library when not needed (#28) * Revert "Set hints to find the python version we actually want. (ros2#451)" * Fix struct tm init * Add PRId64 * Don't export dl library when not used (backport #33) (#35) * Fix test_error_handling_helpers target_link_libraries (#37) * Update CI (#43) - Add CI and nightly for each distro; update git version; skip tests - Change nightly to weekly; change master to rolling in fork checker * Add RCUTILS_NO_PROCESS_SUPPORT option to build without fork/exec/wait (#50) * Update CI (backport #51) (#52) * Fix weekly CI (#58) Dropped during the rebase as superseded by upstream: * Don't export dl library when not used (backport #33) (#35) 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: Carlos Espinoza Curto <148376273+Carlosespicur@users.noreply.github.com> Co-authored-by: Jimmy McElwain <jimmy.mcelwain@motoman.com> Signed-off-by: David Laseca <davidlaseca@eprosima.com>
1 parent b28bfac commit f40bb29

26 files changed

Lines changed: 707 additions & 44 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:24.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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
os: ubuntu-22.04
14+
docker-image: ubuntu:jammy
15+
ros-distribution: humble

‎.github/workflows/jazzy-ci.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
os: ubuntu-24.04
14+
docker-image: ubuntu:noble
15+
ros-distribution: jazzy

‎.github/workflows/kilted-ci.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
os: ubuntu-24.04
14+
docker-image: ubuntu:noble
15+
ros-distribution: kilted

‎.github/workflows/lyrical-ci.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
os: ubuntu-26.04
14+
docker-image: ubuntu:resolute
15+
ros-distribution: lyrical

‎.github/workflows/reusable-ci.yml‎

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

‎.github/workflows/rolling-ci.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
os: ubuntu-24.04
14+
docker-image: ubuntu:noble
15+
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

‎.vscode/settings.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"files.associations": {
3+
"*.uml": "plantuml",
4+
"*.in": "c"
5+
}
6+
}

‎CMakeLists.txt‎

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
cmake_minimum_required(VERSION 3.20)
1+
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_NO_PROCESS_SUPPORT "Disable process support." OFF)
8+
option(RCUTILS_AVOID_DYNAMIC_ALLOCATION "Disable dynamic allocations." OFF)
9+
option(RCUTILS_NO_64_ATOMIC "Enable alternative support for 64 bits atomic operations in platforms with no native support." OFF)
10+
option(RCUTILS_MICROROS "Flag for building micro-ROS." ON)
11+
512
# Default to C11
613
if(NOT CMAKE_C_STANDARD)
714
set(CMAKE_C_STANDARD 11)
@@ -17,21 +24,6 @@ find_package(ament_cmake REQUIRED)
1724
find_package(ament_cmake_python REQUIRED)
1825
find_package(ament_cmake_ros_core REQUIRED)
1926

20-
# By default, without the settings below, find_package(Python3) will attempt
21-
# to find the newest python version it can, and additionally will find the
22-
# most specific version. For instance, on a system that has
23-
# /usr/bin/python3.10, /usr/bin/python3.11, and /usr/bin/python3, it will find
24-
# /usr/bin/python3.11, even if /usr/bin/python3 points to /usr/bin/python3.10.
25-
# The behavior we want is to prefer the "system" installed version unless the
26-
# user specifically tells us othewise through the Python3_EXECUTABLE hint.
27-
# Setting CMP0094 to NEW means that the search will stop after the first
28-
# python version is found. Setting Python3_FIND_UNVERSIONED_NAMES means that
29-
# the search will prefer /usr/bin/python3 over /usr/bin/python3.11. And that
30-
# latter functionality is only available in CMake 3.20 or later, so we need
31-
# at least that version.
32-
cmake_policy(SET CMP0094 NEW)
33-
set(Python3_FIND_UNVERSIONED_NAMES FIRST)
34-
3527
find_package(Python3 REQUIRED COMPONENTS Interpreter)
3628

3729
ament_python_install_package(${PROJECT_NAME})
@@ -46,7 +38,7 @@ if(UNIX AND NOT APPLE)
4638
endif()
4739
endif()
4840

49-
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
41+
if(NOT RCUTILS_MICROROS AND (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
5042
# enables building a static library but later link it into a dynamic library
5143
add_compile_options(-fPIC)
5244
endif()
@@ -93,6 +85,7 @@ set(rcutils_sources
9385
src/time.c
9486
${time_impl_c}
9587
src/uint8_array.c
88+
$<$<BOOL:${RCUTILS_NO_64_ATOMIC}>:src/atomic_64bits.c>
9689
)
9790
set_source_files_properties(
9891
${rcutils_sources}
@@ -147,8 +140,14 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "RCUTILS_BUILDING_DLL")
147140
if(BUILD_TESTING AND NOT RCUTILS_DISABLE_FAULT_INJECTION)
148141
target_compile_definitions(${PROJECT_NAME} PUBLIC RCUTILS_ENABLE_FAULT_INJECTION)
149142
endif()
143+
configure_file(
144+
"${PROJECT_SOURCE_DIR}/include/rcutils/configuration_flags.h.in"
145+
"${PROJECT_BINARY_DIR}/include/rcutils/configuration_flags.h"
146+
)
150147

151-
target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
148+
if(NOT RCUTILS_NO_FILESYSTEM)
149+
target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS})
150+
endif()
152151

153152
check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMICS)
154153

@@ -294,7 +293,7 @@ if(BUILD_TESTING)
294293
)
295294
if(TARGET test_error_handling_helpers)
296295
target_include_directories(test_error_handling_helpers PUBLIC include)
297-
target_link_libraries(test_error_handling_helpers osrf_testing_tools_cpp::memory_tools)
296+
target_link_libraries(test_error_handling_helpers ${PROJECT_NAME} osrf_testing_tools_cpp::memory_tools)
298297
endif()
299298

300299
ament_add_gtest(test_split
@@ -519,14 +518,16 @@ if(BUILD_TESTING)
519518
target_link_libraries(test_cmdline_parser ${PROJECT_NAME})
520519
endif()
521520

522-
ament_add_gtest(test_process
523-
test/test_process.cpp
524-
)
525-
if(TARGET test_process)
526-
target_link_libraries(test_process ${PROJECT_NAME})
527-
target_compile_definitions(test_process PRIVATE
528-
"CMAKE_COMMAND=${CMAKE_COMMAND}")
529-
file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/file with space.txt")
521+
if(NOT RCUTILS_NO_PROCESS_SUPPORT)
522+
ament_add_gtest(test_process
523+
test/test_process.cpp
524+
)
525+
if(TARGET test_process)
526+
target_link_libraries(test_process ${PROJECT_NAME})
527+
target_compile_definitions(test_process PRIVATE
528+
"CMAKE_COMMAND=${CMAKE_COMMAND}")
529+
file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/file with space.txt")
530+
endif()
530531
endif()
531532

532533
ament_add_gtest(test_logging_custom_env test/test_logging_custom_env.cpp

0 commit comments

Comments
 (0)