DXGL r207 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r206‎ | r207 | r208 >
Date:00:53, 9 July 2012
Author:admin
Status:new
Tags:
Comment:
Build tool: Set revision as fourth version number, and add "rxxx" suffix to version strings.
Modified paths:
  • /buildtool/buildtool.cpp (modified) (history)
  • /buildtool/buildtool.vcxproj (modified) (history)
  • /common (modified) (history)
  • /common/rev.in (added) (history)

Diff [purge]

Index: buildtool/buildtool.cpp
@@ -17,10 +17,63 @@
1818
1919 #include <cstdio>
2020 #include <iostream>
 21+#include <windows.h>
2122 #include "../common/releasever.h"
2223
2324 using namespace std;
2425
 26+int GetSVNRev(char *path)
 27+{
 28+ char pathbase[FILENAME_MAX+1];
 29+ char pathin[FILENAME_MAX+1];
 30+ char pathout[FILENAME_MAX+1];
 31+ char command[1024];
 32+ strncpy(pathbase,path,FILENAME_MAX);
 33+ strncpy(pathin,path,FILENAME_MAX);
 34+ strncpy(pathout,path,FILENAME_MAX);
 35+ pathbase[strlen(pathbase)-7] = 0;
 36+ strncat(pathin,"\\rev.in",FILENAME_MAX-strlen(pathin));
 37+ strncat(pathout,"\\rev",FILENAME_MAX-strlen(pathin));
 38+ strcpy(command,"subwcrev ");
 39+ strcat(command,pathbase);
 40+ strcat(command," ");
 41+ strcat(command,pathin);
 42+ strcat(command," ");
 43+ strcat(command,pathout);
 44+ STARTUPINFOA startinfo;
 45+ ZeroMemory(&startinfo,sizeof(STARTUPINFOA));
 46+ startinfo.cb = sizeof(STARTUPINFO);
 47+ PROCESS_INFORMATION process;
 48+ if(CreateProcessA(NULL,command,NULL,NULL,FALSE,0,NULL,NULL,&startinfo,&process))
 49+ {
 50+ WaitForSingleObject(process.hProcess,INFINITE);
 51+ CloseHandle(process.hProcess);
 52+ CloseHandle(process.hThread);
 53+ FILE *revfile = fopen(pathout,"r");
 54+ if(!revfile)
 55+ {
 56+ cout << "WARNING: Failed to create revision file" << endl;
 57+ return 0;
 58+ }
 59+ char revstring[32];
 60+ fgets(revstring,32,revfile);
 61+ fclose(revfile);
 62+ return atoi(revstring);
 63+ }
 64+ else
 65+ {
 66+ int result = MessageBoxA(NULL,"Could not find subwcrev.exe, would you like to download TortoiseSVN?","TortoiseSVN not found",
 67+ MB_YESNO|MB_ICONWARNING);
 68+ if(result == IDYES)
 69+ {
 70+ MessageBoxA(NULL,"Please try again after installing TortoiseSVN.","TortoiseSVN not found",MB_OK|MB_ICONINFORMATION);
 71+ ShellExecuteA(NULL,"open","http://tortoisesvn.net/",NULL,NULL,SW_SHOWNORMAL);
 72+ exit(-1);
 73+ }
 74+ else return 0;
 75+ }
 76+}
 77+
2578 int ProcessHeaders(char *path)
2679 {
2780 char pathin[FILENAME_MAX+1];
@@ -29,7 +82,7 @@
3083 char verbuffer[20];
3184 char numstring[16];
3285 char *findptr;
33 - int revision = 0; //FIXME: Get SVN Rev.
 86+ int revision = GetSVNRev(path);
3487 strncpy(pathin,path,FILENAME_MAX);
3588 strncpy(pathout,path,FILENAME_MAX);
3689 strncat(pathin,"\\version.h.in",FILENAME_MAX-strlen(pathin));
Index: buildtool/buildtool.vcxproj
@@ -52,8 +52,7 @@
5353 </ClCompile>
5454 <Link>
5555 <GenerateDebugInformation>true</GenerateDebugInformation>
56 - <AdditionalDependencies>
57 - </AdditionalDependencies>
 56+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
5857 </Link>
5958 <PostBuildEvent>
6059 <Command>$(OutDir)$(TargetName)$(TargetExt) makeheader $(SolutionDir)common</Command>
@@ -70,8 +69,7 @@
7170 </ClCompile>
7271 <Link>
7372 <GenerateDebugInformation>true</GenerateDebugInformation>
74 - <AdditionalDependencies>
75 - </AdditionalDependencies>
 73+ <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
7674 </Link>
7775 <PostBuildEvent>
7876 <Command>$(OutDir)$(TargetName)$(TargetExt) makeheader $(SolutionDir)common</Command>
Index: common/rev.in
@@ -0,0 +1 @@
 2+$WCREV$
\ No newline at end of file
Index: common
Property changes on: common
___________________________________________________________________
Modified: svn:ignore
## -6,3 +6,4 ##
13 common.vcxproj.user
24 version.h
35 version.nsh
 6+rev