Added script and command for dumping version and revision information. Also added define for enabling or disabling this until we have a windows script for updating hgversion.h.inc.
This commit is contained in:
parent
0dc83c6297
commit
a5e3944234
4
.hgignore
Normal file
4
.hgignore
Normal file
@ -0,0 +1,4 @@
|
||||
# use glob syntax.
|
||||
syntax: glob
|
||||
|
||||
src/zr/hgversion.h.inc
|
2
Makefile
2
Makefile
@ -2,6 +2,7 @@
|
||||
SOURCEDIR=src
|
||||
BUILDDIR=build
|
||||
SPCOMP=bin/spcomp
|
||||
VERSIONDUMP=./updateversion.sh
|
||||
|
||||
vpath %.sp $(SOURCEDIR)
|
||||
vpath %.inc $(SOURCEDIR)/include
|
||||
@ -24,6 +25,7 @@ prepare_builddir:
|
||||
@mkdir -p $(BUILDDIR)
|
||||
|
||||
%.smx: %.sp
|
||||
$(VERSIONDUMP)
|
||||
$(SPCOMP) -i$(SOURCEDIR) -i$(SOURCEDIR)/include -o$(BUILDDIR)/$@ $<
|
||||
|
||||
clean:
|
||||
|
@ -34,11 +34,24 @@
|
||||
|
||||
#define VERSION "3.0.0-b2-dev"
|
||||
|
||||
// Comment this line to exclude version info command. Temporary solution until
|
||||
// there is a windows script for updating hgversion.h.inc.
|
||||
#define ADD_VERSION_INFO 1
|
||||
|
||||
// Header includes.
|
||||
#include "zr/log.h"
|
||||
|
||||
#if defined ADD_VERSION_INFO
|
||||
#include "zr/hgversion.h"
|
||||
#endif
|
||||
|
||||
// Core includes.
|
||||
#include "zr/zombiereloaded"
|
||||
|
||||
#if defined ADD_VERSION_INFO
|
||||
#include "zr/versioninfo"
|
||||
#endif
|
||||
|
||||
#include "zr/translation"
|
||||
#include "zr/cvars"
|
||||
#include "zr/admintools"
|
||||
|
@ -46,6 +46,10 @@ CommandsInit()
|
||||
ZHPOnCommandsCreate();
|
||||
VolOnCommandsCreate();
|
||||
|
||||
#if defined ADD_VERSION_INFO
|
||||
VersionOnCommandsCreate();
|
||||
#endif
|
||||
|
||||
DebugOnCommandsCreate();
|
||||
|
||||
// Forward event to modules. (hook commands)
|
||||
|
@ -208,6 +208,10 @@ CvarsInit()
|
||||
Format(description, sizeof(description), "%s Current version of this plugin", TRANSLATION_PHRASE_PREFIX);
|
||||
CreateConVar("gs_zombiereloaded_version", VERSION, description, FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
|
||||
|
||||
#if defined ADD_VERSION_INFO
|
||||
CreateConVar("zombiereloaded_revision", ZR_VER_REVISION, "Revision number for this plugin in source code repository.", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
|
||||
#endif
|
||||
|
||||
// Forward event to modules.
|
||||
VEffectsOnCvarInit();
|
||||
}
|
||||
|
62
src/zr/versioninfo.inc
Normal file
62
src/zr/versioninfo.inc
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* ============================================================================
|
||||
*
|
||||
* Zombie:Reloaded
|
||||
*
|
||||
* File: version.inc
|
||||
* Description: Command for version information.
|
||||
*
|
||||
* Copyright (C) 2009 Greyscale, Richard Helgeby
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
VersionOnCommandsCreate()
|
||||
{
|
||||
RegConsoleCmd("zr_version", Command_Version, "Prints version info about this plugin.");
|
||||
}
|
||||
|
||||
public Action:Command_Version(client, argc)
|
||||
{
|
||||
decl String:buffer[512];
|
||||
decl String:linebuffer[128];
|
||||
buffer[0] = 0;
|
||||
linebuffer[0] = 0;
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "%s\n", ZR_VER_PRODUCT_NAME);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "%s\n\n", ZR_VER_COPYRIGHT);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "Version: %s\n", ZR_VER_VERSION);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "Development branch: %s\n", ZR_VER_BRANCH);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "Revision: %s\n", ZR_VER_REVISION);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "License: %s\n", ZR_VER_LICENSE);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
Format(linebuffer, sizeof(linebuffer), "Compile date: %s", ZR_VER_DATE);
|
||||
StrCat(buffer, sizeof(buffer), linebuffer);
|
||||
|
||||
ReplyToCommand(client, buffer);
|
||||
return Plugin_Handled;
|
||||
}
|
15
updateversion.sh
Executable file
15
updateversion.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#/bin/sh
|
||||
|
||||
ZR_VERSION_FILE="src/zr/hgversion.h.inc"
|
||||
|
||||
ZR_PRODUCT_NAME="Zombie:Reloaded"
|
||||
ZR_COPYRIGHT="Copyright (C) 2009 Greyscale, Richard Helgeby"
|
||||
ZR_LICENSE="GNU GPL, Version 3"
|
||||
|
||||
echo "#define ZR_VER_PRODUCT_NAME \"$ZR_PRODUCT_NAME\"" > $ZR_VERSION_FILE
|
||||
echo "#define ZR_VER_COPYRIGHT \"$ZR_COPYRIGHT\"" >> $ZR_VERSION_FILE
|
||||
echo "#define ZR_VER_VERSION VERSION" >> $ZR_VERSION_FILE
|
||||
echo "#define ZR_VER_BRANCH \"$(hg id -b)\"" >> $ZR_VERSION_FILE
|
||||
echo "#define ZR_VER_REVISION \"$(hg id -n):$(hg id -i)\"" >> $ZR_VERSION_FILE
|
||||
echo "#define ZR_VER_LICENSE \"$ZR_LICENSE\"" >> $ZR_VERSION_FILE
|
||||
echo "#define ZR_VER_DATE \"$(date)\"" >> $ZR_VERSION_FILE
|
Loading…
Reference in New Issue
Block a user