Skip to content

Implement build.rs loader, generate build_generated.rs #328

@ERnsTL

Description

@ERnsTL

Task 2 — Implement Minimal build.rs Loader

Objective

Read and parse flowd.build.toml inside build.rs.

Requirements

  1. Add build.rs to project root.

  2. Use toml crate to parse file.

  3. Validate:

    • At least one component exists.
    • No duplicate name.
    • crate and struct fields are not empty.
  4. If validation fails → panic!().

Acceptance Criteria

  • cargo build fails if config invalid.
  • cargo build succeeds if valid.

No code generation yet.


Task 3 — Generate build_generated.rs

Objective

Generate Rust code during build.

Requirements

In build.rs:

  1. Create file:

    $OUT_DIR/build_generated.rs
    
  2. Generate:

3.1 Use Statements

use repeat_component::RepeatComponent;
use drop_component::DropComponent;

Based on config.

3.2 Metadata Registration Function

pub fn build_component_library() -> Arc<RwLock<ComponentLibrary>> {
    Arc::new(RwLock::new(ComponentLibrary::new(vec![
        RepeatComponent::get_metadata(),
        DropComponent::get_metadata(),
    ])))
}

Acceptance Criteria

  • Generated file compiles.
  • Removing a component from config removes it from metadata.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions