GithubHelp home page GithubHelp logo

gogitvers's Introduction

gogitvers

What is this?

A tool to extract version info from Git repo at build time

Freely inspired from https://github.com/jeromerg/NGitVersion but I wanted something that could be a standalone binary without any dependency, and easy to integrate in any build workflow, including the terrible MSVC++.

Go was the perfect language for that.

How does it work

Just run the gogitvers binary as part of you build script and it will generate a header file that you can include in your C/C++ project.

./gogitvers ../gpghelper > version.h

When a fatal error occurs (e.g. not a git repo), gogitvers will issue an #error statement. (exception: when cleanliness cannot be probed, just a //WARNING log is dropped). You can disable this behavior using -f option, no error will be issued but you will get unknown fields.

./gogitvers ../gpghelper -f > version.h

What will I get

Something like this:

/**
* gogitvers.h: file containing version identification constants
*
* THIS FILE HAS BEEN AUTOMATICALLY GENERATED, PLEASE DO NOT MODIFY
* Generated by gogitvers, visit https://github.com/thew44/gogitvers
* Mathieu ALLORY (c) 2020, Under MIT license.
*/

// Generated on: 2020-01-26 22:27:36.3642555 +0100 CET m=+0.010994101
// Source repository path: gpghelper/

#define GGVERS_HASH            "d45ee76b"
#define GVGERS_COMMIT_ID       8
#define GVGERS_ISDIRTY         0

#if defined(_DEBUG) || defined (QT_DEBUG)
# define GVGERS_DEBUG        1
# define GGVERS_FULL_VERSION    "Commit 8, Hash d45ee76b, State:Clean,DEBUG"
#else
# define GVGERS_DEBUG        0
# define GGVERS_FULL_VERSION    "Commit 8, Hash d45ee76b, State:Clean"
#endif

gogitvers's People

Contributors

thew44 avatar

Watchers

 avatar

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.