Skip to content

refactor(builder): Migrate VersionInfo to Builder Binary #396

@refcell

Description

@refcell

Summary

Warning

This work is blocked by #374.

Extract VersionInfo and version-related constants from the metrics module and relocate them to the op-rbuilder binary after #374 moves the op-rbuilder binary into the top-level bin/ directory.

Motivation

Version information is not inherently metrics-related. Moving it to the binary improves code organization and separation of concerns.

Current Location

Version info currently lives in crates/builder/op-rbuilder/src/metrics.rs:

// Lines 14-51: Version constants
pub const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
pub const VERGEN_GIT_SHA: &str = env!("VERGEN_GIT_SHA_SHORT");
pub const VERGEN_BUILD_TIMESTAMP: &str = env!("VERGEN_BUILD_TIMESTAMP");
pub const VERGEN_CARGO_TARGET_TRIPLE: &str = env!("VERGEN_CARGO_TARGET_TRIPLE");
pub const VERGEN_CARGO_FEATURES: &str = env!("VERGEN_CARGO_FEATURES");
pub const VERGEN_GIT_AUTHOR: &str = env!("VERGEN_GIT_COMMIT_AUTHOR");
pub const VERGEN_GIT_COMMIT_MESSAGE: &str = env!("VERGEN_GIT_COMMIT_MESSAGE");
pub const BUILD_PROFILE_NAME: &str = env!("OP_RBUILDER_BUILD_PROFILE");
pub const SHORT_VERSION: &str = env!("OP_RBUILDER_SHORT_VERSION");
pub const LONG_VERSION: &str = concat!(...);
// Lines 273-291: VersionInfo struct
pub struct VersionInfo {
    pub version: &'static str,
    pub build_timestamp: &'static str,
    pub cargo_features: &'static str,
    pub git_sha: &'static str,
    pub target_triple: &'static str,
    pub build_profile: &'static str,
    pub commit_author: &'static str,
    pub commit_message: &'static str,
}

Target Location

Move to a new version.rs module in bin/op-rbuilder/.

Tasks

  • Create version.rs in the binary directory
  • Move VersionInfo struct and constants
  • Update imports in metrics module to reference new location
  • Update register_version_metrics() to use imported VersionInfo

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-binArea: binary relatedA-builderArea: builder cratesK-cleanupKind: general cleanupM-good-first-issueMeta: Good for newcomers

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions