Browse Source

Add DUK_GIT_DESCRIBE to the public C API

pull/85/head
Sami Vaarala 10 years ago
parent
commit
8dbee512bc
  1. 6
      src/duk_api_public.h.in
  2. 3
      util/make_dist.sh
  3. 6
      website/api/defines.html

6
src/duk_api_public.h.in

@ -83,6 +83,12 @@ struct duk_number_list_entry {
*/
#define DUK_VERSION 10099L
/* Git describe for Duktape build. Useful for non-official snapshot builds
* so that application code can easily log which Duktape snapshot was used.
* Not available in the Ecmascript environment.
*/
#define DUK_GIT_DESCRIBE @GIT_DESCRIBE_CSTRING@
/* Used to represent invalid index; if caller uses this without checking,
* this index will map to a non-existent stack entry. Also used in some
* API calls as a marker to denote "no value".

3
util/make_dist.sh

@ -43,7 +43,7 @@ DUK_MINOR=`echo "$DUK_VERSION % 10000 / 100" | bc`
DUK_PATCH=`echo "$DUK_VERSION % 100" | bc`
DUK_VERSION_FORMATTED=$DUK_MAJOR.$DUK_MINOR.$DUK_PATCH
GIT_COMMIT=`git rev-parse HEAD`
GIT_DESCRIBE=`git describe`
GIT_DESCRIBE=`git describe --always --dirty`
echo "DUK_VERSION: $DUK_VERSION"
echo "GIT_COMMIT: $GIT_COMMIT"
@ -373,6 +373,7 @@ cat src/duktape.h.in | sed -e '
-e "s/@DUK_VERSION_FORMATTED@/$DUK_VERSION_FORMATTED/" \
-e "s/@GIT_COMMIT@/$GIT_COMMIT/" \
-e "s/@GIT_DESCRIBE@/$GIT_DESCRIBE/" \
-e "s/@GIT_DESCRIBE_CSTRING@/\"$GIT_DESCRIBE\"/" \
> $DISTSRCCOM/duktape.h
# keep the line so line numbers match between the two variant headers

6
website/api/defines.html

@ -16,6 +16,12 @@ For example, version 1.2.3 would have <code>DUK_VERSION</code> and
actual release, e.g. 1199 for a 0.12.0 pre-release and 10299 for a 1.3.0
pre-release. See <a href="guide.html#versioning">Versioning</a>.</p>
<p>The <code>DUK_GIT_DESCRIBE</code> define provides a git describe string for
the Duktape build. For official releases this is just "v1.0.0" or similar,
but for snapshot builds it provides useful version information (e.g.
"v1.0.0-155-g5b7ef1f-dirty"). There is no equivalent of this define in the
Ecmascript environment.</p>
<h2>Structs and typedefs</h2>
<pre class="c-code">
typedef void duk_context;

Loading…
Cancel
Save