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 1 commit into from Apr 20, 2021


Copy link

@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.


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


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')
Copy link

@LordAro 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)

Copy link
Contributor Author

@glx22 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")
string(REGEX MATCH "^[0-9.]+" REV_SPLIT "${REV_VERSION}")
Copy link

@TrueBrain TrueBrain Apr 19, 2021

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

@glx22 glx22 Apr 19, 2021

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.

Copy link

@nielsmh 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 force-pushed the autofill_version_master branch from 263e350 to 13ba88c Apr 19, 2021
@glx22 glx22 merged commit d4f0b6f into OpenTTD:master Apr 20, 2021
12 checks passed
@glx22 glx22 deleted the autofill_version_master branch Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants