Closed claremacrae closed 4 years ago
Before doing this, it would be worth looking at Catch2's release scripts, which are in Python and really nice and clean, for example:
https://github.com/catchorg/Catch2/blob/master/scripts/minorRelease.py
You don't have to even work out what the next version number will be. You just say "I'm doing a minor release" (or major, or patch) and it takes care of all the appropriate incrementation.
How about using CMake
to generate the version number?
https://cmake.org/cmake/help/latest/guide/tutorial/index.html#adding-a-version-number-and-configured-header-file
How about using
CMake
to generate the version number? https://cmake.org/cmake/help/latest/guide/tutorial/index.html#adding-a-version-number-and-configured-header-file
That's one possibility...
We'd still need to get the version number in to CMake in the first place, and this script updates the version number in various places: https://github.com/approvals/ApprovalTests.cpp/blob/master/build/build_hpp.sh
So also a possibility is to make build_hpp.sh
to edit in the version number directly...
Yeah. Probably makes more sense to go direct with build_hpp.sh
since there are several other things being modified.
This is now implemented, using these steps:
The generated code looks like this:
#ifndef APPROVALTESTS_CPP_APPROVALTESTSVERSION_H
#define APPROVALTESTS_CPP_APPROVALTESTSVERSION_H
#define APPROVALTESTS_VERSION_MAJOR 8
#define APPROVALTESTS_VERSION_MINOR 0
#define APPROVALTESTS_VERSION_PATCH 0
#define APPROVALTESTS_VERSION_STR "8.0.0"
#define APPROVALTESTS_VERSION \
(APPROVALTESTS_VERSION_MAJOR * 10000 + APPROVALTESTS_VERSION_MINOR * 100 + \
APPROVALTESTS_VERSION_PATCH)
#endif //APPROVALTESTS_CPP_APPROVALTESTSVERSION_H
In #37 it was really helpful to be able to write code that was able to detect the doctest version number, to be able to support more than one doctest version.
The relevant doctest code is:
Can we do the corresponding thing in Approval Tests too?
This would involve changing the release script, to set the values automatically.