Skip to content

Refactor Slice 3B: Move build logic into CIME/core/build/ #4999

Description

@jasonb5

Part of #4950. Slice 3B of 5. Estimated 5 weeks. Depends on #4998.

Goal

Move build logic from build.py (1350 lines) into focused modules under
CIME/core/build/. Keep CIME/build_scripts/ as the stable external wrapper.

Tasks

Extract into CIME/core/build/

  • Build planning logic.
  • Build execution / orchestration.
  • build.py becomes a thin re-export layer.

Move from utils.py

  • analyze_build_log, run_bld_cmd_ensure_logging,
    copy_local_macros_to_dircore/build/.
  • safe_copy, safe_recursive_copy, symlink_force, copy_globs,
    copy_over_file, copyifnewerCIME/core/fileops.py (build is heavy
    consumer, pulled here).

Consolidation — free functions taking case

  • case_build(), clean(), _clean_impl(), post_build() (build.py)
    currently access case._gitinterface (private!), call case.get_value,
    case.set_value, case.flush(). Make them Case methods that delegate
    to core/build/.
  • get_standard_cmake_args(), get_standard_makefile_args(),
    uses_kokkos() (build.py) extract ~15 values from Case.
    Consolidate as Case methods or a BuildConfig data class.
  • generate_makefile_macro() (build.py) calls case.get_value()
    same pattern.

Deduplicate copy functions

  • Four overlapping copy functions in utils.py (safe_copy,
    copy_over_file, copyifnewer, copy_globs) → coherent
    CIME/core/fileops.py API.

Sharedlibs (resolves #4837)

  • Sharedlibs list currently hard-coded; expose as configurable.

Imports & re-exports

  • Update internal CIME imports to core/build/.
  • Keep re-exports in build.py and utils.py.
  • CIME/build_scripts/ unchanged — stable external interface.

Definition of done

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions