Skip to content

Commit dc428af

Browse files
feat: replace compile-time ENABLE_HARDWARE with runtime mock:// gating, bump to v0.2.4
Architecture change: aligns bread with the ezo provider pattern. Previously: ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE=ON/OFF at compile time. The release binary shipped with HARDWARE=OFF (non-functional no-op). Now: one binary per platform. Hardware capability is always compiled in on Linux. Runtime behavior is determined by bus_path in config: - bus_path: mock://... => config-seeded inventory (no hardware needed) - bus_path: /dev/i2c-1 => opens CRUMBS bus, runs discovery Changes: - Remove ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE option from CMakeLists.txt - Replace #if ANOLIS_PROVIDER_BREAD_HAS_CRUMBS guards with #if defined(__linux__) in linux_transport.hpp/cpp and runtime_state.cpp - Add is_mock_mode() runtime check in runtime_state.cpp - Remove hardware.require_live_session config field (superseded by bus_path) - Add config/ci.test.yaml with mock://ci-test for CI/dev use - shell_test and proto_smoke_test now use mock://test-stub / ci.test.yaml - CMakePresets.json: remove ENABLE_HARDWARE from all presets; rename linux-hardware-base -> linux-base; remove *-hardware-* presets - linux-wire: set(BUILD_SHARED_LIBS OFF) before add_subdirectory to ensure static archive regardless of parent CMake context - CRUMBS_ENABLE_LINUX_HAL now always ON on Linux, OFF on other platforms - Workflow: add linux-wire checkout (feastorg/linux-wire@v0.1.2); remove explicit -DCRUMBS_DIR/-DBREAD_CONTRACTS_DIR cmake overrides (preset linux-base sets these via sourceDir/../ pattern)
1 parent 6b002bf commit dc428af

14 files changed

Lines changed: 150 additions & 206 deletions

.github/workflows/release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ jobs:
4242
ref: v0.4.2
4343
path: bread-crumbs-contracts
4444

45+
- name: Checkout linux-wire
46+
uses: actions/checkout@v4
47+
with:
48+
repository: feastorg/linux-wire
49+
ref: v0.1.2
50+
path: linux-wire
51+
4552
- name: Install system dependencies
4653
run: |
4754
sudo apt-get update
@@ -59,10 +66,7 @@ jobs:
5966

6067
- name: Configure
6168
working-directory: anolis-provider-bread
62-
run: |
63-
cmake --preset ci-linux-release \
64-
"-DCRUMBS_DIR=${{ github.workspace }}/CRUMBS" \
65-
"-DBREAD_CONTRACTS_DIR=${{ github.workspace }}/bread-crumbs-contracts"
69+
run: cmake --preset ci-linux-release
6670

6771
- name: Build
6872
working-directory: anolis-provider-bread

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,36 @@ commit messages only.
1313

1414
## [Unreleased]
1515

16+
## [0.2.4] - 2026-04-24
17+
18+
### Changed
19+
20+
- Replaced compile-time `ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE` flag with runtime
21+
gating via `bus_path` prefix. `bus_path: mock://...` produces a config-seeded
22+
inventory without requiring any hardware; any other path opens a live CRUMBS
23+
session. This aligns bread with the ezo provider pattern: one binary per
24+
platform, behavior determined by config at runtime.
25+
- Removed `hardware.require_live_session` config field. The same intent is now
26+
expressed by using a real bus path (e.g. `/dev/i2c-1`) — if the bus cannot be
27+
opened, startup throws. Configs with `require_live_session` will be rejected
28+
at load time as an unknown key.
29+
- Added `config/ci.test.yaml` with `bus_path: mock://ci-test` for CI and dev
30+
testing without hardware.
31+
- `linux-wire` is now always compiled into the provider on Linux (no flag required).
32+
`set(BUILD_SHARED_LIBS OFF)` added before the linux-wire subdirectory to ensure
33+
a static archive regardless of the parent CMake context.
34+
- Removed `dev-linux-hardware-debug`, `dev-linux-hardware-release`, and
35+
`ci-linux-hardware-release` presets (superseded by `dev-debug`, `dev-release`,
36+
and `ci-linux-release` which now always include hardware capability on Linux).
37+
- Renamed hidden `linux-hardware-base` preset to `linux-base`.
38+
39+
### CI
40+
41+
- Release workflow: added linux-wire checkout (`feastorg/linux-wire@v0.1.2`).
42+
- Release workflow: removed explicit `-DCRUMBS_DIR` / `-DBREAD_CONTRACTS_DIR`
43+
cmake overrides; these are now set by the `linux-base` preset via
44+
`${sourceDir}/../CRUMBS` and `${sourceDir}/../bread-crumbs-contracts`.
45+
1646
## [0.2.3] - 2026-04-23
1747

1848
### CI

CMakeLists.txt

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
cmake_minimum_required(VERSION 3.20)
22

3-
option(ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE "Enable CRUMBS/Linux hardware integration" ${UNIX})
43
option(ANOLIS_PROVIDER_BREAD_WARNINGS_AS_ERRORS "Treat first-party compiler warnings as errors" OFF)
54

6-
project(anolis_provider_bread VERSION 0.2.3 LANGUAGES C CXX)
5+
project(anolis_provider_bread VERSION 0.2.4 LANGUAGES C CXX)
76

87
set(CMAKE_CXX_STANDARD 17)
98
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -57,30 +56,21 @@ if(NOT ADPP_PROTOS)
5756
)
5857
endif()
5958

60-
if(ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE)
61-
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
62-
message(FATAL_ERROR
63-
"ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE requires a Linux host build.\n"
64-
"Use a Linux hardware preset (dev-linux-hardware-debug, dev-linux-hardware-release)\n"
65-
"or configure with ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE=OFF on other platforms."
66-
)
67-
endif()
68-
59+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
6960
if(NOT DEFINED LINUX_WIRE_DIR)
7061
set(LINUX_WIRE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../linux-wire" CACHE PATH "Path to linux-wire repository")
7162
endif()
7263
get_filename_component(LINUX_WIRE_DIR_ABS "${LINUX_WIRE_DIR}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
7364

74-
if(EXISTS "${LINUX_WIRE_DIR_ABS}/CMakeLists.txt")
75-
set(LINUX_WIRE_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
76-
add_subdirectory("${LINUX_WIRE_DIR_ABS}" "${CMAKE_BINARY_DIR}/linux_wire_subbuild")
77-
message(STATUS "Using linux-wire source tree: ${LINUX_WIRE_DIR_ABS}")
78-
else()
79-
message(STATUS
80-
"LINUX_WIRE_DIR not found at '${LINUX_WIRE_DIR_ABS}'. "
81-
"CRUMBS will rely on installed linux_wire package visibility if Linux HAL is enabled."
82-
)
65+
if(NOT EXISTS "${LINUX_WIRE_DIR_ABS}/CMakeLists.txt")
66+
message(FATAL_ERROR
67+
"linux-wire not found at: ${LINUX_WIRE_DIR_ABS}\n"
68+
"Set LINUX_WIRE_DIR to the root of the linux-wire repository.")
8369
endif()
70+
set(BUILD_SHARED_LIBS OFF)
71+
set(LINUX_WIRE_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
72+
add_subdirectory("${LINUX_WIRE_DIR_ABS}" "${CMAKE_BINARY_DIR}/linux_wire_subbuild")
73+
message(STATUS "Using linux-wire source tree: ${LINUX_WIRE_DIR_ABS}")
8474
endif()
8575

8676
# CRUMBS: find_package by default; set CRUMBS_DIR to use a source-tree override.
@@ -91,7 +81,11 @@ if(DEFINED CRUMBS_DIR AND NOT CRUMBS_DIR STREQUAL "")
9181
"CRUMBS not found at: ${CRUMBS_DIR_ABS}\n"
9282
"Set CRUMBS_DIR to the root of the CRUMBS repository.")
9383
endif()
94-
set(CRUMBS_ENABLE_LINUX_HAL "${ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE}" CACHE BOOL "" FORCE)
84+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
85+
set(CRUMBS_ENABLE_LINUX_HAL ON CACHE BOOL "" FORCE)
86+
else()
87+
set(CRUMBS_ENABLE_LINUX_HAL OFF CACHE BOOL "" FORCE)
88+
endif()
9589
set(CRUMBS_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
9690
set(CRUMBS_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
9791
add_subdirectory("${CRUMBS_DIR_ABS}" "${CMAKE_BINARY_DIR}/crumbs_subbuild")
@@ -168,14 +162,11 @@ target_compile_definitions(anolis_provider_bread_crumbs PUBLIC
168162
)
169163
anolis_provider_bread_apply_warnings(anolis_provider_bread_crumbs)
170164

171-
if(ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE)
165+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
172166
target_sources(anolis_provider_bread_crumbs PRIVATE
173167
src/crumbs/linux_transport.cpp
174168
)
175169
target_link_libraries(anolis_provider_bread_crumbs PUBLIC crumbs::crumbs)
176-
target_compile_definitions(anolis_provider_bread_crumbs PUBLIC
177-
ANOLIS_PROVIDER_BREAD_HAS_CRUMBS=1
178-
)
179170
endif()
180171

181172
add_library(anolis_provider_bread_core STATIC

CMakePresets.json

Lines changed: 7 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
}
2929
},
3030
{
31-
"name": "linux-hardware-base",
31+
"name": "linux-base",
3232
"hidden": true,
3333
"inherits": "base",
3434
"cacheVariables": {
@@ -39,57 +39,30 @@
3939
},
4040
{
4141
"name": "dev-debug",
42-
"inherits": "base",
42+
"inherits": "linux-base",
4343
"cacheVariables": {
44-
"CMAKE_BUILD_TYPE": "Debug",
45-
"ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE": "OFF"
44+
"CMAKE_BUILD_TYPE": "Debug"
4645
}
4746
},
4847
{
4948
"name": "dev-release",
50-
"inherits": "base",
49+
"inherits": "linux-base",
5150
"cacheVariables": {
52-
"CMAKE_BUILD_TYPE": "Release",
53-
"ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE": "OFF"
51+
"CMAKE_BUILD_TYPE": "Release"
5452
}
5553
},
5654
{
5755
"name": "dev-windows-debug",
5856
"inherits": "base-windows-msvc",
5957
"cacheVariables": {
60-
"CMAKE_BUILD_TYPE": "Debug",
61-
"ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE": "OFF"
58+
"CMAKE_BUILD_TYPE": "Debug"
6259
}
6360
},
6461
{
6562
"name": "dev-windows-release",
6663
"inherits": "base-windows-msvc",
6764
"cacheVariables": {
68-
"CMAKE_BUILD_TYPE": "Release",
69-
"ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE": "OFF"
70-
}
71-
},
72-
{
73-
"name": "dev-linux-hardware-debug",
74-
"inherits": "linux-hardware-base",
75-
"cacheVariables": {
76-
"CMAKE_BUILD_TYPE": "Debug",
77-
"ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE": "ON"
78-
}
79-
},
80-
{
81-
"name": "dev-linux-hardware-release",
82-
"inherits": "linux-hardware-base",
83-
"cacheVariables": {
84-
"CMAKE_BUILD_TYPE": "Release",
85-
"ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE": "ON"
86-
}
87-
},
88-
{
89-
"name": "ci-linux-hardware-release",
90-
"inherits": "dev-linux-hardware-release",
91-
"cacheVariables": {
92-
"ANOLIS_PROVIDER_BREAD_WARNINGS_AS_ERRORS": "ON"
65+
"CMAKE_BUILD_TYPE": "Release"
9366
}
9467
},
9568
{
@@ -104,7 +77,6 @@
10477
"inherits": "base-windows-msvc",
10578
"cacheVariables": {
10679
"CMAKE_BUILD_TYPE": "Release",
107-
"ANOLIS_PROVIDER_BREAD_ENABLE_HARDWARE": "OFF",
10880
"ANOLIS_PROVIDER_BREAD_WARNINGS_AS_ERRORS": "ON"
10981
}
11082
}
@@ -128,18 +100,6 @@
128100
"configurePreset": "dev-windows-release",
129101
"configuration": "Release"
130102
},
131-
{
132-
"name": "dev-linux-hardware-debug",
133-
"configurePreset": "dev-linux-hardware-debug"
134-
},
135-
{
136-
"name": "dev-linux-hardware-release",
137-
"configurePreset": "dev-linux-hardware-release"
138-
},
139-
{
140-
"name": "ci-linux-hardware-release",
141-
"configurePreset": "ci-linux-hardware-release"
142-
},
143103
{
144104
"name": "ci-linux-release",
145105
"configurePreset": "ci-linux-release"
@@ -181,27 +141,6 @@
181141
"outputOnFailure": true
182142
}
183143
},
184-
{
185-
"name": "dev-linux-hardware-debug",
186-
"configurePreset": "dev-linux-hardware-debug",
187-
"output": {
188-
"outputOnFailure": true
189-
}
190-
},
191-
{
192-
"name": "dev-linux-hardware-release",
193-
"configurePreset": "dev-linux-hardware-release",
194-
"output": {
195-
"outputOnFailure": true
196-
}
197-
},
198-
{
199-
"name": "ci-linux-hardware-release",
200-
"configurePreset": "ci-linux-hardware-release",
201-
"output": {
202-
"outputOnFailure": true
203-
}
204-
},
205144
{
206145
"name": "ci-linux-release",
207146
"configurePreset": "ci-linux-release",

config/ci.test.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
provider:
2+
name: bread-ci-test
3+
4+
hardware:
5+
bus_path: mock://ci-test
6+
query_delay_us: 10000
7+
timeout_ms: 100
8+
retry_count: 2
9+
10+
discovery:
11+
mode: manual
12+
addresses: [0x08, 0x09]
13+
14+
devices:
15+
- id: rlht0
16+
type: rlht
17+
label: Left Heater (CI test)
18+
address: 0x08
19+
- id: dcmt0
20+
type: dcmt
21+
label: Conveyor Drive (CI test)
22+
address: 0x09

src/config/provider_config.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,11 @@ ProviderConfig load_config(const std::string &path) {
199199
}
200200
ensure_map(hardware_node, "hardware");
201201
reject_unknown_keys(hardware_node, "hardware",
202-
{"bus_path", "require_live_session", "query_delay_us",
202+
{"bus_path", "query_delay_us",
203203
"timeout_ms", "retry_count"});
204204

205205
config.bus_path =
206206
require_scalar(hardware_node["bus_path"], "hardware.bus_path");
207-
if (hardware_node["require_live_session"]) {
208-
config.require_live_session = parse_bool_value(
209-
hardware_node["require_live_session"], "hardware.require_live_session");
210-
}
211207
if (hardware_node["query_delay_us"]) {
212208
config.query_delay_us = parse_int_value(hardware_node["query_delay_us"],
213209
"hardware.query_delay_us", false);
@@ -325,8 +321,6 @@ std::string summarize_config(const ProviderConfig &config) {
325321
// the effective config without dumping the full YAML file.
326322
out << "provider.name=" << config.provider_name
327323
<< ", hardware.bus_path=" << config.bus_path
328-
<< ", hardware.require_live_session="
329-
<< (config.require_live_session ? "true" : "false")
330324
<< ", hardware.query_delay_us=" << config.query_delay_us
331325
<< ", hardware.timeout_ms=" << config.timeout_ms
332326
<< ", hardware.retry_count=" << config.retry_count

src/config/provider_config.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@ struct DeviceSpec {
4444
* @brief Fully resolved provider configuration after YAML parsing.
4545
*
4646
* The provider may either scan the bus or probe the explicitly listed manual
47-
* addresses. `require_live_session` forces startup to fail on no-hardware
48-
* builds instead of falling back to config-seeded inventory.
47+
* addresses.
4948
*/
5049
struct ProviderConfig {
5150
std::string config_file_path;
5251
std::string provider_name = "anolis-provider-bread";
5352
std::string bus_path;
54-
bool require_live_session = false;
5553
int query_delay_us = 10000;
5654
int timeout_ms = 100;
5755
int retry_count = 2;

0 commit comments

Comments
 (0)