Skip to content

Refactor: move version.h from source_main to source_base#7611

Merged
mohanchen merged 1 commit into
deepmodeling:developfrom
Critsium-xy:refactor/module-deps-version-h
Jul 8, 2026
Merged

Refactor: move version.h from source_main to source_base#7611
mohanchen merged 1 commit into
deepmodeling:developfrom
Critsium-xy:refactor/module-deps-version-h

Conversation

@Critsium-xy

@Critsium-xy Critsium-xy commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Background

As part of an ongoing effort to clean up the dependency relationships between the source_* modules (converging them toward a strictly-layered DAG where dependencies only point downward), this is a small, self-contained first step.

source_main/version.h is a leaf header containing only a single macro:

#ifndef VERSION
#define VERSION "v3.11.0-beta.5"
#endif

Although it has no dependencies, it lived in source_main — the top-level entry layer. This forced source_io to #include "source_main/version.h", i.e. a lower/mid layer reaching upward into the entry layer. This is a reverse dependency (source_io -> source_main) that violates the intended layering.

Change

  • Move version.h from source_main/ to source_base/ (the L0 infrastructure layer that every module is allowed to depend on).
  • Update all 6 include sites (source_main/version.h -> source_base/version.h): main.cpp, driver.cpp, parse_args.cpp, module_json/general_info.cpp, and the two related unit tests.

Notes

  • No behavior change — it is a pure relocation of a header-only macro.
  • No CMake changes needed — the header is resolved via the existing source/ include root, exactly like every other source_base/*.h include.
  • This cuts the source_io -> source_main reverse edge.

version.h is a leaf header (a single VERSION macro) with no dependencies,
but it lived in source_main (the top-level entry layer). This forced
source_io to include upward into source_main (edge source_io -> source_main),
a reverse dependency that violates the intended module layering.

Move it to source_base (L0 infrastructure), which every module may depend
on, and update the 6 include sites. No behavior change; header-only, so no
CMake changes are needed (resolved via the existing source/ include root).

This cuts the source_io -> source_main reverse edge.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mohanchen mohanchen added Refactor Refactor ABACUS codes The Absolute Zero Reduce the "entropy" of the code to 0 labels Jul 8, 2026
@mohanchen mohanchen merged commit 8e5d457 into deepmodeling:develop Jul 8, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Refactor ABACUS codes The Absolute Zero Reduce the "entropy" of the code to 0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants