Giter VIP home page Giter VIP logo

Comments (5)

claremacrae avatar claremacrae commented on June 14, 2024

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.

from approvaltests.cpp.

dheater avatar dheater commented on June 14, 2024

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

from approvaltests.cpp.

claremacrae avatar claremacrae commented on June 14, 2024

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

from approvaltests.cpp.

dheater avatar dheater commented on June 14, 2024

Yeah. Probably makes more sense to go direct with build_hpp.sh since there are several other things being modified.

from approvaltests.cpp.

claremacrae avatar claremacrae commented on June 14, 2024

This is now implemented, using these steps:

  • ApprovalTests/ApprovalTestsVersion.h is machine-generated during each release, and contains the version number
  • That file is included during development in ApprovalTests/ApprovalTests.hpp
  • The header Blocker.h seems to always be include first in the single header, at least going back to v.3.3.0, so by including this new header in Blocker.h, we ensure that the information from this file will always appear at the top of the generated single-header file.

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

from approvaltests.cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.