Enable support for custom versioning

Now that we're working on the 3.0.0 major release it is more important
than ever that fish binaries built by developers have version strings
which clearly communicate where they came from.
This commit is contained in:
Kurtis Rader 2017-08-15 12:21:43 -07:00
parent 4fbc2e4bdb
commit 3bef4a3c1f
2 changed files with 7 additions and 1 deletions

View file

@ -6,6 +6,10 @@ See the bottom of this document for help on installing the linting and style ref
Fish source should limit the C++ features it uses to those available in C++11. It should not use exceptions. Fish source should limit the C++ features it uses to those available in C++11. It should not use exceptions.
## Versioning
The fish version is constructed by the *build_tools/git_version_gen.sh* script. For developers the version is the branch name plus the output of `git describe --always --dirty --tags`. Normally the main part of the version will be the closest annotate tag. Which itself is usually the most recent release number (e.g., `2.6.0`). It can be useful to create a lightweight tag to make it clear that a fish binary is based on a particular development branch. For example, `git tag 3.0alpha` to make it clear that fish was built from the 3.x major release development branch regardless of the branch name.
## Include What You Use ## Include What You Use
You should not depend on symbols being visible to a `*.cpp` module from `#include` statements inside another header file. In other words if your module does `#include "common.h"` and that header does `#include "signal.h"` your module should not assume the sub-include is present. It should instead directly `#include "signal.h"` if it needs any symbol from that header. That makes the actual dependencies much clearer. It also makes it easy to modify the headers included by a specific header file without having to worry that will break any module (or header) that includes a particular header. You should not depend on symbols being visible to a `*.cpp` module from `#include` statements inside another header file. In other words if your module does `#include "common.h"` and that header does `#include "signal.h"` your module should not assume the sub-include is present. It should instead directly `#include "signal.h"` if it needs any symbol from that header. That makes the actual dependencies much clearer. It also makes it easy to modify the headers included by a specific header file without having to worry that will break any module (or header) that includes a particular header.
@ -132,6 +136,8 @@ code to ignore
// clang-format on // clang-format on
``` ```
However, as I write this there are no places in the code where we use this and I can't think of any legitimate reasons for exempting blocks of code from clang-format.
## Fish Script Style Guide ## Fish Script Style Guide
1. All fish scripts, such as those in the *share/functions* and *tests* directories, should be formatted using the `fish_indent` command. 1. All fish scripts, such as those in the *share/functions* and *tests* directories, should be formatted using the `fish_indent` command.

View file

@ -12,7 +12,7 @@ DEF_VER=unknown
if test -f version if test -f version
then then
VN=$(cat version) || VN="$DEF_VER" VN=$(cat version) || VN="$DEF_VER"
elif ! VN=$(git describe --always --dirty 2>/dev/null); then elif ! VN=$(git rev-parse --abbrev-ref HEAD)/$(git describe --always --dirty --tags 2>/dev/null); then
VN="$DEF_VER" VN="$DEF_VER"
fi fi