Author Topic: Autoversionning refinment  (Read 2539 times)

Offline Bat

  • Multiple posting newcomer
  • *
  • Posts: 48
Autoversionning refinment
« on: October 06, 2014, 09:32:05 pm »
Here patch for 2 small improvment :

-add same extra variables (DATE_NUMERIC, and so on), when using #define useful for wired compiler, win32 ressources and others
-add extra robustness to parser for recovering versionning information

As Berlios closed now, what is best method to send patch now ? (in message, attached file, elsewhere ? sourceforge ticket ?)

Code: [Select]
Index: AutoVersioning.cpp
===================================================================
--- AutoVersioning.cpp (revision 9919)
+++ AutoVersioning.cpp (working copy)
@@ -642,8 +642,11 @@
         wxDateTime actualDate = wxDateTime::Now();
         headerOutput << _T("\t") << _T("//Date Version Types") << _T("\n");
         headerOutput << _T("\t") << def_define_char << prefix << _T("DATE") << def_array << def_equal << actualDate.Format(_T("\"%d\"")) << def_end << _T("\n");
+        headerOutput << _T("\t") << def_define_char << prefix << _T("DATE_NUMERIC") << def_array << def_equal << actualDate.Format(_T("%d")) << def_end << _T("\n");
         headerOutput << _T("\t") << def_define_char << prefix << _T("MONTH") << def_array << def_equal << actualDate.Format(_T("\"%m\"")) << def_end << _T("\n");
+        headerOutput << _T("\t") << def_define_char << prefix << _T("MONTH_NUMERIC") << def_array << def_equal << actualDate.Format(_T("%m")) << def_end << _T("\n");
         headerOutput << _T("\t") << def_define_char << prefix << _T("YEAR") << def_array << def_equal << actualDate.Format(_T("\"%Y\"")) << def_end << _T("\n");
+        headerOutput << _T("\t") << def_define_char << prefix << _T("YEAR_NUMERIC") << def_array << def_equal << actualDate.Format(_T("%Y")) << def_end << _T("\n");
         long ubuntuYearNumber = 0;
         actualDate.Format(_T("%y")).ToLong(&ubuntuYearNumber);
         wxString ubuntuYear;
@@ -661,17 +664,27 @@
     headerOutput << _T("\t") << _T("//Standard Version Type") << _T("\n");
     myPrintf.Printf(_T("%ld"), GetVersionState().Values.Major);
     headerOutput << _T("\t") << def_define_long << prefix << _T("MAJOR ") << def_equal << myPrintf << def_end << _T("\n");
+    myPrintf.Printf(_T("\"%ld\""), GetVersionState().Values.Major);
+    headerOutput << _T("\t") << def_define_long << prefix << _T("MAJOR_STRING ") << def_equal << myPrintf << def_end << _T("\n");
     myPrintf.Printf(_T("%ld"), GetVersionState().Values.Minor);
     headerOutput << _T("\t") << def_define_long << prefix << _T("MINOR ") << def_equal << myPrintf << def_end << _T("\n");
+    myPrintf.Printf(_T("\"%ld\""), GetVersionState().Values.Minor);
+    headerOutput << _T("\t") << def_define_long << prefix << _T("MINOR_STRING ") << def_equal << myPrintf << def_end << _T("\n");
     myPrintf.Printf(_T("%ld"), GetVersionState().Values.Build);
     headerOutput << _T("\t") << def_define_long << prefix << _T("BUILD ") << def_equal << myPrintf << def_end << _T("\n");
+    myPrintf.Printf(_T("\"%ld\""), GetVersionState().Values.Build);
+    headerOutput << _T("\t") << def_define_long << prefix << _T("BUILD_STRING ") << def_equal << myPrintf << def_end << _T("\n");
     myPrintf.Printf(_T("%ld"), GetVersionState().Values.Revision);
     headerOutput << _T("\t") << def_define_long << prefix << _T("REVISION ") << def_equal << myPrintf << def_end << _T("\n");
+    myPrintf.Printf(_T("\"%ld\""), GetVersionState().Values.Revision);
+    headerOutput << _T("\t") << def_define_long << prefix << _T("REVISION_STRING ") << def_equal << myPrintf << def_end << _T("\n");
     headerOutput << _T("\t") << _T("\n");
 
     headerOutput << _T("\t") << _T("//Miscellaneous Version Types") << _T("\n");
     myPrintf.Printf(_T("%ld"), GetVersionState().Values.BuildCount);
     headerOutput << _T("\t") << def_define_long << prefix << _T("BUILDS_COUNT ") << def_equal << myPrintf << def_end <<_T("\n");
+    myPrintf.Printf(_T("\"%ld\""), GetVersionState().Values.BuildCount);
+    headerOutput << _T("\t") << def_define_long << prefix << _T("BUILDS_COUNT_STRING ") << def_equal << myPrintf << def_end <<_T("\n");
 
     myPrintf.Printf(_T("%ld,%ld,%ld,%ld"), GetVersionState().Values.Major, GetVersionState().Values.Minor,
             GetVersionState().Values.Build, GetVersionState().Values.Revision);
Index: avHeader.cpp
===================================================================
--- avHeader.cpp (revision 9919)
+++ avHeader.cpp (working copy)
@@ -55,7 +55,7 @@
 {
     wxString strExpression;
     strExpression << _T("(") << nameOfVariable << _T(")");
-    strExpression << _T("([ \t\n\r\f\v])*([=])([ \t\n\r\f\v])*([0-9]+)([ \t\n\r\f\v])*([;])+");
+    strExpression << _T("([ \t\n\r\f\v])*([=]*)([ \t\n\r\f\v])*([0-9]+)([ \t\n\r\f\v])*([;]*)+");
     wxRegEx expression;
 
     if (!expression.Compile(strExpression))
@@ -80,7 +80,7 @@
 {
     wxString strExpression;
     strExpression << _T("(") << nameOfVariable << _T(")");
-    strExpression << _T("([\\[\\]]+)([ \t\n\r\f\v])*([=])([ \t\n\r\f\v])*([\\\"])+([0-9A-Za-z \\-]+)([\\\"])+([ \t\n\r\f\v])*([;])+");
+    strExpression << _T("([\\[\\]]+)([ \t\n\r\f\v])*([=]*)([ \t\n\r\f\v])*([\\\"])+([0-9A-Za-z \\-]+)([\\\"])+([ \t\n\r\f\v])*([;]*)+");
     wxRegEx expression;
 
     if (!expression.Compile(strExpression))