Skip to content

fix: ic_bundle list arguments - #11

Merged
JPHutchins merged 1 commit into
mainfrom
fix/#10/ic-bundle-list-args
Aug 21, 2026
Merged

fix: ic_bundle list arguments#11
JPHutchins merged 1 commit into
mainfrom
fix/#10/ic-bundle-list-args

Conversation

@JPHutchins

Copy link
Copy Markdown
Collaborator

Closes #10. ic_bundle()'s two list arguments now behave as documented.

Before After
EXTRA_POSTFIXES one value only — the docstring's own 3-value example errors takes a list
EXTRA_FILES parsed, then never read; bundles nothing copies each path into the bundle

Both were in the one_value_keywords slot:

# src/ic_bundle.cmake:78, before
cmake_parse_arguments(PARSE_ARGV 0 "" "" "${keyword_args}" "")

The existing workaround — quoting a semicolon-joined string — still works, since the foreach expands it either way.

One decision worth confirming

EXTRA_FILES had no specified destination name, so this copies each file as ${FULL_NAME}_<file name>:

EXTRA_FILES "${CMAKE_BINARY_DIR}/bootloader/zephyr/zephyr.hex"
  ->  client_project_board@rev_1.0.0_123456_zephyr.hex

Renaming rather than preserving zephyr.hex follows what the rest of the function does, and it keeps files identifiable once they are pulled out of the zip — which is what a release job does. Easy to change to a bare basename if you'd rather; the docstring now states whichever it is.

Tests

A new tests/test_ic_bundle_extra_args/ project rather than an extension of the existing one, because ic_bundle() creates a target literally named bundle and so cannot be called twice inside one CMake project. (Not fixed here — it is a separate concern from #10.)

The test covers the defect, not just the fix. Reverting src/ic_bundle.cmake alone:

CMake Error at src/ic_bundle.cmake:80 (message):
  Unparsed arguments: .signed.hex
└─ 1/9 test asserts passed 💩

and with the fix applied:

├──── 5 test group(s) run
│  ┌─ 0 test group(s) failed
│  └─ 0 total assert(s) failed
└─✅ All tests passed! 🎉

How this came up

Bundling signed MCUboot artifacts from a Zephyr sysbuild project: the application image emits zephyr.signed.bin and zephyr.signed.hex beside its unsigned output, and the bootloader hex comes from a sibling build domain. EXTRA_POSTFIXES is the right tool for the first pair and EXTRA_FILES for the second — the first needed the quoting workaround and the second could not be used at all.

Warning

LLM Disclosure

This post was authored by claude-opus-5[1m] on behalf of @JPHutchins. I hit both problems while bundling signed MCUboot artifacts in one of her Zephyr projects, and she asked me to fix them upstream.

EXTRA_FILES and EXTRA_POSTFIXES are documented as lists but were declared in the
one_value_keywords slot, so the docstring's own EXTRA_POSTFIXES example failed:

    CMake Error at src/ic_bundle.cmake:80 (message):
      Unparsed arguments: -app-signed.hex;-app-update-s-e.gbl

They move to multi_value_keywords. The previous workaround -- quoting a
semicolon-joined string -- keeps working, since the foreach still expands it.

EXTRA_FILES was also never read after set_default(), so passing it bundled
nothing at all. It now copies each path into the bundle as
"${FULL_NAME}_<file name>". Naming rather than preserving the source name keeps
every file in the bundle identifiable once it is pulled back out of the zip,
which is the reason the other artifacts are renamed; the docstring now says so
explicitly, since the argument takes arbitrary paths and the destination was
previously unspecified.

Both are exercised by a new test project rather than by extending the existing
one, because ic_bundle() creates a target literally named `bundle` and so cannot
be called twice within one CMake project. Reverting src/ic_bundle.cmake alone
fails 8 of the 9 new asserts, so the test covers the defect rather than the fix.

Found while bundling signed MCUboot artifacts from a Zephyr sysbuild project,
where the application image emits zephyr.signed.bin and zephyr.signed.hex beside
its unsigned output and the bootloader hex comes from a sibling build domain.

Co-Authored-By: claude-opus-5[1m] <noreply@anthropic.com>
@JPHutchins
JPHutchins merged commit bf0c6b1 into main Aug 21, 2026
1 check passed
@JPHutchins
JPHutchins deleted the fix/#10/ic-bundle-list-args branch August 21, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ic_bundle(): EXTRA_FILES is ignored, and neither list argument accepts a list

1 participant