LCOV - code coverage report
Current view: top level - include/esys/repo - buildinfo.h (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 0 1 0.0 %
Date: 2026-08-12 14:26:50 Functions: 0 0 -

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/buildinfo.h
       3             :  * \brief Embedded / reported build provenance for esysrepo CLI
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2026 Michel Gillet
       9             :  * Distributed under the MIT License.
      10             :  * (See accompanying file LICENSE.txt or
      11             :  * copy at https://opensource.org/licenses/MIT)
      12             :  *
      13             :  * __legal_e__
      14             :  * \endcond
      15             :  *
      16             :  */
      17             : 
      18             : #pragma once
      19             : 
      20             : #include "esys/repo/esysrepo_defs.h"
      21             : 
      22             : #include <string>
      23             : #include <vector>
      24             : 
      25             : namespace esys::repo
      26             : {
      27             : 
      28           0 : struct ESYSREPO_API BuildDependency
      29             : {
      30             :     std::string path;
      31             :     std::string name;
      32             :     std::string sha;
      33             :     std::string short_sha;
      34             :     std::string describe;
      35             :     bool present = false;
      36             : };
      37             : 
      38             : /*! \brief Process-wide bake-in build identity (ADR-0007).
      39             :  *
      40             :  * Populated at startup by generated ``esysrepo_register_embedded_build_info()``
      41             :  * when the static-exe build embeds provenance; otherwise left empty / defaults.
      42             :  */
      43             : class ESYSREPO_API BuildInfo
      44             : {
      45             : public:
      46             :     static BuildInfo &get();
      47             : 
      48             :     void clear();
      49             : 
      50             :     void set_embedded(bool embedded);
      51             :     bool get_embedded() const;
      52             : 
      53             :     void set_public_version(const std::string &version);
      54             :     const std::string &get_public_version() const;
      55             : 
      56             :     void set_product_version(const std::string &version);
      57             :     const std::string &get_product_version() const;
      58             : 
      59             :     void set_version4(const std::string &version4);
      60             :     const std::string &get_version4() const;
      61             : 
      62             :     void set_build_id(const std::string &build_id);
      63             :     const std::string &get_build_id() const;
      64             : 
      65             :     void set_git_sha(const std::string &sha);
      66             :     const std::string &get_git_sha() const;
      67             : 
      68             :     void set_git_short_sha(const std::string &sha);
      69             :     const std::string &get_git_short_sha() const;
      70             : 
      71             :     void set_git_ref(const std::string &ref);
      72             :     const std::string &get_git_ref() const;
      73             : 
      74             :     void set_git_tag(const std::string &tag);
      75             :     const std::string &get_git_tag() const;
      76             : 
      77             :     void set_pipeline_id(const std::string &id);
      78             :     const std::string &get_pipeline_id() const;
      79             : 
      80             :     void set_pipeline_iid(const std::string &iid);
      81             :     const std::string &get_pipeline_iid() const;
      82             : 
      83             :     void set_job_id(const std::string &id);
      84             :     const std::string &get_job_id() const;
      85             : 
      86             :     void set_build_date_utc(const std::string &date);
      87             :     const std::string &get_build_date_utc() const;
      88             : 
      89             :     void set_tagged(bool tagged);
      90             :     bool get_tagged() const;
      91             : 
      92             :     void add_dependency(const std::string &path, const std::string &name, const std::string &sha,
      93             :                         const std::string &short_sha, const std::string &describe, bool present);
      94             : 
      95             :     const std::vector<BuildDependency> &get_dependencies() const;
      96             : 
      97             :     //! Format multi-line text for ``esysrepo build-info``.
      98             :     std::string format_report() const;
      99             : 
     100             : private:
     101             :     bool m_embedded = false;
     102             :     bool m_tagged = false;
     103             :     std::string m_public_version;
     104             :     std::string m_product_version;
     105             :     std::string m_version4;
     106             :     std::string m_build_id;
     107             :     std::string m_git_sha;
     108             :     std::string m_git_short_sha;
     109             :     std::string m_git_ref;
     110             :     std::string m_git_tag;
     111             :     std::string m_pipeline_id;
     112             :     std::string m_pipeline_iid;
     113             :     std::string m_job_id;
     114             :     std::string m_build_date_utc;
     115             :     std::vector<BuildDependency> m_dependencies;
     116             : };
     117             : 
     118             : } // namespace esys::repo
     119             : 
     120             : //! Generated by scripts/generate_static_exe_build_info.py (stub provided otherwise).
     121             : extern void esysrepo_register_embedded_build_info();

Generated by: LCOV version 1.14