Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include git commit ID in configuration summary #875

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

program--
Copy link
Contributor

This PR adds the repo's git commit ID to the CMake configuration summary output. This will also include it when calling ngen --info.

Example:

NGen version: 0.1.0
-- Build configuration summary:
--   Generator: Ninja
--   Build type: Debug
--   System: Linux
--   C Compiler: /usr/bin/clang
--   C Flags: -Wpessimizing-move
--   CXX Compiler: /usr/bin/clang++
--   CXX Flags: -Wpessimizing-move -pedantic-errors
--   Git Commit ID: 2ffedf8ecb3d6311be65d8c7c8f99c2fecf7ee07
--   Flags:
...

Additions

  • Adds NGEN_GIT_COMMIT CMake variable.

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

@program-- program-- added the build Issues related to CMake and building ngen label Aug 22, 2024
@PhilMiller
Copy link
Contributor

I see the print in configuration. How does it end up in ngen --info? Given that you show runtime output, with strings that don't exist in my repo, I'm guessing some code didn't get committed

@@ -2,6 +2,13 @@ find_package(Git QUIET)

if(EXISTS "${NGEN_ROOT_DIR}/.git")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not relevant to this PR, and really an edge case in general, but I think this condition may not work in the case of a git 'worktree', which just leaves some sort of link or reference in the working source directory to the actual repository.

@program--
Copy link
Contributor Author

program-- commented Aug 22, 2024

I see the print in configuration. How does it end up in ngen --info? Given that you show runtime output, with strings that don't exist in my repo, I'm guessing some code didn't get committed

The ngen_multiline_message and ngen_dependent_multiline_message CMake functions store their string arguments into a separate CMake variable NGEN_CONF_SUMMARY as a side effect. When NGenConfig.h is configured, that variable is outputted as a string here:

static constexpr const char* build_summary = R"(@NGEN_CONF_SUMMARY@)";

So for every ngen build, the exact build summary is embedded into it via that header

@PhilMiller
Copy link
Contributor

Ah, that was a depth of cleverness that I hadn't realized. Excellent.

@PhilMiller PhilMiller merged commit 1cb6e41 into NOAA-OWP:master Aug 22, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues related to CMake and building ngen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants