Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.075.0
v2.074.1
2 changes: 1 addition & 1 deletion src/ddmd/globals.d
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this line do the exact opposite of what the comment says?
In other places in the makefile ifneq (,$(RELEASE)) is used to check if this is a release is build.

Wouldn't it make sense to always try git describe to get the version number? It only returns the tag if the current HEAD is tagged.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ifneq (1,$(RELEASE)) and I don't want to remove with the ability to override VERSION for releases.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but going on the other use of RELEASE in the makefile it is 1 when building a release.
https://github.com/MartinNowak/dmd/blob/c28e2d8cfebfcc5b2fb8ee4b35bfb661314bc042/src/posix.mak#L178

So ifneq (1,$(RELEASE)) would indicate "Do this when not building a release", which doesn't match the comment. This would mean either the code or the comment is wrong.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says unless building a release == if not building a release, no problem here.

VERSION_GIT := $(shell printf "`$(GIT) describe --dirty`") # use git describe
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --dirty option is supported since 2009.
git/git@9f67d2e

ifneq (,$(VERSION_GIT)) # check for git failures
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CircleCi failure for Phobos stable branches are due to shell errors leading to direct abortion of the build process.
See also: https://www.gnu.org/software/make/manual/html_node/Errors.html

After each shell invocation returns, make looks at its exit status. If the shell completed successfully (the exit status is zero), the next line in the recipe is executed in a new shell; after the last line is finished, the rule is finished.
If there is an error (the exit status is nonzero), make gives up on the current rule, and perhaps on all rules.

It looks like this applies to shell invocations as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just try it, e.g. changing describe to describes, it continues to run.
Guess this only applies to shell invocations in make rules, but not top-level $(shell) calls.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just try it, e.g. changing describe to describes, it continues to run.

Did you nuke generated before trying this?
It doesn't work for me, because generating VERSION fails ...

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