Git-based versioning.

This commit is contained in:
gigaherz 2014-03-23 15:44:43 +01:00
parent 30d5135fdd
commit f7c1b6e060
23 changed files with 70 additions and 164 deletions

View File

@ -442,7 +442,7 @@ typedef struct _PS2E_VersionInfo
// Revision typically refers a revision control system (such as SVN). When displayed
// by the emulator it will have an 'r' prefixed before it.
s32 Revision;
s64 Revision;
} PS2E_VersionInfo;

View File

@ -1,50 +0,0 @@
::@echo off
::
:: Usage: postBuild.cmd SourcePath DestFile DestExt {plugins}
::
:: SourcePath - $(TargetPath) - Fully qualified path of the generated target file.
:: DestFile - Base filename of the target/dest, without extension!
:: DestExt - Extension of the target/dest!
:: plugins - optional parameter used to generate plugins into the /plugins folder
::
:: The destination file is determined by the PCSX2_TARGET_DIR environment var.
SETLOCAL ENABLEEXTENSIONS
if defined PCSX2_TARGET_COPY CALL :TestAndCopy "%PCSX2_TARGET_COPY%" %1 %2 %3 %4
ENDLOCAL
exit 0
:TestAndCopy
:: Subroutine. First parameter is our Target Dir. Since it's a parameter into
:: the subroutine, we can use tilda expansion to handle quotes correctly. :)
if NOT EXIST "%~1" (
md "%~1"
)
:: Error checking. Try to change to the dir. If it fails, it means the dir is
:: actually a file, and we should cancel the script.
set mycwd="%CD%"
cd "%~1"
if %ERRORLEVEL% NEQ 0 goto :eof
cd %mycwd%
set pcsxoutdir=%~1\%~5
set pcsxoutname=%pcsxoutdir%\%~3%4
set pcsxnewname=%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4
IF NOT EXIST "%pcsxoutdir%" (
md "%pcsxoutdir%"
)
copy /Y "%~2" "%pcsxoutname%"
copy /Y "%~2" "%pcsxnewname%"
if %ERRORLEVEL% EQU 0 (
echo Target copied to %pcsxnewname%
)
goto :eof
:quit

View File

@ -14,6 +14,7 @@ if defined PCSX2_TARGET_COPY CALL :TestAndCopy "%PCSX2_TARGET_COPY%" %1 %2 %3 %4
ENDLOCAL
exit 0
if exists postBuild.inc.cmd call postBuild.inc.cmd
:TestAndCopy
:: Subroutine. First parameter is our Target Dir. Since it's a parameter into

View File

@ -1,5 +1,12 @@
@echo off
::@echo off
:: This file GENERATES the automatic GIT revision/version tag.
:: It uses the git.exe program to create an "svnrev.h" file for whichever
:: project is being compiled, during the project's pre-build step.
::
:: The git.exe program is part of the msysgit installation.
::
:: MsysGit can be downloaded from http://msysgit.github.io/
::
:: Usage: preBuild.cmd ProjectSrcDir VspropsDir
::
:: ProjectSrcDir - $(ProjectDir)\.. - Top-level Directory of project source code.
@ -7,16 +14,40 @@
SETLOCAL ENABLEEXTENSIONS
set mydir=%~dp0
SubWCRev.exe "%~1" "%mydir%\svnrev_template.h" "%CD%\svnrev.h"
if %ERRORLEVEL% NEQ 0 (
echo Automatic revision update unavailable, using generic template instead.
echo You can safely ignore this message - see svnrev.h for details.
copy /Y "%mydir%\svnrev_unknown.h" "%CD%\svnrev.h"
copy /Y "%mydir%\postBuild.unknown" "%CD%\postBuild.cmd"
) else (
SubWCRev.exe "%~1" "%mydir%\postBuild.tmpl" "%CD%\postBuild.cmd" > NUL
IF "%PROGRAMFILES(x86)%" == "" do (
set PROGRAMFILES(x86)=%PROGRAMFILES%
)
set PATH=%PATH%;"%PROGRAMFILES(x86)%\Git\bin"
FOR /F "delims=+" %%i IN ('"git show -s --format=%%%ci HEAD"') do (
set REV3=%%i
)
set REV2=%REV3: =%
set REV1=%REV2:-=%
set REV=%REV1::=%
if %ERRORLEVEL% NEQ 0 (
echo Automatic version detection unavailable.
echo If you want to have the version string print correctly,
echo make sure your Git.exe is in the default installation directory,
echo or in your PATH.
echo You can safely ignore this message - a dummy string will be printed.
echo #define SVN_REV_UNKNOWN > "%CD%\svnrev.h"
echo #define SVN_REV 0 >> "%CD%\svnrev.h"
echo #define SVN_MODS 0 >> "%CD%\svnrev.h"
echo set SVN_REV=0 > "%CD%\postBuild.inc.cmd"
) else (
echo #define SVN_REV %REV% > "%CD%\svnrev.h"
echo #define SVN_MODS 0 /* Not implemented at the moment. */ >> "%CD%\svnrev.h"
echo set SVN_REV=%REV% > "%CD%\postBuild.inc.cmd"
)
copy /Y "%mydir%\postBuild.unknown" "%CD%\postBuild.cmd"
ENDLOCAL
:: Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed.
exit 0
exit /B 0

View File

@ -1,33 +0,0 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2010 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 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 PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
// svnrev_template.h --> svnrev.h
//
// This file acts as a template for the automatic SVN revision/version tag.
// It is used by the utility SubWCrev.exe to create an "svnrev.h" file for
// whichever project is being compiled (as indicated by command line options
// passed to SubWCRev.exe during the project's pre-build step).
//
// The SubWCRev.exe utility is part of TortoiseSVN and requires several DLLs
// installed by TortoiseSVN, so it will only be available if you have TortoiseSVN
// installed on your system. If you do not have it installed, a generic template
// is used instead (see svnrev_generic.h). Having TortoiseSVN is handy but not
// necessary. If you do not have it installed, everything will still compile
// fine except without the SVN revision tagged to the application/dll version.
//
// TortoiseSVN can be downloaded from http://tortoisesvn.tigris.org
#define SVN_REV $WCREV$
#define SVN_MODS $WCMODS?1:0$

View File

@ -1,39 +0,0 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2010 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 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 PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
// svnrev_genric.h --> svnrev.h
//
// This file acts as a placebo for people who do not have TortoiseSVN installed.
// It provides "empty" revision information to the Pcsx2 Playground projects in
// the absence of real revisions derived from the repository being built.
//
// This file does not affect application/dll builds in any significant manner,
// other than the lack of automatic revision tags inserted into the app (which
// is very convenient but hardly necessary).
//
// See svn_template.h for more information on how the process of revision
// templating works.
//
// If you would like to enable automatic revisin tagging, TortoiseSVN can be
// downloaded from http://tortoisesvn.tigris.org
#define SVN_REV_UNKNOWN
// The following defines are included so that code will still compile even if it
// doesn't check for the SVN_REV_UNKNOWN define.
#define SVN_REV 0
#define SVN_MODS 0

View File

@ -194,13 +194,13 @@ void SysLogMachineCaps()
{
if ( !PCSX2_isReleaseVersion )
{
Console.WriteLn(Color_StrongGreen, "PCSX2 %u.%u.%u.r%d %s - compiled on " __DATE__,
Console.WriteLn(Color_StrongGreen, "PCSX2 %u.%u.%u-%lld %s - compiled on " __DATE__,
PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
SVN_REV, SVN_MODS ? "(modded)" : ""
);
}
else { // shorter release version string
Console.WriteLn(Color_StrongGreen, "PCSX2 %u.%u.%u.r%d - compiled on " __DATE__,
Console.WriteLn(Color_StrongGreen, "PCSX2 %u.%u.%u-%lld - compiled on " __DATE__,
PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
SVN_REV );
}

View File

@ -357,7 +357,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
else
{
// beta / development editions, which feature revision number and compile date.
wintitle.Printf( _("%s %d.%d.%d.%d%s (svn) %s"), pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
wintitle.Printf( _("%s %d.%d.%d-%lld%s (git) %s"), pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
SVN_REV, SVN_MODS ? L"m" : wxEmptyString, fromUTF8(__DATE__).c_str() );
}

View File

@ -29,7 +29,7 @@ const unsigned char build = 6;
EXPORT_C_(char*) PS2EgetLibName()
{
snprintf( libraryName, 255, "CDVDnull Driver r%d%s",SVN_REV, SVN_MODS ? "m" : "");
snprintf( libraryName, 255, "CDVDnull Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
return libraryName;
}

View File

@ -66,7 +66,7 @@ EXPORT_C_(u32) PS2EgetLibType()
EXPORT_C_(char*) PS2EgetLibName()
{
snprintf( libraryName, 255, "FWnull Driver r%d%s",SVN_REV, SVN_MODS ? "m" : "");
snprintf( libraryName, 255, "FWnull Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
return libraryName;
}

View File

@ -42,7 +42,7 @@ const char* GSUtil::GetLibName()
str = "GSdx";
#ifdef _WINDOWS
str += format(" %d", SVN_REV);
str += format(" %lld", SVN_REV);
if(SVN_MODS) str += "m";
#endif

View File

@ -64,7 +64,7 @@ EXPORT_C_(u32) PS2EgetLibType()
EXPORT_C_(char*) PS2EgetLibName()
{
#ifdef _MSC_VER
sprintf_s( libraryName, "GSnull Driver r%d%s",SVN_REV, SVN_MODS ? "m" : "");
sprintf_s( libraryName, "GSnull Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
return libraryName;
#else
return "GSnull Driver";

View File

@ -655,11 +655,11 @@ u32 CALLBACK PS2EgetLibVersion2(u32 type) {
// Used in about and config screens.
void GetNameAndVersionString(wchar_t *out) {
#ifdef NO_CRT
wsprintfW(out, L"LilyPad %i.%i.%i", (VERSION>>8)&0xFF, VERSION&0xFF, (VERSION>>24)&0xFF, SVN_REV);
wsprintfW(out, L"LilyPad %i.%i.%i", (VERSION>>8)&0xFF, VERSION&0xFF, (VERSION>>24)&0xFF);
#elif defined(PCSX2_DEBUG)
wsprintfW(out, L"LilyPad Debug %i.%i.%i (r%i)", (VERSION>>8)&0xFF, VERSION&0xFF, (VERSION>>24)&0xFF, SVN_REV);
wsprintfW(out, L"LilyPad Debug %i.%i.%i (%lld)", (VERSION>>8)&0xFF, VERSION&0xFF, (VERSION>>24)&0xFF, SVN_REV);
#else
wsprintfW(out, L"LilyPad svn %i.%i.%i (r%i)", (VERSION>>8)&0xFF, VERSION&0xFF, (VERSION>>24)&0xFF, SVN_REV);
wsprintfW(out, L"LilyPad %i.%i.%i (%lld)", (VERSION>>8)&0xFF, VERSION&0xFF, (VERSION>>24)&0xFF, SVN_REV);
#endif
}
@ -668,11 +668,11 @@ char* CALLBACK PSEgetLibName() {
return "LilyPad";
#elif defined(PCSX2_DEBUG)
static char version[50];
sprintf(version, "LilyPad Debug (r%i)", SVN_REV);
sprintf(version, "LilyPad Debug (%lld)", SVN_REV);
return version;
#else
static char version[50];
sprintf(version, "LilyPad svn (r%i)", SVN_REV);
sprintf(version, "LilyPad (%lld)", SVN_REV);
return version;
#endif
}

View File

@ -44,7 +44,7 @@ EXPORT_C_(u32) PS2EgetLibType()
EXPORT_C_(char*) PS2EgetLibName()
{
snprintf( libraryName, 255, "Padnull Driver r%d%s",SVN_REV, SVN_MODS ? "m" : "");
snprintf( libraryName, 255, "Padnull Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
return libraryName;
}

View File

@ -710,7 +710,7 @@ static void InitLibraryName()
// Use TortoiseSVN's SubWCRev utility's output
// to label the specific revision:
sprintf_s( LibraryName, SSSPSX_NAME " r%d%s"
sprintf_s( LibraryName, SSSPSX_NAME " %lld%s"
#ifdef PCSX2_DEBUG
"-Debug"
#elif defined( PCSX2_DEVBUILD )
@ -718,8 +718,7 @@ static void InitLibraryName()
#else
""
#endif
,SVN_REV,
SVN_MODS ? "m" : ""
,SVN_REV,SVN_MODS ? "m" : ""
);
#endif
#endif

View File

@ -60,7 +60,7 @@ EXPORT_C_(u32) PS2EgetLibType()
EXPORT_C_(char*) PS2EgetLibName()
{
snprintf( libraryName, 255, "USBnull Driver r%d%s",SVN_REV, SVN_MODS ? "m" : "");
snprintf( libraryName, 255, "USBnull Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
return libraryName;
}

View File

@ -92,7 +92,7 @@ static void InitLibraryName()
// Use TortoiseSVN's SubWCRev utility's output
// to label the specific revision:
sprintf_s( libraryName, "USBqemu r%d%s"
sprintf_s( libraryName, "USBqemu %lld%s"
#ifdef DEBUG_FAST
"-Debug"
#elif defined( PCSX2_DEBUG )
@ -102,8 +102,7 @@ static void InitLibraryName()
#else
""
#endif
,SVN_REV,
SVN_MODS ? "m" : ""
,SVN_REV,SVN_MODS ? "m" : ""
);
#endif
#endif

View File

@ -36,7 +36,7 @@ char *LibName = "cdvdGigaherz "
#ifdef PCSX2_DEBUG
" Debug "
#endif
"(r" SFY(SVN_REV)
"(" SFY(SVN_REV)
#if SVN_MODS
"/modded"
#endif

View File

@ -77,7 +77,7 @@ EXPORT_C_(u32) PS2EgetLibType()
EXPORT_C_(char*) PS2EgetLibName()
{
snprintf( libraryName, 255, "DEV9null Driver r%d%s",SVN_REV, SVN_MODS ? "m" : "");
snprintf( libraryName, 255, "DEV9null Driver %lld%s",SVN_REV, SVN_MODS ? "m" : "");
return libraryName;
}

View File

@ -87,7 +87,7 @@ static void InitLibraryName()
// Use TortoiseSVN's SubWCRev utility's output
// to label the specific revision:
snprintf( libraryName, 255, "SPU2-X r%d%s"
snprintf( libraryName, 255, "SPU2-X %lld%s"
#ifdef DEBUG_FAST
"-Debug"
#elif defined( PCSX2_DEBUG )
@ -97,8 +97,7 @@ static void InitLibraryName()
#else
""
#endif
,SVN_REV,
SVN_MODS ? "m" : ""
,SVN_REV, SVN_MODS ? "m" : ""
);
#endif
#endif

View File

@ -32,7 +32,7 @@ static LRESULT WINAPI AboutProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
wchar_t outstr[256];
if( IsDevBuild )
swprintf_s( outstr, L"Build r%d -- Compiled on " _T(__DATE__), SVN_REV );
swprintf_s( outstr, L"Build %lld -- Compiled on " _T(__DATE__), SVN_REV );
else
swprintf_s( outstr, L"Release v%d.%d -- Compiled on " _T(__DATE__),
VersionInfo::Release, VersionInfo::Revision );

View File

@ -296,7 +296,7 @@ BEGIN
BEGIN
VALUE "Comments", "SPU2 Plugin for PS2 Emulators"
VALUE "CompanyName", "PCSX2 Dev Team"
VALUE "FileDescription", "SPU2-X Plugin (svn build)"
VALUE "FileDescription", "SPU2-X Plugin (git build)"
VALUE "FileVersion", "2.0.SVN"
VALUE "InternalName", "SPU2-X"
VALUE "LegalCopyright", "Copyright (C) 2011"

View File

@ -134,14 +134,13 @@ static void InitLibraryName()
// Use TortoiseSVN's SubWCRev utility's output
// to label the specific revision:
sprintf_s( libraryName, "ZeroSPU2 r%d%s"
sprintf_s( libraryName, "ZeroSPU2 %lld%s"
# ifdef PCSX2_DEBUG
"-Debug"
# elif defined( ZEROSPU2_DEVBUILD )
"-Dev"
# endif
,SVN_REV,
SVN_MODS ? "m" : ""
,SVN_REV,SVN_MODS ? "m" : ""
);
#endif
#else