🇻🇳 Tiếng Việt: README · Hướng dẫn · Kiến trúc
See what actually changed after AUTOSAR code generation.
Regenerating a Simulink/AUTOSAR project can produce thousands of changed lines caused by timestamps, UUIDs, generated identifiers and other generator churn.
CodeGen Compare Tool compares two generated-code snapshots, filters out changes that can be proven to be generator noise, and highlights the changes that matter.
It compares not only generated C/C++ and XML, but also the AUTOSAR and A2L objects behind them.
General-purpose diff tools compare text. They cannot tell whether a changed UUID is noise, whether a generated identifier was safely renamed, or whether ARXML and generated C are no longer consistent.
CodeGen Compare is designed specifically for generated automotive software.
| General diff tools | CodeGen Compare | |
|---|---|---|
| Generator timestamps / UUIDs | Show as changes | Filtered automatically |
| Generated identifier renames | Look like changes everywhere | Recognised when safely explainable |
| AUTOSAR changes | Text only | SWCs, ports, runnables, events, RTE access |
| A2L changes | Text only | Characteristics / measurements |
| Incomplete regeneration | Usually invisible | Cross-file consistency check |
| CI build gate | Manual | Exit codes + JSON + SARIF |
Rule: if a difference cannot be proven to be noise, it remains a real change.
For ordinary text files, use a general-purpose diff tool. For AUTOSAR code generation, use CodeGen Compare.
python -m compare_tool old_gen_folder new_gen_folder --report report.htmlThe result is a self-contained HTML report that can be opened in any browser or published as a CI artifact.
ZIP files can be compared directly:
python -m compare_tool baseline.zip current.zip --report report.htmlpython -m compare_toolWith no folders supplied, the interactive viewer opens.
Run directly from a clone:
git clone https://github.com/longvo92/codegen-compare-tool.git
cd codegen-compare-tool
python -m compare_tool --helpOr install as a command:
pip install git+https://github.com/longvo92/codegen-compare-tool.gitA single-file build is also available for machines where installing software is restricted.
See the Usage Guide for installation, packaging and all command-line options.
Both use the same comparison engine, so they always produce the same comparison result.
| Desktop Viewer | CLI | |
|---|---|---|
| Best for | Interactive review | CI / automation |
| Input | Folders / ZIP | Folders / ZIP |
| Output | Interactive diff | HTML / JSON / SARIF |
| Build gate | — | Exit code |
Automatically identifies common code-generation churn:
- UUIDs and timestamps
- Generated version stamps
- Comments and formatting
- Generated identifier renames
- Safe statement reordering
- Configurable custom noise rules
Changes that cannot be safely explained remain visible as real changes.
One opt-in exception: --skip-var-renames folds variable renames it cannot
prove are noise, so a fresh regenerate can be swept for what is not a rename.
It trades away real changes that look the same, announces itself everywhere it
was used, and is never on by default.
See What Counts as Noise.
See what changed in AUTOSAR terms, not only as changed lines of C or XML.
The tool extracts changes to:
- SWCs
- Ports and port interfaces
- Runnables
- Events
Rte_*access points- A2L
CHARACTERISTIC/MEASUREMENTobjects
Changes are grouped by the Simulink model they belong to.
A timing change such as:
TIMING-EVENT: 0.01 s → 0.02 s
is reported as a semantic AUTOSAR change instead of forcing you to find it in generated XML.
Generated artifacts should agree with each other.
CodeGen Compare cross-checks ARXML, A2L and generated C to detect suspicious inconsistencies.
For example:
ARXML changed + C unchanged
→ possible incomplete regeneration
A2L changed + C unchanged
→ possible incomplete regeneration
Model A gains an Rte_* call
while Model B remains unchanged
→ possible partial regeneration
These checks are advisory and do not change the file verdict or CI exit code.
See Consistency Check.
The viewer provides:
- Folder tree
- Side-by-side diff
- Minimap and syntax highlighting
- Change navigation
- Review notes
- Git history comparison
- Offline user guide
It is designed for manually reviewing large generated-code changes without losing context.
See Side-by-side Viewer.
Every comparison can produce a self-contained HTML report containing:
- File and change summaries
- Filtering and collapsible diffs
- Context around each change
- Function-level change information
- Dark / light themes
- AUTOSAR semantic summaries
- Consistency advisories
The report requires no server, database or internet connection and can be published directly as a CI artifact.
See HTML Report.
Use the exit code as a build gate:
| Code | Meaning |
|---|---|
0 |
No real changes |
1 |
Real changes found |
2 |
Compare incomplete or failed |
Example:
python -m compare_tool old_dir new_dir \
--report compare_report.html \
--exit-zeroAvailable machine-readable outputs:
--json— complete comparison data--sarif— SARIF 2.1.0 for code-scanning systems
Publish the HTML report as a build artifact for every comparison.
See CI Integration.
The compare engine uses only the Python standard library.
No:
- Database
- Server
- Network connection
pip installrequired for CLI comparison
The desktop viewer uses PySide6, loaded only when the viewer is opened.
This makes the CLI suitable for locked-down build environments.
- 📖 Usage Guide — commands, viewer shortcuts, noise rules, reports, CI and packaging
- 🏗 Architecture — module structure and design decisions
- 🇻🇳 Vietnamese Documentation
Run the test suite:
python -m unittest discover -s testsThe compare core must remain standard-library-only.
See Architecture before making changes.
Issues and pull requests are welcome.
Long Vo Thien
Released under the MIT License © 2026 Long Vo Thien.


