Skip to content

Add FlatBuffers dependency and inital set of starlark rules for cpp.#131

Open
OliverHeilwagen wants to merge 3 commits intoeclipse-score:mainfrom
etas-contrib:add_initial_starlark_rules_for_flatbuffers
Open

Add FlatBuffers dependency and inital set of starlark rules for cpp.#131
OliverHeilwagen wants to merge 3 commits intoeclipse-score:mainfrom
etas-contrib:add_initial_starlark_rules_for_flatbuffers

Conversation

@OliverHeilwagen
Copy link
Copy Markdown
Contributor

@OliverHeilwagen OliverHeilwagen commented Mar 26, 2026

resolve issue #124

  • Add dependency to FlatBuffers
  • Add initial set of starlark rules for cpp
    • generate_cpp
    • serialize_buffer
    • serialize_multiple_buffers
    • generate_json_schema
  • Basic tests for starlark rules.

@github-actions
Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

allow_single_file = [".fbs"],
mandatory = True,
doc = "The .fbs FlatBuffer schema file that defines the data structure",
),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Rule will be extend to also support include of other schemas with issue #128

)

# Symlink to the requested output name
ctx.actions.symlink(output = out_header, target_file = generated_file)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulquiring I found this improvement so we don't require the mv step

@@ -0,0 +1,59 @@
/// Demo FlatBuffer schema for a component
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulquiring I slightly changed the rule tests to avoid duplication of the small test schemas.


return [DefaultInfo(files = depset([out_bin]))]

serialize_buffer = rule(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Rule extension to also perform opt-in schema validation needs to be planned.
Common JSON schema validation rule for JSON-Library and FlatBuffers-Library should be created.

@@ -0,0 +1,130 @@
# *******************************************************************************
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@4og In other modules i noticed the public bazel rules are under //bazel/tools (e.g. for someip)
As the rule only belongs to the flatbuffers component i would suggest to place it here //score/flatbuffers/bazel.
Please check if the location is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant