Skip to content

Write the library version as BTCPP_version in the <root> of generated XML - #1264

Merged
facontidavide merged 1 commit into
masterfrom
feat/btcpp-version-attribute
Oct 26, 2026
Merged

facontidavide merged 1 commit into
masterfrom
feat/btcpp-version-attribute

Conversation

@facontidavide

Copy link
Copy Markdown
Collaborator

Summary

writeTreeNodesModelXML() and WriteTreeToXML() now write the library version in <root>:

<root BTCPP_format="4" BTCPP_version="4.11">

The value is major.minor, taken from LibraryVersionString(). On master it reads 4.10 until the version is bumped.

Why

Groot2 needs to know which BT.CPP version a file or a monitored tree targets:

Groot2 will let users pick the target version in its Preferences and will write the same attribute. With this PR, XML generated by the library carries it too, including the tree that Groot2Publisher sends.

Compatibility

  • No API/ABI change.
  • The parser ignores the attribute. Every 4.x release only reads BTCPP_format and main_tree_to_execute from <root>, so files written by 4.11 still load in older versions.
  • The XSD declares BTCPP_version as an optional attribute, so files without it still validate.

Tests

BehaviorTreeFactory.WrittenXMLHasLibraryVersion checks that both writers emit the attribute and that the output loads and runs again. It fails without the change. The full suite passes: 596 passed, 2 skipped.

🤖 Generated with Claude Code

…erated XML

writeTreeNodesModelXML() and WriteTreeToXML() now add BTCPP_version="<major>.<minor>"
to <root>, next to BTCPP_format. It tells tools like Groot2 which builtin node
models and attributes (e.g. the _onlyIf/_onStart preconditions of 4.11) are
available. The XSD declares it as an optional attribute.

The parser ignores it, as all BT.CPP 4.x releases already ignore unknown <root>
attributes, so files written by 4.11 still load in older versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@facontidavide
facontidavide merged commit a9d6e56 into master Oct 26, 2026
16 checks passed
@facontidavide
facontidavide deleted the feat/btcpp-version-attribute branch October 26, 2026 06:34
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant