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

Fix: Auto-fill version details in rev.cpp and ottres.rc #9066

Merged
merged 1 commit into from Apr 20, 2021

Conversation

glx22
Copy link
Contributor

@glx22 glx22 commented Apr 19, 2021

Fixes #9062.
Version for release/1.11 branch here

Motivation / Problem

Version numbers are hard coded in many files, meaning we always forget to update some of them.

Description

Auto detect and fill version numbers, there's still a hard coded default value but in only one location.

Limitations

Only done rev.cpp and Windows specific file for now.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@glx22 glx22 added the backport requested This PR should be backport to current release (RC / stable) label Apr 19, 2021
@LordAro
Copy link
Member

LordAro commented Apr 19, 2021

Why not use the "builtin" variables - CPACK_PACKAGE_VERSION_MAJOR/MINOR/PATCH ? (Which then get combined into CPACK_PACKAGE_VERSION)

@glx22
Copy link
Contributor Author

glx22 commented Apr 19, 2021

CPACK stuff is for the installer only, not the build itself, and cpack relies on whatever FindVersion.cmake detected. Also FindVersion.cmake generates the files before CPACK variables are set.

@@ -124,6 +124,19 @@ if(GENERATE_OTTDREV)
message(STATUS "Generating .ottdrev")
file(WRITE ${CMAKE_SOURCE_DIR}/.ottdrev "${REV_VERSION}\t${REV_ISODATE}\t${REV_MODIFIED}\t${REV_HASH}\t${REV_ISTAG}\t${REV_ISSTABLETAG}\t${REV_YEAR}\n")
else()
string(REGEX MATCH "^[0-9.]+" REV_SPLIT "${REV_VERSION}")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe use REV_ISSTABLETAG here to know if the version is expected to be a stable tag? No clue if that is easy to do :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could work, beta and RC would then default to hard coded version, which should not be an issue.

@nielsmh
Copy link
Contributor

nielsmh commented Apr 19, 2021

While touching this, I'd suggest maybe putting the branch name into the SpecialBuild version property when not building a tagged release version.

@glx22 glx22 merged commit d4f0b6f into OpenTTD:master Apr 20, 2021
@glx22 glx22 deleted the autofill_version_master branch April 20, 2021 19:38
@LordAro LordAro added backported This PR is backported to a current release (RC / stable) and removed backport requested This PR should be backport to current release (RC / stable) labels May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported This PR is backported to a current release (RC / stable)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"File version" is incorrect for Windows OpenTTD executable
4 participants