Skip to content

CMake-ify git2nrnversion_h.sh, remove nrnversion.sh #3473

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

JCGoran
Copy link
Collaborator

@JCGoran JCGoran commented Jun 6, 2025

Some facts:

  • the only purpose of git2nrnversion_h.sh is to write nrnversion.h
  • nrnversion.h contains only macros, which are only visible to the preprocessor
  • nrnversion.h is only included in nrnversion.cpp, which is part of the nrniv_lib target

Therefore, we can just add the macros from nrnversion.h directly to the nrniv_lib target as compile definitions, without having to write the nrnversion.h file in the first place.

Additionally, the bldnrnmacpkg.sh uses nrnversion.sh, whose sole purpose is to read the nrnversion.h file (via some sed magic). On the other hand, we can just use git describe to get the latest tag in the history (on release/8.2, this outputs 8.2.7, which is exactly the name of the MacOS package (see here)), so nrnversion.sh is not needed either.

Copy link
Contributor

github-actions bot commented Jun 6, 2025

✔️ 734e9c3 -> artifacts URL

@nrnhines
Copy link
Member

nrnhines commented Jun 6, 2025

There are circumstances where git describe does not work. E.g. Shallow clone that does not have the latest tag. Also, I'm never certain about the value of our full nrn-full-src-package.xxx.tar.gz . I guess in both those cases cmake gets the version from the top level CMakeLists.txt project ... VERSION

Copy link
Contributor

github-actions bot commented Jun 6, 2025

✔️ f897dd2 -> artifacts URL

Copy link

✔️ f897dd2 -> Azure artifacts URL

@JCGoran
Copy link
Collaborator Author

JCGoran commented Jun 6, 2025

Shallow clone that does not have the latest tag.

There is the git rev-parse --is-shallow-repository command since git 2.15 (source), so I guess a check can be added to bldnrnmacpkg.sh before running.

Also, I'm never certain about the value of our full nrn-full-src-package.xxx.tar.gz

Should be nrn-full-src-package-${{ needs.tag-n-release.outputs.rel_tag }}.tar.gz, i.e. we set it manually when running the workflow. Note that this contains the sources only, not the MacOS pkg installer, which we build manually.

I guess in both those cases cmake gets the version from the top level CMakeLists.txt

It should get it from the call to project, followed by whatever cmake/CheckGitDescribeCompatibility.cmake does. Note that it doesn't use any of the files I remove in this PR.

Copy link

codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.39%. Comparing base (d15c919) to head (2dc51fe).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3473      +/-   ##
==========================================
- Coverage   68.43%   68.39%   -0.04%     
==========================================
  Files         682      682              
  Lines      116548   116548              
==========================================
- Hits        79757    79716      -41     
- Misses      36791    36832      +41     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

sonarqubecloud bot commented Jun 7, 2025

Copy link
Contributor

github-actions bot commented Jun 7, 2025

✔️ 2dc51fe -> artifacts URL

Copy link

✔️ 2dc51fe -> Azure artifacts URL

@JCGoran JCGoran marked this pull request as ready for review June 7, 2025 10:33
@JCGoran JCGoran requested a review from nrnhines June 7, 2025 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants