Skip to content

Commit

Permalink
Merge pull request #6935 from MartinNowak/git_describe
Browse files Browse the repository at this point in the history
use git describe for development versions
  • Loading branch information
WalterBright committed Jun 25, 2017
2 parents aaa0c1c + c28e2d8 commit 722b169
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.075.0
v2.074.1
2 changes: 1 addition & 1 deletion src/ddmd/globals.d
Expand Up @@ -335,7 +335,7 @@ struct Global
}
copyright = "Copyright (c) 1999-2017 by Digital Mars";
written = "written by Walter Bright";
_version = ('v' ~ import("VERSION") ~ '\0').ptr;
_version = (import("VERSION") ~ '\0').ptr;
compiler.vendor = "Digital Mars D";
stdmsg = stdout;
main_d = "__main.d";
Expand Down
27 changes: 11 additions & 16 deletions src/posix.mak
Expand Up @@ -466,25 +466,20 @@ $G/idgen: $D/idgen.d $(HOST_DMD_PATH)
CC=$(HOST_CXX) $(HOST_DMD_RUN) -of$@ $<
$G/idgen

#########
# STRING_IMPORT_FILES
#
# Create (or update) the generated VERSION file.
# The file is only updated if the VERSION file changes, or, only when RELEASE=1
# is not used, when the full version string changes (i.e. when the git hash or
# the working tree dirty states changes).
# The full version string have the form VERSION-devel-HASH(-dirty).
# The "-dirty" part is only present when the repository had uncommitted changes
# at the moment it was compiled (only files already tracked by git are taken
# into account, untracked files don't affect the dirty state).
VERSION := $(shell cat ../VERSION)
ifneq (1,$(RELEASE))
VERSION_GIT := $(shell printf "`$(GIT) rev-parse --short HEAD`"; \
test -n "`$(GIT) status --porcelain -uno`" && printf -- -dirty)
VERSION := $(addsuffix -devel$(if $(VERSION_GIT),-$(VERSION_GIT)),$(VERSION))
######## VERSION

VERSION := $(shell cat ../VERSION) # default to checked-in VERSION file
ifneq (1,$(RELEASE)) # unless building a release
VERSION_GIT := $(shell printf "`$(GIT) describe --dirty`") # use git describe
ifneq (,$(VERSION_GIT)) # check for git failures
VERSION := $(VERSION_GIT)
endif
endif

# only update $G/VERSION when it differs to avoid unnecessary rebuilds
$(shell test $(VERSION) != "`cat $G/VERSION 2> /dev/null`" \
&& printf $(VERSION) > $G/VERSION )

$(shell test $(SYSCONFDIR) != "`cat $G/SYSCONFDIR.imp 2> /dev/null`" \
&& printf '$(SYSCONFDIR)' > $G/SYSCONFDIR.imp )

Expand Down

0 comments on commit 722b169

Please sign in to comment.