diff --git a/AMBuildScript b/AMBuildScript index b1c0ca0f..6ae3bdb9 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -11,9 +11,11 @@ class AMXXConfig(object): self.metamod_path = None self.hlsdk_path = None self.mysql_path = None + self.generated_headers = None def detectProductVersion(self): builder.AddConfigureFile('product.version') + builder.AddConfigureFile('.git/HEAD') # For OS X dylib versioning import re @@ -200,8 +202,12 @@ class AMXXConfig(object): cfg.defines += [ 'AMX_NOPROPLIST', 'PAWN_CELL_SIZE=32', + 'AMBUILD', ] + cfg.includes += [os.path.join(builder.buildPath, 'includes')] + return + # # Low-level compiler and binary construction. # @@ -236,7 +242,7 @@ class AMXXConfig(object): '-current_version', self.productVersion ] #binary.compiler.linkflags += [self.versionlib] - #binary.compiler.sourcedeps += SM.generated_headers + binary.compiler.sourcedeps += AMXX.generated_headers return binary def ModuleBuilder(self, context, compiler, name): @@ -262,7 +268,7 @@ class AMXXConfig(object): # 'RC_COMPILE', # ] # binary.compiler.linkflags += [self.versionlib] - # binary.compiler.sourcedeps += SM.generated_headers + binary.compiler.sourcedeps += AMXX.generated_headers return binary # @@ -303,6 +309,11 @@ AMXX.detectHlsdk() AMXX.detectMysql() AMXX.configure() +AMXX.generated_headers = builder.RunScript( + 'support/Versioning', + { 'AMXX': AMXX } +) + builder.RunBuildScripts( [ 'amxmodx/AMBuilder', diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index ab5617d0..78617190 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -39,7 +39,7 @@ #include "CFlagManager.h" #include "nongpl_matches.h" #include "format.h" -#include "svn_version.h" +#include extern CFlagManager FlagMan; CVector DynamicAdmins; diff --git a/amxmodx/amxxlog.cpp b/amxmodx/amxxlog.cpp index 9f469ca7..1e27bdc5 100755 --- a/amxmodx/amxxlog.cpp +++ b/amxmodx/amxxlog.cpp @@ -44,7 +44,7 @@ #define vsnprintf _vsnprintf #endif -#include "svn_version.h" +#include CLog::CLog() { diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index e67ed0d7..0e5e194c 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -50,7 +50,7 @@ #include "datastructs.h" #include "CFlagManager.h" -#include "svn_version.h" +#include #include "trie_natives.h" plugin_info_t Plugin_info = diff --git a/amxmodx/srvcmd.cpp b/amxmodx/srvcmd.cpp index 06ba94a9..018eaa5e 100755 --- a/amxmodx/srvcmd.cpp +++ b/amxmodx/srvcmd.cpp @@ -30,7 +30,7 @@ */ #include "amxmodx.h" -#include "svn_version.h" +#include void amx_command() { diff --git a/amxmodx/svn_version.tpl b/amxmodx/svn_version.tpl deleted file mode 100644 index 7ac5a99e..00000000 --- a/amxmodx/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -#define SVN_VERSION_STRING "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" -#define SVN_VERSION_DWORD $PMAJOR$,$PMINOR$,$PREVISION$,0 -#define SVN_VERSION_PRODUCT "$PMAJOR$.$PMINOR$.$PREVISION$" -#define SVN_BUILD_ID SVN_VERSION_STRING " $BUILD_ID$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/compiler/amxxpc/amxxpc.cpp b/compiler/amxxpc/amxxpc.cpp index f24572ff..a3784818 100755 --- a/compiler/amxxpc/amxxpc.cpp +++ b/compiler/amxxpc/amxxpc.cpp @@ -69,7 +69,7 @@ int main(int argc, char **argv) exit(0); } - pc_printf("Welcome to the AMX Mod X %s Compiler.\n", VERSION_STRING); + pc_printf("Welcome to the AMX Mod X %s Compiler.\n", SVN_VERSION); pc_printf("Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team\n\n"); if (argc < 2) diff --git a/compiler/amxxpc/amxxpc.h b/compiler/amxxpc/amxxpc.h index eb28e697..b601a8b3 100755 --- a/compiler/amxxpc/amxxpc.h +++ b/compiler/amxxpc/amxxpc.h @@ -1,7 +1,7 @@ #ifndef _AMXXSC_INCLUDE_H #define _AMXXSC_INCLUDE_H -#define VERSION_STRING "1.8.1-300" +#include #define MAGIC_HEADER2 0x414D5858 #define MAGIC_VERSION 0x0300 diff --git a/dlls/cstrike/cstrike/sdk/moduleconfig.h b/dlls/cstrike/cstrike/sdk/moduleconfig.h index 144e75e8..d3bf9a63 100755 --- a/dlls/cstrike/cstrike/sdk/moduleconfig.h +++ b/dlls/cstrike/cstrike/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "CStrike" diff --git a/dlls/cstrike/cstrike/svn_version.tpl b/dlls/cstrike/cstrike/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/cstrike/cstrike/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/cstrike/csx/sdk/moduleconfig.h b/dlls/cstrike/csx/sdk/moduleconfig.h index aed008dd..5c0cf65c 100755 --- a/dlls/cstrike/csx/sdk/moduleconfig.h +++ b/dlls/cstrike/csx/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "CSX" diff --git a/dlls/cstrike/csx/svn_version.tpl b/dlls/cstrike/csx/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/cstrike/csx/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/dod/dodfun/sdk/moduleconfig.h b/dlls/dod/dodfun/sdk/moduleconfig.h index e7877006..c65407f0 100755 --- a/dlls/dod/dodfun/sdk/moduleconfig.h +++ b/dlls/dod/dodfun/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "DoD Fun" diff --git a/dlls/dod/dodfun/svn_version.tpl b/dlls/dod/dodfun/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/dod/dodfun/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/dod/dodx/sdk/moduleconfig.h b/dlls/dod/dodx/sdk/moduleconfig.h index 6cf72b93..75d3c809 100755 --- a/dlls/dod/dodx/sdk/moduleconfig.h +++ b/dlls/dod/dodx/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "DoDX" diff --git a/dlls/dod/dodx/svn_version.tpl b/dlls/dod/dodx/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/dod/dodx/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/engine/sdk/moduleconfig.h b/dlls/engine/sdk/moduleconfig.h index f85da06a..b71dfce8 100755 --- a/dlls/engine/sdk/moduleconfig.h +++ b/dlls/engine/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "Engine" diff --git a/dlls/engine/svn_version.tpl b/dlls/engine/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/engine/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/fakemeta/sdk/moduleconfig.h b/dlls/fakemeta/sdk/moduleconfig.h index c42e1aa6..ea9804b9 100755 --- a/dlls/fakemeta/sdk/moduleconfig.h +++ b/dlls/fakemeta/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "FakeMeta" diff --git a/dlls/fakemeta/svn_version.tpl b/dlls/fakemeta/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/fakemeta/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/fun/sdk/moduleconfig.h b/dlls/fun/sdk/moduleconfig.h index 9f59f293..5c0883d1 100755 --- a/dlls/fun/sdk/moduleconfig.h +++ b/dlls/fun/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "Fun" diff --git a/dlls/fun/svn_version.tpl b/dlls/fun/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/fun/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/geoip/sdk/moduleconfig.h b/dlls/geoip/sdk/moduleconfig.h index dbb5bcc7..837e67a4 100755 --- a/dlls/geoip/sdk/moduleconfig.h +++ b/dlls/geoip/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "GeoIP" diff --git a/dlls/geoip/svn_version.tpl b/dlls/geoip/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/geoip/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/hamsandwich/sdk/moduleconfig.h b/dlls/hamsandwich/sdk/moduleconfig.h index 167cea64..05bc2b0a 100644 --- a/dlls/hamsandwich/sdk/moduleconfig.h +++ b/dlls/hamsandwich/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "../svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "Ham Sandwich" diff --git a/dlls/hamsandwich/svn_version.tpl b/dlls/hamsandwich/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/hamsandwich/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/mysqlx/sdk/moduleconfig.h b/dlls/mysqlx/sdk/moduleconfig.h index c76de407..460b3435 100755 --- a/dlls/mysqlx/sdk/moduleconfig.h +++ b/dlls/mysqlx/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif /** Module info * -The logtag is the tag that the module's log messages will be diff --git a/dlls/mysqlx/svn_version.tpl b/dlls/mysqlx/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/mysqlx/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/ns/sdk/moduleconfig.h b/dlls/ns/sdk/moduleconfig.h index d1c297b3..951bad32 100755 --- a/dlls/ns/sdk/moduleconfig.h +++ b/dlls/ns/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "../svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "NS" diff --git a/dlls/ns/svn_version.tpl b/dlls/ns/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/ns/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/nvault/sdk/moduleconfig.h b/dlls/nvault/sdk/moduleconfig.h index eef49b09..31d9818a 100755 --- a/dlls/nvault/sdk/moduleconfig.h +++ b/dlls/nvault/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "nVault" diff --git a/dlls/nvault/svn_version.tpl b/dlls/nvault/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/nvault/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/regex/sdk/moduleconfig.h b/dlls/regex/sdk/moduleconfig.h index 930aaa95..60bfca55 100755 --- a/dlls/regex/sdk/moduleconfig.h +++ b/dlls/regex/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "RegEx" diff --git a/dlls/regex/svn_version.tpl b/dlls/regex/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/regex/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/sockets/sdk/moduleconfig.h b/dlls/sockets/sdk/moduleconfig.h index df9a52ff..10c55440 100755 --- a/dlls/sockets/sdk/moduleconfig.h +++ b/dlls/sockets/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "Sockets" diff --git a/dlls/sockets/svn_version.tpl b/dlls/sockets/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/sockets/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/sqlite/sdk/moduleconfig.h b/dlls/sqlite/sdk/moduleconfig.h index 8285554b..9e9a2b45 100755 --- a/dlls/sqlite/sdk/moduleconfig.h +++ b/dlls/sqlite/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "SQLite" diff --git a/dlls/sqlite/svn_version.tpl b/dlls/sqlite/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/sqlite/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/tfcx/sdk/moduleconfig.h b/dlls/tfcx/sdk/moduleconfig.h index 6d01f64c..f4074df3 100755 --- a/dlls/tfcx/sdk/moduleconfig.h +++ b/dlls/tfcx/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "TfcX" diff --git a/dlls/tfcx/svn_version.tpl b/dlls/tfcx/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/tfcx/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/ts/tsfun/sdk/moduleconfig.h b/dlls/ts/tsfun/sdk/moduleconfig.h index 2add7899..cc1c5fb4 100755 --- a/dlls/ts/tsfun/sdk/moduleconfig.h +++ b/dlls/ts/tsfun/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "TSFun Wrapper" diff --git a/dlls/ts/tsfun/svn_version.tpl b/dlls/ts/tsfun/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/ts/tsfun/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/dlls/ts/tsx/sdk/moduleconfig.h b/dlls/ts/tsx/sdk/moduleconfig.h index 9ef1e09f..046c8ee2 100755 --- a/dlls/ts/tsx/sdk/moduleconfig.h +++ b/dlls/ts/tsx/sdk/moduleconfig.h @@ -3,7 +3,11 @@ #ifndef __MODULECONFIG_H__ #define __MODULECONFIG_H__ -#include "svn_version.h" +#if defined AMBUILD +# include +#else +# define SVN_VERSION "dev-local" +#endif // Module info #define MODULE_NAME "TSX" diff --git a/dlls/ts/tsx/svn_version.tpl b/dlls/ts/tsx/svn_version.tpl deleted file mode 100644 index 7af4e530..00000000 --- a/dlls/ts/tsx/svn_version.tpl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _INCLUDE_SVN_VERSION_H_ -#define _INCLUDE_SVN_VERSION_H_ - -/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ -/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */ - -#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" - -#endif //_INCLUDE_SVN_VERSION_H_ diff --git a/plugins/AMBuilder b/plugins/AMBuilder index 6e331bd0..059f7991 100644 --- a/plugins/AMBuilder +++ b/plugins/AMBuilder @@ -89,7 +89,8 @@ def build_plugin(script_path, amxx_file, extra_argv = []): inputs = inputs, argv = argv, outputs = outputs, - dep_type = 'msvc' + dep_type = 'msvc', + weak_inputs = AMXX.generated_headers ) AMXX.plugins[amxx_file] = amx_entry diff --git a/plugins/include/svn_version.inc b/plugins/include/svn_version.inc index 2701890f..d609cebc 100644 --- a/plugins/include/svn_version.inc +++ b/plugins/include/svn_version.inc @@ -11,6 +11,9 @@ #endif #define _svnversion_included -#define AMXX_VERSION 1.82 -#define AMXX_VERSION_NUM 182 -stock const AMXX_VERSION_STR[] = "1.8.2"; +#tryinclude +#if !defined _amxmodx_version_included + #define AMXX_VERSION 1.83 + #define AMXX_VERSION_NUM 183 + stock const AMXX_VERSION_STR[] = "1.8.3-dev"; +#endif diff --git a/plugins/include/svn_version.tpl b/plugins/include/svn_version.tpl deleted file mode 100644 index db49387a..00000000 --- a/plugins/include/svn_version.tpl +++ /dev/null @@ -1,16 +0,0 @@ -/* AMX Mod X constants -* -* by the AMX Mod X Development Team -* originally developed by OLO -* -* This file is provided as is (no warranties). -*/ - -#if defined _svnversion_included - #endinput -#endif -#define _svnversion_included - -#define AMXX_VERSION $PMAJOR$.$PMINOR$$PREVISION$ -#define AMXX_VERSION_NUM $PMAJOR$$PMINOR$$PREVISION$ -stock const AMXX_VERSION_STR[] = "$PMAJOR$.$PMINOR$.$PREVISION$"; diff --git a/support/PackageScript b/support/PackageScript index f25cc3a5..b166af8e 100644 --- a/support/PackageScript +++ b/support/PackageScript @@ -117,6 +117,12 @@ for amxx_file in AMXX.plugins: ) builder.AddCopy(source_file, folder_map[package + '/addons/amxmodx/scripting']) +# Copy the generated version .inc. +for generated_header in AMXX.generated_headers: + if 'inc' in generated_header.path: + builder.AddCopy(generated_header, folder_map['base/addons/amxmodx/scripting/include']) + break + # Copy configuration files for each mod. configs = [ 'amxx.cfg', diff --git a/support/Versioning b/support/Versioning new file mode 100644 index 00000000..ea01a5df --- /dev/null +++ b/support/Versioning @@ -0,0 +1,41 @@ +# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python: +import os, sys + +builder.SetBuildFolder('/') + +includes = builder.AddFolder('includes') + +argv = [ + sys.executable, + os.path.join(builder.sourcePath, 'support', 'generate_headers.py'), + os.path.join(builder.sourcePath), + os.path.join(builder.buildPath, 'includes'), +] +outputs = [ + os.path.join(builder.buildFolder, 'includes', 'amxmodx_version.h'), + os.path.join(builder.buildFolder, 'includes', 'amxmodx_version.inc'), +] + +with open(os.path.join(builder.sourcePath, '.git', 'HEAD')) as fp: + git_state = fp.read().strip().split(':')[1].strip() + +git_head_path = os.path.join(builder.sourcePath, '.git', git_state) +if not os.path.exists(git_head_path): + git_head_path = os.path.join(builder.sourcePath, '.git', 'HEAD') + +sources = [ + os.path.join(builder.sourcePath, 'product.version'), + + # This is a hack, but we need some way to only run this script when HG changes. + git_head_path, + + # The script source is a dependency, of course... + argv[1] +] +cmd_node, output_nodes = builder.AddCommand( + inputs = sources, + argv = argv, + outputs = outputs +) + +rvalue = output_nodes diff --git a/support/generate_headers.py b/support/generate_headers.py new file mode 100644 index 00000000..c0c5b448 --- /dev/null +++ b/support/generate_headers.py @@ -0,0 +1,106 @@ +# vim: set ts=8 sts=2 sw=2 tw=99 et: +import re +import os, sys +import subprocess + +argv = sys.argv[1:] +if len(argv) < 2: + sys.stderr.write('Usage: generate_headers.py \n') + sys.exit(1) + +SourceFolder = os.path.abspath(os.path.normpath(argv[0])) +OutputFolder = os.path.normpath(argv[1]) + +class FolderChanger: + def __init__(self, folder): + self.old = os.getcwd() + self.new = folder + + def __enter__(self): + if self.new: + os.chdir(self.new) + + def __exit__(self, type, value, traceback): + os.chdir(self.old) + +def run_and_return(argv): + # Python 2.6 doesn't have check_output. + if hasattr(subprocess, 'check_output'): + text = subprocess.check_output(argv) + if str != bytes: + text = str(text, 'utf-8') + else: + p = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output, ignored = p.communicate() + rval = p.poll() + if rval: + raise subprocess.CalledProcessError(rval, argv) + text = output.decode('utf8') + return text.strip() + +def get_git_version(): + revision_count = run_and_return(['git', 'rev-list', '--count', 'HEAD']) + revision_hash = run_and_return(['git', 'log', '--pretty=format:%h:%H', '-n', '1']) + shorthash, longhash = revision_hash.split(':') + + return revision_count, shorthash, longhash + +def output_version_headers(): + with FolderChanger(SourceFolder): + count, shorthash, longhash = get_git_version() + + with open(os.path.join(SourceFolder, 'product.version')) as fp: + contents = fp.read() + m = re.match('(\d+)\.(\d+)\.(\d+)-?(.*)', contents) + if m == None: + raise Exception('Could not detremine product version') + major, minor, release, tag = m.groups() + product = "{0}.{1}.{2}".format(major, minor, release) + fullstring = product + if tag != "": + fullstring += "-{0}".format(tag) + if tag == "dev": + fullstring += "+{0}".format(shorthash) + + with open(os.path.join(OutputFolder, 'amxmodx_version.h'), 'w') as fp: + fp.write(""" +#ifndef _AMXMODX_AUTO_VERSION_INFORMATION_H_ +#define _AMXMODX_AUTO_VERSION_INFORMATION_H_ + +#define SVN_VERSION_STRING "{fullstring}" +#define SVN_VERSION_DWORD {major}, {minor}, {release}, 0 +#define SVN_VERSION_PRODUCT "{product}" +#define SVN_VERSION SVN_VERSION_STRING +#define SVN_BUILD_ID "{count}:{longhash}" + +#endif // _AMXMODX_AUTO_VERSION_INFORMATION_H_ + """.format( + fullstring = fullstring, + major = major, + minor = minor, + release = release, + product = product, + count = count, + longhash = longhash + )) + + version_num = int(major) * 100 + int(minor) * 10 + int(release) + with open(os.path.join(OutputFolder, 'amxmodx_version.inc'), 'w') as fp: + fp.write(""" +#if defined _amxmodx_version_included + #endinput +#endif +#define _amxmodx_version_included + +#define AMXX_VERSION {major}.{minor}{release} +#define AMXX_VERSION_NUM {version_num} +stock const AMXX_VERSION_STR[] = "{fullstring}"; + """.format( + major = major, + minor = minor, + release = release, + version_num = version_num, + fullstring = fullstring + )) + +output_version_headers()