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

Refine CMake version handling based on tags #4381

Merged
merged 16 commits into from
Oct 5, 2023

Conversation

vintagepc
Copy link
Contributor

@vintagepc vintagepc commented Sep 9, 2023

  • Sets version information from git tags, if available. Otherwise, falls back to Configuration.h
  • Attempts to detect repository owner
  • add option ENFORCE_VERSION_MATCH to cause a failure if Configuration.h and the git tag do not match. Default: Off
  • Add option NO_TAG_IS_FATAL to cause an error if no git tag could be properly parsed Default: Off

@3d-gussner 3d-gussner added this to the FW 3.13.2 milestone Sep 11, 2023
@github-actions
Copy link

github-actions bot commented Sep 11, 2023

Target ΔFlash (bytes) ΔSRAM (bytes)
MK3S_MULTILANG 6 0
MK3_MULTILANG 6 0

Copy link
Collaborator

@3d-gussner 3d-gussner left a comment

Choose a reason for hiding this comment

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

To fix a download zip without a git clone we need to fix the CMake Error: Cannot parse SOURCE_DATE_EPOCH as **integer** error

     git_head_commit_timestamp(timestamp)
     set(ERRORS "GIT-NOTFOUND" "HEAD-FORMAT-NOTFOUND" "HEAD-HASH-NOTFOUND")
     if(timestamp IN_LIST ERRORS)
       # git not availibe, set fallback values
       set(timestamp 1456063320)
     endif()
     set(PROJECT_VERSION_TIMESTAMP

@vintagepc vintagepc marked this pull request as ready for review September 22, 2023 22:03
@vintagepc vintagepc changed the title 🚧 Refine CMake version handling based on tags Refine CMake version handling based on tags Sep 22, 2023
@sarusani
Copy link
Contributor

A lot of the hex files info is still based on configuration.h, even if git & tag is available.

configuration.h:

#define FW_MAJOR 3
#define FW_MINOR 13
#define FW_REVISION 0
#define FW_COMMITNR 6853
#define FW_FLAVOR RC
#define FW_FLAVERSION 1

git tag: v3.13.3
git commit nr: 7696
git sha-short: 363c53af6

The build info from cmake looks correct:

[build] -- Found a defined FW_FLAVOR
[build] -- Project version (Configuration.h): 3.13.0.25
[build] -- Project version suffix ..........: 363c53af6
[build] -- Project version description......: v3.13.3-7696
[build] -- Configuration.h and tag (not enforced): (3.13.0.25/3.13.3.64)
[build] -- Commit Nr: Configuration.h: 6853 Tag: 7696
[build] -- These tag values will override Configuration.h
[build] remote URL is https://github.com/sarusani/Prusa-Firmware.git
[build] Found repository name sarusani

But the generated hex file doesn't only use the git & tag info, it's a mixed result.

Filename: (uses configuration.h version)
FW3.13.0.25+363c53af6-MK3S_MULTILANG
Expected:
FW3.13.3.64+363c53af6-MK3S_MULTILANG

LCD ->Bootup Firmware Version: (uses configuration.h version)
3.13.0
Expected:
3.13.3

LCD ->Support: (uses git & tag info)
v3.13.3-7696
repo sarusani
Expected: (not sure about this, but the leading v from the tag was removed in other places, so maybe it should be also removed on this screen)
3.13.3-7696
repo sarusan

@vintagepc
Copy link
Contributor Author

Filenames are deliberately not yet supported due to further planned changes there.

The leading v is an oversight as it's part of the tag and the bootup version is probably doing something silly/different or is not properly inheriting its #includes, because the CMake #defines have the same names as those they override in Configuration.h 🤔

@vintagepc
Copy link
Contributor Author

Don't see anything obvious on the boot screen issue. It is using the same FW_VERSION macro every other place does that doesn't include the commit number 🤷

@sarusani
Copy link
Contributor

Sorry to be so annoying! 😄
Latest commit breaks build if FW_FLAVOR is not set in configuration.h.

@vintagepc
Copy link
Contributor Author

That's what I get for coding at late hours 😛

Copy link
Collaborator

@3d-gussner 3d-gussner left a comment

Choose a reason for hiding this comment

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

Fixing some minor issues in next PR

@3d-gussner 3d-gussner merged commit 9aca81d into prusa3d:MK3 Oct 5, 2023
5 checks passed
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.

3 participants