Skip to content
Open
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ endif
ifeq ($(shell uname -s),SunOS)
PG_CPPFLAGS += -Wno-sign-compare -D__EXTENSIONS__
endif
PG_CPPFLAGS += -DPG_CRON_VERSION=$(shell sed -r -n -e '1s/.* v([^ ]*) .*/\1/p' <CHANGELOG.md)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, lost track of this after the holidays.

I think the conventional method is to use something like git describe --tags --dirty --always, which returns the tag name, or the tag + commit hash, or tag + commit hash + "dirty". That way, it correctly shows whether you're running the v1.6.7 tag or something else.

Copy link
Author

Choose a reason for hiding this comment

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

Right, that works for developers who have checked out the git repository, but won't work for anyone who is building against the .tar.gz, like PGDG.
I think it's perhaps just as common for the version to just be written somewhere like a header (example oracle_fdw) or some other configuration file (example timescale) instead of taking it from the git tag.
My initial proposal had it in a .c file, but I'd be content with the version coming from any other file, really.

SHLIB_LINK = $(libpq)
EXTRA_CLEAN += $(addprefix src/,*.gcno *.gcda) # clean up after profiling runs

Expand Down
4 changes: 4 additions & 0 deletions src/pg_cron.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@
#include "utils/builtins.h"


#ifdef PG_MODULE_MAGIC_EXT
PG_MODULE_MAGIC_EXT(.name = "pg_cron", .version = PG_CRON_VERSION);
#else
PG_MODULE_MAGIC;
#endif

#ifndef MAXINT8LEN
#define MAXINT8LEN 20
Expand Down