|
| 1 | +<!-- |
| 2 | + Copyright (c) 2026 Contributors to the Eclipse Foundation |
| 3 | +
|
| 4 | + See the NOTICE file(s) distributed with this work for additional |
| 5 | + information regarding copyright ownership. |
| 6 | +
|
| 7 | + This program and the accompanying materials are made available under the |
| 8 | + terms of the Apache License Version 2.0 which is available at |
| 9 | + https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
| 11 | + SPDX-License-Identifier: Apache-2.0 |
| 12 | +--> |
| 13 | + |
| 14 | +# Architecture Verifier (archver) |
| 15 | + |
| 16 | +Validates that PlantUML component diagrams match the Bazel build graph structure. |
| 17 | + |
| 18 | +## Overview |
| 19 | + |
| 20 | +The archver tool ensures architectural consistency by comparing: |
| 21 | +- **Bazel build graph**: Dependable element, component and unit hierarchy from the build system |
| 22 | +- **PlantUML diagrams**: Static architecture documentation with stereotypes |
| 23 | + |
| 24 | +## Usage |
| 25 | + |
| 26 | +### Standalone CLI |
| 27 | + |
| 28 | +```bash |
| 29 | +archver \ |
| 30 | + --architecture-json path/to/architecture.json \ |
| 31 | + --static-fbs path/to/diagram1.fbs.bin path/to/diagram2.fbs.bin |
| 32 | + |
| 33 | +# Write a debug log in addition to stderr output |
| 34 | +archver \ |
| 35 | + --architecture-json path/to/architecture.json \ |
| 36 | + --static-fbs path/to/diagram.fbs.bin \ |
| 37 | + --output path/to/archver.log |
| 38 | +``` |
| 39 | + |
| 40 | +Exits with code `0` on success, `1` on any validation error or I/O failure. |
| 41 | + |
| 42 | +## What is Validated |
| 43 | + |
| 44 | +### Dependable Element |
| 45 | +The dependable element is represented in the Bazel JSON as a top-level component |
| 46 | +entry. In PlantUML, it corresponds to a `package` with stereotype `<<SEooC>>`. |
| 47 | +The alias of the PlantUML package must match the Bazel dependable element name. |
| 48 | + |
| 49 | +### Component Validation (Check 1) |
| 50 | +For each unique `(component_alias, parent_alias)` combination that Bazel expects: |
| 51 | +- PlantUML must have the exact same number of components with that combination |
| 52 | +- Uses target name only (package path is stripped) |
| 53 | +- Components nested under the dependable element have the dependable element as parent |
| 54 | +- Entities must have stereotype `<<component>>` |
| 55 | + |
| 56 | +### Unit Validation (Check 2) |
| 57 | +For each unique `(unit_alias, parent_component_alias)` combination that Bazel expects: |
| 58 | +- PlantUML must have the exact same number of units with that combination |
| 59 | +- Uses target name only (e.g., `unit_1`, `unit_2`) |
| 60 | +- Entities must have stereotype `<<unit>>` |
| 61 | + |
| 62 | +### Duplicate Detection |
| 63 | +If two Bazel targets resolve to the same `(alias, parent)` key (e.g., same target |
| 64 | +name in different packages), or two PlantUML entities have the same key, an error |
| 65 | +is emitted. |
| 66 | + |
| 67 | +### Example |
| 68 | +If Bazel build graph has: |
| 69 | +- Dependable element: `safety_software_seooc_example` → key: `safety_software_seooc_example` |
| 70 | +- Component: `@//examples/seooc:component_example` → key: `component_example` (parent: `safety_software_seooc_example`) |
| 71 | +- Unit: `@//examples/seooc/unit_1:unit_1` → key: `unit_1` (parent: `component_example`) |
| 72 | +- Unit: `@//examples/seooc/unit_2:unit_2` → key: `unit_2` (parent: `component_example`) |
| 73 | + |
| 74 | +PlantUML must have: |
| 75 | +```plantuml |
| 76 | +package "Safety Software SEooC Example" as safety_software_seooc_example <<SEooC>> { |
| 77 | + component "ComponentExample" as component_example <<component>> { |
| 78 | + component "Unit 1" as unit_1 <<unit>> |
| 79 | + component "Unit 2" as unit_2 <<unit>> |
| 80 | + } |
| 81 | +} |
| 82 | +``` |
0 commit comments