Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: JGM on June 27, 2007, 08:18:25 pm

Title: AutoVersioning Plugin
Post by: JGM on June 27, 2007, 08:18:25 pm
Here the Auto Versioning plugin 1.0

[Changes 1.0]
  - Now the plugin uses the project file to store settings instead of the ini file, thanks to killerbot.
  - You can choose where to store the version.h header as change the filename.
  - You can choose where to store the changeslog as change the filename.
  - The settings tab option AutoIncrement has been changed to Do Autoincrement, because of some different behaviour.
  - Also the Commit Changes menu was renamed to Increment Version.
  - Now the version.h file is parsed to obtain the version values.
  - You will have to increment version before closing the project if changes, since it doesn't store the modified flag as a configuration anymore.
  - The build history is now part of the header file.
  - Many other internal changes thanks to killerbot.

[Changes 0.9.1]
  - Small change, now variables are declared const to suppress warnings

[Changes 0.9]
  - Added a scheme validator to support the user while entering the values (error when dividing by zero on Revision random maximumn).
  - Changed some strings from Auto Versioning to Autoversioning
  - Now the project menus are disabled when no project is active.
  - Edited some menu comments and make them shorter.

[Wiki] (actually I have to update the wiki since the plugin has changed a little)
Check the new wiki page for documentation of the plugin and updated screenshots:
http://wiki.codeblocks.org/index.php?title=AutoVersioning

[Downloads]

Win32 Binary compiled with rev. 4711:
http://prdownload.berlios.de/autoversioning/autoversioning-v1.0.win32.7z

Ubuntu 7.04 Binary compiled with rev. 4711:
http://prdownload.berlios.de/autoversioning/autoversioning-v1.0.ubuntu.7z

[Sources]

Svn: svn://svn.berlios.de/autoversioning (most recent sources)
Title: Re: AutoVersioning Plugin
Post by: MortenMacFly on June 27, 2007, 09:02:26 pm
I see that the plugin classes only implement a few events. Like attach and release, but I don't see events like onmenuclick or something like that.
Have a look at cbEVT_COMPILER_STARTED -> that's what you need to listen to.

And what type of plugin this should be to work correctly? cbToolPlugin?
That's a good choice I'd say.

With regards, Morten.
Title: Re: AutoVersioning Plugin
Post by: JGM on June 27, 2007, 09:22:14 pm
Have a look at cbEVT_COMPILER_STARTED -> that's what you need to listen to.

Thanks for your reply, I will try that.
Title: Re: AutoVersioning Plugin
Post by: JGM on June 27, 2007, 10:30:25 pm
The compiler plugin is not generating EVT_COMPILER_STARTED or notifying the other plugins about this event. But is generating an EVT_COMPILER_FINISHED so i decided to increment the file after the compilation is finished. And thinking it now is the correct way of doing it. (Now increments before compilation using a wxTimer). Well, now it use the cbEVT_COMPILER_STARTED to make the changes necessary.

But how I know if the project was successfully compiled? Not so necessary now by the commit changes feature.

Edit:
cbEVT_COMPILER_STARTED still doesn't work. now work! fixed on revision 4324.
Title: Re: AutoVersioning Plugin
Post by: MortenMacFly on June 27, 2007, 11:30:36 pm
The compiler plugin is not generating EVT_COMPILER_STARTED or notifying the other plugins about this event.
Ouch! :shock: That's obviously not as it should be... I need to have a look at this.
Title: Re: AutoVersioning Plugin
Post by: JGM on June 28, 2007, 02:33:54 am
Ouch! :shock: That's obviously not as it should be... I need to have a look at this.

I imagine that, I make some OnCompilerStarted and OnCompilerFinished function events, but only the OnCompilerFinished was being notified. I expect to finish this plug in tomorrow if I understand right the api, but it seems very clear, I'm just impatience. :roll:

I got a question, with what configurations the wxWidgets dll was compiled?
I compiled codeblocks with my own compilation of wxWidgets and in result the plug in is not calling the correct libraries with the nightly version. The plug in works great with my codeblocks compilation. In linux there should not be any problem, because the official wx libraries are used instead, and no custom libraries. I will try on ubuntu too.  8)
Title: Re: AutoVersioning Plugin
Post by: JGM on June 28, 2007, 04:46:28 am
I was searching for version formats and I'm not sure what format I should implement. For example I was thinking on this:

Major Version: increments by 1 when the Minor versions sums 10
Minor Version: "      " by 1 when the Build Number sums 100 (reset on 10 to 0)
Build Number: every time the program is compiled successfully increments by 1
Revision Number: increments by one when some file has changed

This is a link with some tips:
http://www.codinghorror.com/blog/archives/000793.html

I was also thinking to add some defines that indicate the date of the build: year, month and date. And define each Version number on separate defines, integers or strings like: major, minor, build, revision. So the user has the flexibility of output the version in the format he wants. Also generate this defines:

#define RC_FILEVERSION  1,0,0,0
#define RC_FILEVERSION_STRING  "1, 0, 0, 0\0"

for windows resource files...

Any suggestions are welcome :D
Title: Re: AutoVersioning Plugin
Post by: thomas on June 28, 2007, 11:47:52 am
Quote
And what type of plugin this should be to work correctly? cbToolPlugin?
That's what is the most intuitive thing.

Quote
Major Version: increments by 1 when the Minor versions
That's not what I would do. I would never change major numbers or minor numbers in an automatic way, since that's not what people normally expect.

Personally, I would not even increment build numbers automatically, but instead would use a number provided by the revision control system for that. Compiling the same source ten times should not increment the build count by 10, there is no change to the code, so this doesn't justify changing the number. On the other hand, if the revision number has changed, then obviously code has been modified, and the build number should be amended.

There are many different schemes and many more interpretations. Most commonly, the major.minor.release scheme is understood as:

However, in some circles, it is also understood as:

An interesting approach to versions (which we similarly plan to use in Code::Blocks, too) is the year.month scheme as first made famous by Ubuntu. A release coming out in April 2007 would be named 7.04. The big advantage is that it requires no maintenance at all, and it is still unique and looks cool. Also, comparing  6.08 to 7.04 provides a lot better information than than comparing "Netscape 4" to "Netscape 7", for example.
Title: Re: AutoVersioning Plugin
Post by: dmoore on June 28, 2007, 01:02:18 pm
An interesting approach to versions (which we similarly plan to use in Code::Blocks, too) is the year.month scheme as first made famous by Ubuntu.

I hope this is the case. releasing this C::B as v1.0 RC3 would be a mockery of version schemas and bad marketing to boot.
Title: Re: AutoVersioning Plugin
Post by: tiwag on June 28, 2007, 02:54:43 pm
i'm using an autobuildnumber tool,
which increments only the last number

from the docs

Quote
/**
@file
@author Ryan Mulder
@author Steve Pierce
@date 3/13/06
Usage:
   The first command line argument is the path to the file to edit  (typically a resource file or header).
   If only the first argument is supplied, the "FILEVERSION" field is incremented
   If additional arguments are supplied, they are the string to search for before the version number. Example:  "#define AutoBuildNumber"

    Valid version numbers are a list of numbers separated by any one of:
        ,.|\\/&*^%$#@+-_=`~?<>:
    However, only 1 of these separators can be used at once.
   Version numbers can be contained inside double quotes or not, and only the last value will be incremented by this app.

   Example: #define AutoBuildNumber 1.0.0.1
   Example: #define AutoBuildNumber "1,0,0,1"
*/

and use it with CodeBlocks by defining a pre-build step
in "Project -> Build Options -> Pre/post build steps"
 
eg. if my version info is in file version.h  and  the macro name is APPVERSION
the you need a pre-build step like
Code
autobuildnumber version.h "#define APPVERSION"

hth, regards, tiwag

[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: JGM on June 28, 2007, 03:00:03 pm
Personally, I would not even increment build numbers automatically, but instead would use a number provided by the revision control system for that.

Well so I will give the user the option to not increment this values automatically and if the user wants to increment the values automatically use a default scheme.

On the other hand, if the revision number has changed, then obviously code has been modified, and the build number should be amended.

You mean with "amended" that the build number should be incremented when the revision number is incremented? Sorry not a native english speaker  :roll: So with what you said above increment the revision by random numbers from 1 to 10 and the build number by one.

major.minor.release scheme is understood as:
  • major: big change in functionality, may have entirely different look and feel, and may even not be backwards-compatible (although that's usually a requirement nevertheless)
  • minor: must not break compatibility, no matter what, may contain major or minor improvements, but no gross changes in overall look and feel
  • release: bug fixes or insignificant changes

Substitute the build number and revision by the release?

year.month scheme as first made famous by Ubuntu.

Right, I thought this. I want to declare some defines with the date month and year and maybe one define that declares some UBUNTU_STYLE_VERSION with the y.mm. The only problem for know is that no EVT_COMPILER_STARTED is been fired, and is needed to update the file before the compilation takes effect.

Well i will start working on this right now :D
Title: Re: AutoVersioning Plugin
Post by: rjmyst3 on June 28, 2007, 06:53:12 pm
i'm using an autobuildnumber tool,
which increments only the last number

from the docs

Quote
/**
@file
@author Ryan Mulder
@author Steve Pierce
@date 3/13/06
Usage:
   The first command line argument is the path to the file to edit  (typically a resource file or header).
   If only the first argument is supplied, the "FILEVERSION" field is incremented
   If additional arguments are supplied, they are the string to search for before the version number. Example:  "#define AutoBuildNumber"

    Valid version numbers are a list of numbers separated by any one of:
        ,.|\\/&*^%$#@+-_=`~?<>:
    However, only 1 of these separators can be used at once.
   Version numbers can be contained inside double quotes or not, and only the last value will be incremented by this app.

   Example: #define AutoBuildNumber 1.0.0.1
   Example: #define AutoBuildNumber "1,0,0,1"
*/

and use it with CodeBlocks by defining a pre-build step
in "Project -> Build Options -> Pre/post build steps"
 
eg. if my version info is in file version.h  and  the macro name is APPVERSION
the you need a pre-build step like
Code
autobuildnumber version.h "#define APPVERSION"

hth, regards, tiwag

This tool is open source and uses wxWidgets.

It looks like it does a very similar thing to what the plugin will do, so if the source will help you get started you can find it on google code.
http://code.google.com/p/autobuildnumber/

You can checkout the source from its svn repository here:
http://autobuildnumber.googlecode.com/svn/trunk/
Title: Re: AutoVersioning Plugin
Post by: JGM on June 28, 2007, 07:15:17 pm
This tool is open source and uses wxWidgets.

It looks like it does a very similar thing to what the plugin will do, so if the source will help you get started you can find it on google code.
http://code.google.com/p/autobuildnumber/

You can checkout the source from its svn repository here:
http://autobuildnumber.googlecode.com/svn/trunk/

Thanks, I have already downloaded the zip file that attached Tiwag  :)
Title: Re: AutoVersioning Plugin
Post by: JGM on June 28, 2007, 10:48:49 pm
So far this is what is been output by the AutoVersioning when configured with a project.

Code
//version.h file

//Date Version Types
#define DATE_VERSION 28
#define MONTH_VERSION 06
#define YEAR_VERSION 2007
#define UBUNTU_VERSION_STYLE 7.06

//Standard Version Types
#define MAJOR_VERSION 1
#define MINOR_VERSION 0
#define BUILD_NUMBER 0
#define REVISION 0

//Miscellaneous Version Types
#define BUILDS_COUNT 1
#define RC_FILEVERSION 1,0,0,0
#define RC_FILEVERSION_STRING "1, 0, 0, 0\0"
#define FULLVERSION_STRING "1.0.0.0"

Now I will implement the AutoUpdate Functions :)
Title: Re: AutoVersioning Plugin
Post by: killerbot on June 28, 2007, 11:13:55 pm
suggestions :
 - don't use defines (bad, preprocessor and ancient C shit)
 - use static const int or something like that
 - put them in a special namespace to avoid collisions
Title: Re: AutoVersioning Plugin
Post by: JGM on June 29, 2007, 12:03:43 am
suggestions :
 - don't use defines (bad, preprocessor and ancient C shit)
 - use static const int or something like that
 - put them in a special namespace to avoid collisions

Nice suggestion, I will do it.  :)

But C stills very powerful today :D

Edit:

Men! the development of this simple plugin is taking me more than I expected. I went in to problems with a crappy library of csv that I Implemented.   :x

The problem that I have was when uninstalling the plugin, produced a crash. It seem that the library that I made was having some pointer problems. Now i will implement the plugin using wxFileConfig to store the version variables for producing the header file. It should not produce complications now  :(
Title: Re: AutoVersioning Plugin
Post by: tiwag on June 29, 2007, 12:39:05 pm
suggestions :
 - don't use defines (bad, preprocessor and ancient C shit)
 - use static const int or something like that
 - put them in a special namespace to avoid collisions

don't be too harsh please  :P

this C shit is still widely used in the embedded world
with which I'm working daily.  :shock:

and i can assure you, i don't feel sucked myself because of that  8)
Title: Re: AutoVersioning Plugin
Post by: JGM on June 29, 2007, 07:03:48 pm
this C shit is still widely used in the embedded world
with which I'm working daily.  :shock:

Wow you program embedded systems!. I'm fascinated on learning this subject, is the real programming world, directly managing the hardware without OS. Cool!  :D

Well following the recommendations of killerbot now the output is this one:
Code
namespace AutoVersion{

//Date Version Types
static long DATE_VERSION = 29;
static long MONTH_VERSION = 06;
static long YEAR_VERSION = 2007;
static double UBUNTU_VERSION_STYLE = 7.06;

//Standard Version Types
static long MAJOR_VERSION = 1;
static long MINOR_VERSION = 0;
static long BUILD_NUMBER = 0;
static long REVISION = 0;

//Miscellaneous Version Types
static long BUILDS_COUNT = 1;
#define RC_FILEVERSION 1,0,0,0
#define RC_FILEVERSION_STRING "1, 0, 0, 0\0"
static char FULLVERSION_STRING[] = "1.0.0.0";

}

I fixed the problem I was Having while uninstalling the plugin, but now all is working right. Now i will really implement the updating functions. :shock:
Title: Re: AutoVersioning Plugin
Post by: JGM on June 29, 2007, 10:45:47 pm
I finished the plugin, check the first post to download the source! :D
Title: Re: AutoVersioning Plugin
Post by: JGM on July 04, 2007, 06:49:05 pm
I have found a freaking bug,

The program is writing into the version.h "%" signs instead of the actual numbers from the version.ini.

This is the problem:

Code
        static double UBUNTU_VERSION_STYLE = %.07; //here also?

//Standard Version Types
static long MAJOR_VERSION = %;
static long MINOR_VERSION = %;
static long BUILD_NUMBER = %;
static long REVISION = %;

//Miscellaneous Version Types
static long BUILDS_COUNT = %;

I don't know how this occurs :oops:. I will hunt this bug. It should be something silly.
Title: Re: AutoVersioning Plugin
Post by: killerbot on July 04, 2007, 08:39:05 pm
suggestions :
 - don't use defines (bad, preprocessor and ancient C shit)
 - use static const int or something like that
 - put them in a special namespace to avoid collisions

don't be too harsh please  :P

this C shit is still widely used in the embedded world
with which I'm working daily.  :shock:

and i can assure you, i don't feel sucked myself because of that  8)

I do embedded stuff too, but luckily already C++, my C days are a while ago now ;-)

But also in C: you can have static const, which is still better then defines.
I think C99 also has namespaces but I am not sure though. But then your embedded compiler needs to be rather up to date ...
Title: Re: AutoVersioning Plugin
Post by: JGM on July 04, 2007, 09:11:25 pm
Fixed the problem,

It seems that the wxString operator<< have a bug handling long variables. First I was using some wxString Printf function to acquire the version functions from the ini file to convert them from long to string and then switched to just put the long values in the wxString<< operator. But now back again to Printf and is working fine. :)

If somebody have suggestions please post them  :D

Updated again the attachment in the first post to have this update.
Title: Re: AutoVersioning Plugin
Post by: raph on July 05, 2007, 12:53:04 pm
Could you add an option to detect the revision number of the project and put it in version.h (like cb does)?
It would be nice to have autorevision's functionality built into codeblocks :D
Title: Re: AutoVersioning Plugin
Post by: JGM on July 05, 2007, 02:27:01 pm
Could you add an option to detect the revision number of the project and put it in version.h (like cb does)?
It would be nice to have autorevision's functionality built into codeblocks :D

Theres already a variable declared "static long REVISION = 0;", it increments randomly up to 30 10 (now is editable using the scheme editor) every time some file in the project has been modified. Thats what you mean :?: Or is something else?
Title: Re: AutoVersioning Plugin
Post by: raph on July 05, 2007, 02:47:27 pm
No, I mean revision number of a version control system as codeblocks does it with svn (see sourcecode of autoversion in codeblocks_source_dir/src/build_tools/autorevision how it can be parsed).
Every time you do a "svn commit", the revision number is increased.
This guarantees, that there really are changes to the project that justify an incrementation of the version number and makes the project's version information much more meaningful.
Title: Re: AutoVersioning Plugin
Post by: JGM on July 05, 2007, 04:26:44 pm
No, I mean revision number of a version control system as codeblocks does it with svn (see sourcecode of autoversion in codeblocks_source_dir/src/build_tools/autorevision how it can be parsed).
Every time you do a "svn commit", the revision number is increased.
This guarantees, that there really are changes to the project that justify an incrementation of the version number and makes the project's version information much more meaningful.

I get it now! Is a great Idea  :D

The only problem is that I never had used SVN or CVS  :oops: don't know how the whole thing works  :shock:
But I'm already reading the online svn book and I'm getting the concept  :D. Sorry for my ignorance :(. When I read the basic concepts of svn and how to use it I will implement this. Is a nice way for me to start  using svn.

I looked the source code used on codeblocks for parsing the svn command xml output and it looks pretty strait forward to implement on the plugin.

I will put a check box that says "svn enabled?" and if marked then generate an SVN_REVISION variable. I don't know if also I should add a field that points to the directory where the actual svn configuration files reside in the project. I will look into this.
Title: Re: AutoVersioning Plugin
Post by: JGM on July 06, 2007, 03:21:49 am
Could you add an option to detect the revision number of the project and put it in version.h (like cb does)?
It would be nice to have autorevision's functionality built into codeblocks :D

Done! Finished adding this feature. Check the first post for screenshot and download  :D
Title: Re: AutoVersioning Plugin
Post by: mp on July 08, 2007, 05:29:00 pm
I can't compile plug in.

Code
avSvnRevision.cpp:: In function `bool QuerySvn(const std::string&, std::string&, std::string&)':
avSvnRevision.cpp:32: error: 'class TiXmlElement' has no member named 'GetText'
avSvnRevision.cpp:33: error: 'class TiXmlElement' has no member named 'GetText'

AutoVersioning.cpp:27: error: `EVT_COMPILER_STARTED' was not declared in this scope
AutoVersioning.cpp:28: error: expected `}' before "EVT_COMPILER_FINISHED"
AutoVersioning.cpp:28: error: expected `,' or `;' before "EVT_COMPILER_FINISHED"
AutoVersioning.cpp:30: error: expected declaration before '}' token


Could You provide compiled version?
Title: Re: AutoVersioning Plugin
Post by: JGM on July 08, 2007, 06:51:23 pm
I can't compile plug in.

Code
avSvnRevision.cpp:: In function `bool QuerySvn(const std::string&, std::string&, std::string&)':
avSvnRevision.cpp:32: error: 'class TiXmlElement' has no member named 'GetText'
avSvnRevision.cpp:33: error: 'class TiXmlElement' has no member named 'GetText'

AutoVersioning.cpp:27: error: `EVT_COMPILER_STARTED' was not declared in this scope
AutoVersioning.cpp:28: error: expected `}' before "EVT_COMPILER_FINISHED"
AutoVersioning.cpp:28: error: expected `,' or `;' before "EVT_COMPILER_FINISHED"
AutoVersioning.cpp:30: error: expected declaration before '}' token


Could You provide compiled version?

I got to update the events handling on the plugin because that methods are deprecated in the new codeblocks revision.

What operating system are you using? A compiled version depends on the actual version of codeblocks that you are using and and the wxWidgets library to work.

Is weird that error on the Tiny Xml Class. I don't got that error, may be you are using an old version or newer than I have. I will check this.

If you can provide the actual revision of codeblocks that you are using will be of help to diagnostic the problem. :D
Title: Re: AutoVersioning Plugin
Post by: killerbot on July 08, 2007, 08:33:16 pm
maybe it's because of the way that person used your code. I just had a look at avSvnRevision.h/cpp

-> include "tinyxml/tinystr.h", the fact that you specify a subdir, could be the party pooper.

Some advice to the code of avSvnRevision.h

- never ever put using namespace in a header file
- the include's of tinyxml are NOT needed here -> you don't do anything with them in the header, so they do NOT belong there
- the include of cstdio does not belong here, inside the header you use NOTHING from that header file

Core new code suggestion :
Code
#include <string>

bool QuerySvn(const std::string& workingDir, std::string& revision, std::string& date);

I also had a look at the corresponding cpp file :
here you should put the includes of :
  - cstddio.h
  - tinyxml.h (probably tinystr.h is not needed) (suggestion : don't put an extra dir in front, just add the dir to your include paths of the project

Things that can be removed from this file are :
  - the include of wx.h [you don't use anything from wxwidgets in this code, aside use the headers with the things you actually use from wx, don't just include a monster of a header file]
  - remove the macro (by the way don't use macros, they are f*** BAD, use a function, a template, ...], but in this case the macro is not used

Other suggestions :
  - be const correct and scope limiting : your TinyXmlElement's are const --> put that in the code, and limit their scope, also make use of handle, it will simplify your code
Code
  TiXmlHandle Handle(&doc);
  if(const TiXmlElement* e =  Handle.FirstChildElement("entry").FirstChildElement("commit").ToElement())
  {
    revision = e->Attribute("revision") ? e->Attribute("revision") : "";
    const TiXmlElement *d = e->FirstChildElement("date");
    if(d && d->GetText())
    {
                date = d->GetText();
    }
  }

  - don't use memset when it is not needed, you can easily replace :
Code
        char buf[16384];
        memset(buf, 0, 16384);
by :
Code
        char buf[16384] = {'\0'};
  - try to avoid magic numbers like '16384' and '16384' and '16383, for sure they are all related, but are they ..., put that magic number in a const variable (no define !!!)

I hope you find these tips and code corrections useful. I didn't look at the other source files, I just took a peek for this one wrt compile problem.
Cheers.
Title: Re: AutoVersioning Plugin
Post by: mp on July 09, 2007, 12:58:58 am
I got to update the events handling on the plugin because that methods are deprecated in the new codeblocks revision.

What operating system are you using? A compiled version depends on the actual version of codeblocks that you are using and and the wxWidgets library to work.

Is weird that error on the Tiny Xml Class. I don't got that error, may be you are using an old version or newer than I have. I will check this.

If you can provide the actual revision of codeblocks that you are using will be of help to diagnostic the problem. :D

Windows XP SP2, C::B Nightly Build form 06 July 07 , wxWidgets 2.8.4. MinGW 5.1.3
Title: Re: AutoVersioning Plugin
Post by: The-Kenny on July 09, 2007, 03:47:21 am
I get the same error every Time I try to compile the Plugin:
Windows XP Home, C::B Nightly Build rev4235 (The same as mp), wxWidgets 2.8.4, minGW 5.1.3.
Title: Re: AutoVersioning Plugin
Post by: JGM on July 09, 2007, 03:54:05 am
Some advice to the code of avSvnRevision.h

Followed almost all your suggestions  :)

Things that can be removed from this file are :
  - the include of wx.h [you don't use anything from wxwidgets in this code, aside use the headers with the things you actually use from wx, don't just include a monster of a header file]

I was testing and going to convert that function from standard c++ to wxWidgets and forgot to remove that header and also the defines, thanks for the fact  :D

  - remove the macro (by the way don't use macros, they are f*** BAD, use a function, a template, ...], but in this case the macro is not used

Meennn you really hate #defines  :shock:

Other suggestions :
  - be const correct and scope limiting : your TinyXmlElement's are const --> put that in the code, and limit their scope, also make use of handle, it will simplify your code
Code
  TiXmlHandle Handle(&doc);
  if(const TiXmlElement* e =  Handle.FirstChildElement("entry").FirstChildElement("commit").ToElement())
  {
    revision = e->Attribute("revision") ? e->Attribute("revision") : "";
    const TiXmlElement *d = e->FirstChildElement("date");
    if(d && d->GetText())
    {
                date = d->GetText();
    }
  }

  - don't use memset when it is not needed, you can easily replace :
Code
        char buf[16384];
        memset(buf, 0, 16384);
by :
Code
        char buf[16384] = {'\0'};
  - try to avoid magic numbers like '16384' and '16384' and '16383, for sure they are all related, but are they ..., put that magic number in a const variable (no define !!!)


I hope you find these tips and code corrections useful. I didn't look at the other source files, I just took a peek for this one wrt compile problem.
Cheers.

I just took the code from the codeblocks source code /build_tools/autorevision.cpp and not make any big modifications, but they are now done.

Well at last, updated the source code, everybody can find it in the first post :P
Title: Re: AutoVersioning Plugin
Post by: JGM on July 09, 2007, 03:56:38 am
Windows XP SP2, C::B Nightly Build form 06 July 07 , wxWidgets 2.8.4. MinGW 5.1.3

Uploaded a compiled version, you can check if it works with your configuration (link in the first post)
Title: Re: AutoVersioning Plugin
Post by: JGM on July 09, 2007, 03:54:39 pm
Man the version.h was compiling find but now it gave me an error while compiling my current project.

The error was declaring the dates variables date and month as long like this:
        static long DATE_VERSION = 09; //Declaration incorrect by the zero
   static long MONTH_VERSION = 07; //The same here

So updated the output to this:
Code
namespace AutoVersion{

//Date Version Types
static char DATE[] = "09";
static char MONTH[] = "07";
static char YEAR[] = "2007";
static double UBUNTU_VERSION_STYLE = 7.07;

//Standard Version Types
static long MAJOR = 1;
static long MINOR = 1;
static long BUILD = 118;
static long REVISION = 1067;

//Miscellaneous Version Types
static long BUILDS_COUNT = 212;
#define RC_FILEVERSION 1,1,118,1067
#define RC_FILEVERSION_STRING "1, 1, 118, 1067\0"
static char FULLVERSION_STRING[] = "1.1.118.1067";

}

As you can see I also shortened the variables names, because while using the plugin noted the unnecessary long names :oops:

So updated source code in the first post as compiled version for windows. And sorry for so many mistakes
Title: Re: AutoVersioning Plugin
Post by: mp on July 09, 2007, 05:56:53 pm
Hi!

I still have errors compiling plugin, but now some new errors occurred. I can't install compiled plugin too. C::B says that this plugin is compiled with other version of SDK than IDE.
Title: Re: AutoVersioning Plugin
Post by: JGM on July 09, 2007, 06:46:12 pm
Hi!

I still have errors compiling plugin, but now some new errors occurred. I can't install compiled plugin too. C::B says that this plugin is compiled with other version of SDK than IDE.

:?

Well maybe you haven't defined the $(#cb) variable, or you are trying to compile without compiling first codeblocks from source, also you got to compile the wx library.

Just uploaded my custom  compilation of codeblocks with the autoversioning plugin working here right click and save as to download if you want to try it out.
Title: Re: AutoVersioning Plugin
Post by: mp on July 09, 2007, 08:02:08 pm
Hi!

I still have errors compiling plugin, but now some new errors occurred. I can't install compiled plugin too. C::B says that this plugin is compiled with other version of SDK than IDE.

:?

Well maybe you haven't defined the $(#cb) variable, or you are trying to compile without compiling first codeblocks from source, also you got to compile the wx library.

Just uploaded my custom  compilation of codeblocks with the autoversioning plugin working here (http://areapr.com/autoversioning/codeblocks.7z) right click and save as to download if you want to try it out.

I've defined variable, I've got compiled wxWidgets library, but i don't have compiled c::b by my self, only downloaded form forum.
Thanks for your C::B, i will try it later and post results.

// EDIT:
After using your version of C::B all seams to be ok :) Very nice plugin :D Thx.

And I've noticed one problem: why after compilation od one .cpp file plugin increment build count by 2 or 3?
Title: Re: AutoVersioning Plugin
Post by: JGM on July 10, 2007, 08:14:36 pm
// EDIT:
After using your version of C::B all seams to be ok :) Very nice plugin :D Thx.

And I've noticed one problem: why after compilation od one .cpp file plugin increment build count by 2 or 3?

I don't understand clearly what you mean but:

This variable is for keeping track of all the compilations that we do while working, Is just for our eyes to know how many work we have done, I just thought it will be a nice feature (also for our work reports  :D). But the revision and build (not build_count) increments only when a file had been modified. If you put the mouse pointer on each textbox it shows the scheme that I implemented.

The scheme is the following:

  - Revision increments by a random number up to 10 every time a modification is made.
  - Build number increments when revision increments by 1.
 
If auto increment is marked:
  - Minor is incremented by 1 each time the build number reach a barrier of 100 and reset to 0 on 10.
  - Major is incremented by 1 each time the minor reach 10.

if dates is marked:
  - Generates variables with the current date of compilation.

if svn marked:
  - search in the directory selected for revision number and date and generates the appropriate variables.

I'm thinking of implementing another window for customizing the current scheme but i will work on this later. :D
Title: Re: AutoVersioning Plugin
Post by: JGM on July 11, 2007, 09:03:57 pm
Added new version with an option to commit changes before auto-incrementing and some minor fixes. :)

Check first post for download.
Title: Re: AutoVersioning Plugin
Post by: JGM on July 12, 2007, 08:25:04 pm
Added variables for declaring the software status like beta, etc...

Updated the version editor and added a notebook to divide by categories.

Check the first post for downloads.

New output
Code
#ifndef VERSION_H
#define VERSION_H

namespace AutoVersion{

//Date Version Types
static char DATE[] = "12";
static char MONTH[] = "07";
static char YEAR[] = "2007";
static double UBUNTU_VERSION_STYLE = 7.07;

//Software Status
static char STATUS[] = "Alpha";
static char STATUS_SHORT[] = "a";

//Standard Version Type
static long MAJOR = 1;
static long MINOR = 0;
static long BUILD = 9;
static long REVISION = 75;

//Miscellaneous Version Types
static long BUILDS_COUNT = 10;
#define RC_FILEVERSION 1,0,9,75
#define RC_FILEVERSION_STRING "1, 0, 9, 75\0"
static char FULLVERSION_STRING[] = "1.0.9.75";

}
#endif //VERSION_h
Title: Re: AutoVersioning Plugin
Post by: JGM on July 13, 2007, 04:37:00 am
Some minor fixes and now going to v0.4.1

Check the first post for downloads.  :lol:
Title: Re: AutoVersioning Plugin
Post by: JGM on July 18, 2007, 04:21:10 pm
Added new features for editing the current scheme and new menu entries. Also added project files for the contrib svn codeblocks.

I'm thinking on adding a report generator for each incrementation made by a commitment.  :?:

For example, if you are working on a project and made changes, then you commit, when you commit you will have the option to write the changes that you have made to the project on the actual version incrementation, and software status. Something like the typical CHANGES file like this:

Code
Changes File

v0.3.4a
  - blah blah
  - blah blah

v0.3.3a
  - Some fixes
  - new features

If somebody have suggestions and recommendations, please share them. I don't know if the plugin needs other features, or is useless, share your thoughts.  :)
Title: Re: AutoVersioning Plugin
Post by: PsYhLo on July 19, 2007, 08:07:15 am
can i compile it under linux
is it possible
Title: Re: AutoVersioning Plugin
Post by: JGM on July 19, 2007, 03:22:40 pm
can i compile it under linux
is it possible

Yes! I have already compile it on ubuntu 7.04 and works fine.
Title: Re: AutoVersioning Plugin
Post by: PsYhLo on July 20, 2007, 06:31:59 pm
ok i compile it but it wouldn't start
Ubuntu 7.04 my own compile version of codeblocks witg wx2.8.4

Edit:
ERROR: /home/psyhlo/.codeblocks/share/codeblocks/plugins/autoversioning.so: not loaded (missing symbols?)

[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: JGM on July 21, 2007, 12:42:05 am

ok i compile it but it wouldn't start

Ubuntu 7.04 my own compile version of codeblocks witg wx2.8.4



Edit:

ERROR: /home/psyhlo/.codeblocks/share/codeblocks/plugins/autoversioning.so: not loaded (missing symbols?)




Thats the problem that I reported on the first post in the unix project. This is the text that I wrote.




Edit: Some little mistake in the unix project of autoversioning-contrib.7z on the post-build steps.



This line: zip -j9 ..\..\..\devel\share\codeblocks\autoversioning.zip manifest.xml



should read: zip -j9 ../../../devel/share/codeblocks/autoversioning.zip manifest.xml



thats all.



I have already tested the plugin on ubuntu and it works fine. The tool tips are so smooth...  :D






The problem is that no autoversioning.zip with the manifest is been copied to the codeblocks directory. After changing to the correct path described above it will work just fine. Sorry for that mistake on mines.



That is if you are using the autoversioning-contrib.7z file that has the unix project. If not, then maybe you are running a version of codeblocks that is not compatible with the sdk that you are compiling to. I attached a screen shot of the plugin working on ubuntu.

[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: PsYhLo on July 21, 2007, 09:36:51 am
i compile your plugin after compilation of codeblocks rev 4281
and installed with Manage Plugins
Title: Re: AutoVersioning Plugin
Post by: JGM on July 21, 2007, 08:27:55 pm
i compile your plugin after compilation of codeblocks rev 4281
and installed with Manage Plugins

How do you compiled codeblocks?
./bootstrap
./configure
./make
./make install

or  :?:

using a compiled codeblocks to compile the sources using the cobeblocks-unix project :?:

I hadn't created a Makefile.am and the first method will not work (only project files work for now).

Also, maybe can be that your $(#CB) global variable is pointing to a directory with an old compilation that is not actual with the version of codeblocks that you are using (in the case that you are using the project file, and it should be the case since you installed it from "Manage Plugins"). So the libcodeblocks.so that you're compiling to is different from the one used by codeblocks. And thats the error while loading symbols.

But, I'm just making conclusions, the problem can be another one. :?
I compiled it again today with the actual revision 4285 and is working fine.

Steps for compiling plugins:

  1. With a precompiled version of codeblocks open the CodeBlocks-unix.cbp and compile it.
  2. Set the global variable "CB" to point the /trunk/src folder of your svn download.
  3. Then open the ContribPlugins-unix.workspace and hit "Build Workspace" from the "Build menu"
  4. Run the /trunk/src/update script that will create a folder named output with the correct binaries.
  5. And for contributed plugins like autoversioning download the correct sources, in this case AutoVersioning.7z
  6. Open the project file and hit the build button.

Important points:

  1. Install the plugin to the codeblocks that you just compiled. (else symbols error)
  2. Set the "CB"  global variable to point to the correct compilation and sources. (else symbols error)
Title: Re: AutoVersioning Plugin
Post by: PsYhLo on July 21, 2007, 08:49:13 pm
How do you compiled codeblocks?
./bootstrap
./configure
./make
./make install
this is my way i have only one codeblocks source dir so it is compiled with right sdk version
also i used this ./configure --prefix=/usr --with-contrib-plugins=all instead of ./configure
Title: Re: AutoVersioning Plugin
Post by: darthdespotism on July 21, 2007, 09:08:04 pm
I may be wrong but is it not --with-contrib=all (without plugin)?
Title: Re: AutoVersioning Plugin
Post by: PsYhLo on July 21, 2007, 09:30:52 pm
type ./configure --help and will see ;)
Title: Re: AutoVersioning Plugin
Post by: JGM on July 21, 2007, 11:58:34 pm
this is my way i have only one codeblocks source dir so it is compiled with right sdk version
also i used this ./configure --prefix=/usr --with-contrib-plugins=all instead of ./configure

Ok, I made it like you except that in the prefix parameter I put /etc/codeblocks, but that was my choice. After compiling the plugin I got the same problem that you had.

I saw some errors in the linux project file, (what a moron I'm) well I just corrected the project file using the default unix template of codeblocks from the plugin project. Now the plugin loaded fine after compilation with the new settings!

Now you have to set the $(#CB) to point /usr/include/codeblocks or /usr/local/include/codeblocks, I think that for you is the first path.

Well here is the linux project file attached and corrected. (try it out and let me know) :)

[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: PsYhLo on July 22, 2007, 07:54:30 pm
it works!
even compile process complete without any warning

it is such a good plug-in 10x keep the good work
Title: Re: AutoVersioning Plugin
Post by: JGM on July 23, 2007, 12:59:31 am
it works!
even compile process complete without any warning

it is such a good plug-in 10x keep the good work

Thanks! :D Is for me a pleasure to know that is useful

I will add now the option to generate a CHANGES file every time that a commit changes is executed.


Code
Changes File

v0.3.4a
  - blah blah
  - blah blah

v0.3.3a
  - Some fixes
  - new features

Like I wrote in that post.

I think this will be useful after all, for us to keep our work organized more easily.

Well I will start working on this, it should be simple, I think :?
Title: Re: AutoVersioning Plugin
Post by: JaredR26 on July 24, 2007, 04:06:28 am
I cannot get this to compile.  I have MinGW 5.1.3, July 22/23 nightly build of CodeBlocks, wxWidgets 2.8.4, WinXP SP2.

wxWidgets has been compiled, CodeBlocks has been compiled.

It cannot find tinyxml:
Code
:: === AutoVersioning, default ===
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:8: tinyxml/tinyxml.h: No such file or directory
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:: In function `bool QuerySvn(const wxString&, wxString&, wxString&)':
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:29: error: `TiXmlDocument' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:29: error: (Each undeclared identifier is reported only once for each function it appears in.)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:29: error: expected `;' before "doc"
src\src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:30: error: `doc' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:35: error: `TiXmlElement' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:35: error: `e' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:39: error: `d' undeclared (first use this function)
:: === Build finished: 8 errors, 0 warnings ===
Title: Re: AutoVersioning Plugin
Post by: TDragon on July 24, 2007, 04:23:00 am
You also need to check out the Code::Blocks source from SVN and build it.
Title: Re: AutoVersioning Plugin
Post by: JaredR26 on July 24, 2007, 04:28:47 am
I did, unless I missed something, still wont work.  Checked out the code from the SVN, ran the nightly pre-compiled codeblocks and compiled the SVN source.
Title: Re: AutoVersioning Plugin
Post by: JGM on July 24, 2007, 08:04:27 am
It cannot find tinyxml:
Code
:: === AutoVersioning, default ===
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:8: tinyxml/tinyxml.h: No such file or directory
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:: In function `bool QuerySvn(const wxString&, wxString&, wxString&)':
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:29: error: `TiXmlDocument' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:29: error: (Each undeclared identifier is reported only once for each function it appears in.)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:29: error: expected `;' before "doc"
src\src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:30: error: `doc' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:35: error: `TiXmlElement' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:35: error: `e' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:39: error: `d' undeclared (first use this function)
:: === Build finished: 8 errors, 0 warnings ===

Does the $(#CB) Global variable is pointing to "codeblocks-head\trunk\src"? Else try changing this "$(#CB.INCLUDE)" to "$(#CB)\include"

If the problem keeps on, then try to specified all the steps that you made to compile the plugin, and also the file structure (the routes for the codeblocks sources). Some one else had the same problem I think, what could be :? :?:
Title: Re: AutoVersioning Plugin
Post by: JaredR26 on July 25, 2007, 09:50:29 am
It cannot find tinyxml:
Code
:: === AutoVersioning, default ===
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:8: tinyxml/tinyxml.h: No such file or directory
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:: In function `bool QuerySvn(const wxString&, wxString&, wxString&)':
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:29: error: `TiXmlDocument' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:29: error: (Each undeclared identifier is reported only once for each function it appears in.)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:29: error: expected `;' before "doc"
src\src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:30: error: `doc' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:35: error: `TiXmlElement' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:35: error: `e' undeclared (first use this function)
src\plugins\contrib\AutoVersioning\avSvnRevision.cpp:39: error: `d' undeclared (first use this function)
:: === Build finished: 8 errors, 0 warnings ===

Does the $(#CB) Global variable is pointing to "codeblocks-head\trunk\src"? Else try changing this "$(#CB.INCLUDE)" to "$(#CB)\include"

My file structure is:
C:\Installed\CodeBlocks\
and inside that is src\, which contains everything i get from the SVN.
So the CodeBlocks source is C:\Installed\CodeBlocks\src\src and the autoversioning plugin is in that + \plugins\contrib\AutoVersioning

I tried both the AutoVersioning and the autoversioning-contrib files, both give the same error.

my cb global variable points to C:\Installed\CodeBlocks\src, but I tried pointing it to C:\Installed\CodeBlocks\src\src, and pointing the include variable to C:\Installed\CodeBlocks\src\src\include

I even tried defining a tinyxml variable pointing directly to the tinyxml folder containing the .h file.

Quote
If the problem keeps on, then try to specified all the steps that you made to compile the plugin, and also the file structure (the routes for the codeblocks sources). Some one else had the same problem I think, what could be :? :?:

I added this to the workspace file:
      <Project filename="plugins\contrib\AutoVersioning\AutoVersioning-Windows.cbp" />
and added the folder to that location (contrib).  I tried this with AutoVersioning and autoversioning-contrib.
And loaded up code blocks.  Tried compiling all workspaces and the autoversioning itself.  Code::Blocks itself and wxWidgets have been compiled successfully(0 errors).
Title: Re: AutoVersioning Plugin
Post by: JaredR26 on July 26, 2007, 11:02:57 pm
If no one is able to help me, do you think you could provide a pre-compiled windows copy JGM?
Title: Re: AutoVersioning Plugin
Post by: JGM on July 27, 2007, 03:21:31 am
If no one is able to help me, do you think you could provide a pre-compiled windows copy JGM?

Hi sorry for the delay, lets try to compile that  :)!

I advice you to to create a folder structure like the one explained in the wiki for convenience "codeblocks-head/trunk/" and inside that folder the original src folder, not some src/src thats confusing :shock:

I tried both the AutoVersioning and the autoversioning-contrib files, both give the same error.

The AutoVersioning.7z is for generating the autoversioning.cbplugin and the autoversioning-contrib.7z are the files mandatory to the plugins/contrib/autoversioning

my cb global variable points to C:\Installed\CodeBlocks\src

there it will not found the include directory. use the structure recommended in the wiki, the src/src is redundant

, but I tried pointing it to C:\Installed\CodeBlocks\src\src

It should work if you point to that directory :?

and pointing the include variable to C:\Installed\CodeBlocks\src\src\include

that should not be necessary

Well,
first use the autoversioning-contrib.7z and decompress it to the correct plugin/contrib/autoversioning

open the ContribPlugins.workspace and click File->Open and add the plugin/contrib/autoversioning/autoversioning.cbp and hit save workspace

set the $(#CB) variable to codeblocksdirecotry/src/ where the include directory resides.

Hit compile!

You can also open the project file directly from the plugins/contrib/autoversioning and compile it. then run the bat file to produce the correct output.

Thats what I do and I don't have any errors

Hope you can compile it! :)
Title: Re: AutoVersioning Plugin
Post by: JaredR26 on July 28, 2007, 09:48:22 pm
Got it. :)
Title: Re: AutoVersioning Plugin
Post by: JGM on July 31, 2007, 04:30:59 am
Added the plugin on the Announcement for plugins/patches (http://wiki.codeblocks.org/index.php?title=Announcement_for_plugins/patches) WIKI I think is stable enough.
Title: Re: AutoVersioning Plugin
Post by: JGM on August 10, 2007, 07:05:26 pm
New version available with some code changes and now using the cbEVT_COMPILER_STARTED. More details and download on first post. :D
Title: Re: AutoVersioning Plugin
Post by: MortenMacFly on August 10, 2007, 07:58:53 pm
More details and download on first post. :D
Thanks for that - applied that to one of my own projects and it worked quite well so far. :D
BTW: Don't you wanna put this under SVN version control (e.g. at BerliOS like CBILplugin or cbMakeGen) maybe?! This makes it easier to update...
With regards, Morten.
Title: Re: AutoVersioning Plugin
Post by: JGM on August 11, 2007, 02:53:01 am
Thanks for that - applied that to one of my own projects and it worked quite well so far. :D

Thanks to you and all the developers working to make codeblocks the best tool and programmers friend. Is good to know plugin is working well. :)

BTW: Don't you wanna put this under SVN version control.

It's true! I just thought that it was a small project without a big need to make that, but well, I will do it. I'm not familiar with berlios, I prefer sourceforge, but I think that like codeblocks is there I can associate the plugin with codeblocks.

Does I'm correct?  :?:
Title: Re: AutoVersioning Plugin
Post by: MortenMacFly on August 11, 2007, 07:37:07 am
but I think that like codeblocks is there I can associate the plugin with codeblocks.
Does I'm correct?  :?:
More or less - you can reference the C::B project. My intention was only to have all under one place. Thus is you search through BerliOS for C::B you will get the most important parts. Of course other repros are OK, too (like some plugins are also under google code)... Surely completely up to you - what ever is comfortable enough.
With regards, Morten.
Title: Re: AutoVersioning Plugin
Post by: JGM on August 13, 2007, 03:59:32 pm
Surely completely up to you - what ever is comfortable enough.

Well, registered an account on berlios, created the new project AutoVersioning, and still waiting for the confirmation email for approve. More than 24 hours has passed. I guess they are really busy with a lot of work.
Title: Re: AutoVersioning Plugin
Post by: JGM on August 16, 2007, 02:49:55 am
I'm still waiting for the confirmation email of the project AutoVersioning at berlios without a response. I'm getting frustrated. :(

Does this means they doesn't accept it?
Title: Re: AutoVersioning Plugin
Post by: dmoore on August 16, 2007, 03:18:32 am
from memory I think it took well over a week for my confirmation to come through... berlios are pretty frustrating. if you're located in europe it probably makes sense to use them, but in addition to the long project confirmation delay and generally patchy services you get to enjoy:
* lack of documentation (at least english)
* slow connection from the US
* crappy admin controls (excruciating to add file releases, especially with the clumsy anonymous ftp)
* incorrectly signed security certificates

fortunately the Berlios SVN server has been rock solid every time i've had to commit. if that doesn't change i'll probably to continue to use them...
Title: Re: AutoVersioning Plugin
Post by: JGM on August 21, 2007, 09:52:20 pm
The autoversioning plugin was approved at berlios :D

Here is the hyperlink https://developer.berlios.de/projects/autoversioning/

Just uploaded the file and screenshots and edited the project info, now I have to set the svn, but I have to wait 6 hours.  :)

If any body wants to join the project for development just send me a private message.
Title: Re: AutoVersioning Plugin
Post by: JGM on September 04, 2007, 04:23:09 am
Auto Versioning new Feature:

Finally I took the time to implement the changes log generator.  :D

This is some Output example of the change log generator:
Code
03 September 2007
   released version 0.7.34 of AutoVersioning-Linux

     Change log:
        -Fixed: pointer declaration
        -Bug: blah blah

02 September 2007
   released version 0.7.32 of AutoVersioning-Linux

     Change log:
        -Documented some areas of the code
        -Reorganized the code for readability

01 September 2007
   released version 0.7.30 of AutoVersioning-Linux

     Change log:
        -Edited the change log window
        -If the change log windows is leave blank no changes.txt is modified


Check the first post for download and screenshots (I have to update the sources on berlios now :?)
Title: Re: AutoVersioning Plugin
Post by: MortenMacFly on September 05, 2007, 02:30:33 pm
(I have to update the sources on berlios now :?)
In case you did this: I have no more access to the repository. Neither by any client software nor via the BerliOS (anonymous) interface. The error is 403 - access forbidden. I guess you misconfigured something, maybe...?!
Title: Re: AutoVersioning Plugin
Post by: Kalma on September 06, 2007, 01:26:58 pm
Hello, It seems to me that this is usefull plugin for that nice IDE,
but I can't find any link to the sources or binaries, so could smeone give
me a link to the soures or binaries?
Title: Re: AutoVersioning Plugin
Post by: JGM on September 06, 2007, 03:06:12 pm
In case you did this: I have no more access to the repository. Neither by any client software nor via the BerliOS (anonymous) interface. The error is 403 - access forbidden. I guess you misconfigured something, maybe...?!

Sorry for the delay, my baby got sick and I was running up and down, to pediatricians, but thanks to God all is fine. :)

I disabled the svn to see if the revision control is reset. I will like to create a separate revision control inside a trunk folder, but don't know how, the revision control is global to the autoversioning folder. I need some help with the svn stuff. :?

Also I see that it is not possible to delete file releases and packages? and I disabled it too to see if in the next 6 hours crons job everythins is fresh (reset). Because I created some packages with the wrong names and duplicated releases.

Hello, It seems to me that this is usefull plugin for that nice IDE,
but I can't find any link to the sources or binaries, so could smeone give
me a link to the soures or binaries?

For now you can download it from this forum on the first post (http://forums.codeblocks.org/index.php/topic,6294.msg48225.html#msg48225) of this topic, you have to be logged in to download the attachment, here is the url:
http://forums.codeblocks.org/index.php?action=dlattach;topic=6294.0;attach=2256 (http://forums.codeblocks.org/index.php?action=dlattach;topic=6294.0;attach=2256)

The sources are compressed in 7-zip format
Title: Re: AutoVersioning Plugin
Post by: Kalma on September 07, 2007, 02:34:55 pm
Thank you, I doesn`t know, that I must be loged in to see the attachments.  :)
Title: Re: AutoVersioning Plugin
Post by: Laslie on September 07, 2007, 03:19:35 pm
Great thing!
I try compile it but I get some error message. :(
Quote
D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:: In member function `void AutoVersioning::GenerateChanges()':
D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:642: warning: unused variable 'date'
.objs\avSvnRevision.o:: In function `Z8QuerySvnRK8wxStringRS_S2_':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/avSvnRevision.cpp:28: undefined reference to `TiXmlDocument::Parse(char const*, TiXmlParsingData*, TiXmlEncoding)'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\avSvnRevision.cpp:39: undefined reference to `TiXmlElement::GetText() const'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\avSvnRevision.cpp:40: undefined reference to `TiXmlElement::GetText() const'
.objs\AutoVersioning.o:: In function `ZN14AutoVersioning8OnAttachEv':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/AutoVersioning.cpp:92: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:92: undefined reference to `_imp___ZNK7Manager12GetAppWindowEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:97: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:97: undefined reference to `_imp__cbEVT_COMPILER_STARTED'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:97: undefined reference to `_imp___ZN7Manager17RegisterEventSinkEiP17IEventFunctorBaseI15CodeBlocksEventE'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:98: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:98: undefined reference to `_imp__cbEVT_COMPILER_FINISHED'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:98: undefined reference to `_imp___ZN7Manager17RegisterEventSinkEiP17IEventFunctorBaseI15CodeBlocksEventE'
.objs\AutoVersioning.o:: In function `ZN14AutoVersioning17OnCompilerStartedER15CodeBlocksEvent':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/AutoVersioning.cpp:130: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:130: undefined reference to `_imp___ZNK7Manager17GetProjectManagerEv'
.objs\AutoVersioning.o:: In function `ZN14AutoVersioning18OnCompilerFinishedER15CodeBlocksEvent':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/AutoVersioning.cpp:171: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:171: undefined reference to `_imp___ZNK7Manager17GetProjectManagerEv'
.objs\AutoVersioning.o:: In function `ZN14AutoVersioning13OnTimerVerifyER12wxTimerEvent':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/AutoVersioning.cpp:199: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:199: undefined reference to `_imp___ZNK7Manager17GetProjectManagerEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:216: undefined reference to `ProjectFile::GetFileState() const'
.objs\AutoVersioning.o:: In function `ZN14AutoVersioning20OnMenuAutoVersioningER14wxCommandEvent':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/AutoVersioning.cpp:238: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:238: undefined reference to `_imp___ZNK7Manager17GetProjectManagerEv'
.objs\AutoVersioning.o:: In function `ZN14AutoVersioning19OnMenuCommitChangesER14wxCommandEvent':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/AutoVersioning.cpp:280: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:280: undefined reference to `_imp___ZNK7Manager17GetProjectManagerEv'
.objs\AutoVersioning.o:: In function `ZN14AutoVersioning10OnUpdateUIER15wxUpdateUIEvent':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/AutoVersioning.cpp:304: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:304: undefined reference to `_imp___ZNK7Manager17GetProjectManagerEv'
.objs\AutoVersioning.o:: In function `ZN14AutoVersioning19UpdateVersionHeaderEv':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/AutoVersioning.cpp:418: undefined reference to `_impInfo: resolving vtable for TiXmlDocumentby linking to __imp___ZTV13TiXmlDocument (auto-import)
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:418: undefined reference to `_imp___ZNK7Manager17GetProjectManagerEv'
.objs\AutoVersioning.o:: In function `ZN14AutoVersioning13CommitChangesEv':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/AutoVersioning.cpp:546: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:546: undefined reference to `_imp___ZNK7Manager17GetProjectManagerEv'
.objs\AutoVersioning.o:: In function `ZN14AutoVersioning15GenerateChangesEv':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/AutoVersioning.cpp:628: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:628: undefined reference to `_imp___ZNK7Manager17GetProjectManagerEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:630: undefined reference to `_imp___ZN7Manager3GetEv'
:D:\Letoltes\CodeBlocks\plugin\AutoVersioning\0.7\AutoVersioning.cpp:630: undefined reference to `_imp___ZNK7Manager12GetAppWindowEv'
.objs\AutoVersioning.o:: In function `ZN14AutoVersioningC1Ev':D:/Letoltes/CodeBlocks/plugin/AutoVersioning/0.7/AutoVersioning.cpp:78: undefined reference to `_imp___Z11PlaceWindowP16wxTopLevelWindow17cbPlaceDialogModeb'
.objs\AutoVersioning.o:: In function `ZN9__gnu_cxx13new_allocatorIPN14BlockAllocatorI15CodeBlocksEventLj75ELb0EE11LinkedBlockIS2_EEE10deallocateEPS6_j':C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_vector.h:(.rdata$_ZTV14AutoVersioning[vtable for AutoVersioning]+0x74): undefined reference to `cbPlugin::NotImplemented(wxString const&) const'
)]+0x7):: undefined reference to `_imp___ZN7Manager3GetEv'
)]+0x11):: undefined reference to `_imp___ZNK7Manager16GetPluginManagerEv'
)]+0x3c):: undefined reference to `_imp___ZN13PluginManager14RegisterPluginERK8wxStringPFP8cbPluginvEPFvS4_EPFvPiS9_S9_E'
:: === Build finished: 24 errors, 1 warnings ===

I downloaded latest C::B source from SVN for header files. Recompile wxWidget 2.8.4 with Unicode.
What I doing wrongly? Can anybody help me?
Title: Re: AutoVersioning Plugin
Post by: JGM on September 11, 2007, 04:07:36 pm
Finally, deleted the svn repos created on autoversioning folder using ssh and moved the official autoversioning plugin files to autoversioning/trunk, now waiting for the 6 hours cron. Now I have a separate folder for the svn  of the offical autoversioning files instead of the global svn autoversioning folder

Now I have to figure out how to delete the "packages and releases" on the files section of the project, any suggestions?

I'm new to this of ssh, never heard of it until now.   :mrgreen:
Title: Re: AutoVersioning Plugin
Post by: Kalma on September 11, 2007, 04:47:53 pm
@Laslie
Hello, I' have only had one of this this problems, since I have linked the Autorevision plugin directly against the codeblocks.dll. It was the auto-import error against a symbol in tinyXML, so I tried to link it against the tinyXML static lib and everything works well, hopefully this could help you.
Title: Re: AutoVersioning Plugin
Post by: JGM on September 16, 2007, 07:22:04 am
I have took the time to add some documentation in to the codeblocks wiki about the autoversioning plugin.  :D My wife also created me some simple logo  :D

Here is the url http://wiki.codeblocks.org/index.php?title=AutoVersioning.

I don't think is perfect and good enough for a beginner to understand. :?:

Edit: Added some new content and some changes
Title: Re: AutoVersioning Plugin
Post by: JGM on September 17, 2007, 02:44:57 am
New version of the plugin 0.8, just added a simple thing, a header language selector. Updated the sources on the first post of this topic and committed the changes to svn sources at berlios to revision 2.

Now the plugin supports the C language by eliminating the namespace AutoVersion.
New option is available on the settings tab. See the plugin documentation at the wiki for new screen shots.

http://wiki.codeblocks.org/index.php?title=AutoVersioning
Title: Re: AutoVersioning Plugin
Post by: JGM on September 17, 2007, 03:33:26 am
Reorganized the plugin documentation on the wiki.
Title: Re: AutoVersioning Plugin
Post by: Laslie on September 17, 2007, 03:12:55 pm
@Kalma
Thank you! In this way succeeded.
Title: Re: AutoVersioning Plugin
Post by: Laslie on September 17, 2007, 03:22:21 pm
JGM!
When I install Autoversioning 0.8 plugin with Manage plugin dialog, I get an error.
I use C::B SVN 4466, wxWidgets 2.8.4.
Can you help me?

[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: JGM on September 17, 2007, 04:26:20 pm
JGM!
When I install Autoversioning 0.8 plugin with Manage plugin dialog, I get an error.
I use C::B SVN 4466, wxWidgets 2.8.4.
Can you help me?

Hi Laslie,

I just compiled the pluging using the codeblocks.dll and wxmsw28u_gcc_cb.dll from revision 4472 nightly compiled by killerbot here (http://forums.codeblocks.org/index.php/topic,6930.0.html) without problem. I uploaded the file to the berlios project page. Here is the download link:

http://prdownload.berlios.de/autoversioning/autoversioning-v0.8.win32.7z

I was'nt aware that it could be possible to link to dll's without the use of .a files  :oops:
Title: Re: AutoVersioning Plugin
Post by: Laslie on September 18, 2007, 09:12:57 am
Hi JGM!

Thank you for your reply. By you attached plugin file is correct. But my compiled plugin file is wrong. :(
Yes, I use latest C::B nightly build. So no matter, your plugin file is work. For me this will do.
Thank you again.
Title: Re: AutoVersioning Plugin
Post by: Laslie on September 18, 2007, 01:01:17 pm
JGM!

I compiled it successfully. :)
One small change:
- on Linker settings tab, link library wxmsw28u -> wxmsw28u_gcc_cb
Title: Re: AutoVersioning Plugin
Post by: JGM on September 18, 2007, 02:17:26 pm
One small change:
- on Linker settings tab, link library wxmsw28u -> wxmsw28u_gcc_cb

Yep, that does the job.  :)

I think there should be documentation on the wiki covering how to compile a plugin using a nightly compiled version on windows. If some administrator read this, does this kind of documentation should be done?
Title: Re: AutoVersioning Plugin
Post by: dmoore on September 18, 2007, 04:03:48 pm
anyone with an account can add and edit wiki pages.
Title: Re: AutoVersioning Plugin
Post by: JGM on September 20, 2007, 07:32:16 pm
Added ubuntu 7.04 Binary compiled with rev. 4446 and wxWidgets 2.8.4 of deb http://apt.tt-solutions.com/ubuntu/ feisty main.

http://prdownload.berlios.de/autoversioning/autoversioning-v0.8.ubuntu.7z
Title: Re: AutoVersioning Plugin
Post by: gd_on on September 22, 2007, 05:11:30 pm
Hi,
thanks for this binary version of your plugin.
Just a small problem under Windows (2000 and XP Pro). There is a misalignment in a Setting window as shown in the attachment.

Gd_on


[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: JGM on September 24, 2007, 03:39:06 pm
Just a small problem under Windows (2000 and XP Pro). There is a misalignment in a Setting window as shown in the attachment.

Hi gd_on, thanks for the report

Fixed and committed the changes to svn. Now the radiobox options are horizontaly aligned.

Also added the wxscintilla path to the windows project.
Title: Re: AutoVersioning Plugin
Post by: gd_on on September 24, 2007, 07:59:24 pm
Thanks,
I'm just waiting for an update of the binary version. :lol:

Gd_on
Title: Re: AutoVersioning Plugin
Post by: Denis on September 28, 2007, 06:58:44 am
Thanks for this plugin! :-)
Is it possible to add ability to insert version data into exe-file info for windows?
Title: Re: AutoVersioning Plugin
Post by: kisoft on September 28, 2007, 02:29:13 pm
Thank you for plugin, JGM!

I download (svn) sources from repository now (rev. 4) and found some problems:
 - You wrongly being used _("... ...") construction. For example in file avSvnRevision.cpp
Code
wxString svncmd = _("svn info --xml --non-interactive ");
   Look Wiki for used this construction (http://wiki.codeblocks.org/index.php?title=Unicode_Standards (http://wiki.codeblocks.org/index.php?title=Unicode_Standards)):
Code
 _()

_() is used for text which might be translated to other user-languages
I does change this line on this:
Code
wxString svncmd = _T("svn info --xml --non-interactive ");
I found a big lot similarly uses.

Summary. You must being used _() for text which might be translated to other user-languages and _T() (or wxT()) for keywords.

I being used Russian translation codeblocks.mo for C::B and my plugin. Some keywords in version.ini file in Russian too.

C::B crushed on uninstall you plugin. :(
Somebody may confirm it?

Can do you make changes for right using _() and _T() (or wxT())?

Now I try changes sources for test my opinion.

Good luck!
Title: Re: AutoVersioning Plugin
Post by: JGM on October 02, 2007, 01:03:44 am
Thank you for plugin, JGM!

I download (svn) sources from repository now (rev. 4) and found some problems:
 - You wrongly being used _("... ...") construction. For example in file avSvnRevision.cpp

Yep thats true I have to fix all that, I just recently learned that while making an application I'm working on multilingual.  :oops: I'm learning every day new things. I have to work on so many things on my job, I have stopped programming to set a proxy server to block all kind of bad things from the students of the school I'm working on.

Trying to figure out how works squid and squidguard, is really a pain in the (you know) :) But I'm almost getting it all to place. First I had to repair a server, configure the array of hard drives and then install the operating system (opted for ubuntu server). Now I'm stuck at squid and squidguard, so many commands :?. transparent proxy blah blah blah. It's like a ghost in my mind  :shock:

Back into post I will fix that as soon as possible. I feel exhausted of so many research on so many things  :?
Title: Re: AutoVersioning Plugin
Post by: JGM on October 02, 2007, 01:06:39 am
Thanks for this plugin! :-)
Is it possible to add ability to insert version data into exe-file info for windows?

Some time ago it was opted to make a plugin named version info to generate the rc file with info from the autoversioning plugin. I was going to make that, but I forgot it. :shock:
Title: Re: AutoVersioning Plugin
Post by: JGM on October 02, 2007, 07:25:48 am
- You wrongly being used _("... ...") construction. For example in file avSvnRevision.cpp

Fixed and committed to revision 6  :D
Title: Re: AutoVersioning Plugin
Post by: kisoft on October 02, 2007, 07:55:09 am
- You wrongly being used _("... ...") construction. For example in file avSvnRevision.cpp

Fixed and committed to revision 6  :D
Thank you!
I does checkout rev.6 sources and I would try your plugin today. Look is better, at first sight.

Usually I being formed .pot file and edit this file into poEdit (for translate to Russian).
"Wrong" lines is very visible. Anyway this method very suit for me.

Good Luck!
Title: Re: AutoVersioning Plugin
Post by: flowercold on October 06, 2007, 08:16:41 am
I need it!
Thank you !
Title: Re: AutoVersioning Plugin
Post by: Denis on October 06, 2007, 12:20:26 pm
Some time ago it was opted to make a plugin named version info to generate the rc file with info from the autoversioning plugin. I was going to make that, but I forgot it. :shock:
I think if autoversioning plugin will be able to generate rc file for exe-file version info, it will be great :)
Title: Re: AutoVersioning Plugin
Post by: gd_on on October 06, 2007, 11:13:18 pm
Codeblocks crashes when I try to compile a program and autoversioning is enabled. Nothing displayed in the log window. All is ok if autoversioning is disabled. It's the same problem with version 0.8 windows binary prebuilt, or a 0.82 version I have just built with codeblocks version 4514.
Here is the beginning of codeblocks.rpt :
Error occured on Saturday, October 6, 2007 at 16:34:20.

C:\CodeBlocks_src\src\output\codeblocks.exe caused an Integer Divide By Zero at location 7035d285 in module C:\CodeBlocks_src\src\output\share\codeblocks\plugins\autoversioning.dll.

Registers:
eax=00000782 ebx=00b50f88 ecx=0023ea2c edx=00000000 esi=64cb18a8 edi=0023f2f8
eip=7035d285 esp=0023e9b8 ebp=0023eaa0 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206

Call stack:
7035D285  C:\CodeBlocks_src\src\output\share\codeblocks\plugins\autoversioning.dll:7035D285
70358F9A  C:\CodeBlocks_src\src\output\share\codeblocks\plugins\autoversioning.dll:70358F9A
70373234  C:\CodeBlocks_src\src\output\share\codeblocks\plugins\autoversioning.dll:70373234
.....

Here is the version.ini I use if it's can help :

Major=3
Minor=0
Build\ Number=12
Revision=45
Build\ Count=11
Auto\ Increment=0
Dates=1
Svn=0
Svn\ Directory=C:\\Documents and Settings\\Gerard\\Mes documents\\Programmes en C\\Dev_C\\Appli1_Tcltk dll V3
Commit=0
Commit\ Ask=0
Langage=C
Etat=Beta
Status\ Abbreviation=b
Minor\ Max=100
Build\ Max=0
Revision\ Max=0
Revision\ Random\ Max=0
Build\ Times\ To\ Minor\ Increment=100
Changes\ Log=0
Changes\ Title=released version %M.%m.%b of %p
Build\ History=0
Modifié=1
Language=C
Status=Beta
Modified=1

Thanks

gd_on
Title: Re: AutoVersioning Plugin
Post by: JGM on October 07, 2007, 01:30:15 am
Codeblocks crashes when I try to compile a program and autoversioning is enabled. Nothing displayed in the log window. All is ok if autoversioning is disabled. It's the same problem with version 0.8 windows binary prebuilt, or a 0.82 version I have just built with codeblocks version 4514.

OOOPS!  :? thanks for the report.

The problem is the Revision random maximum on the scheme tab, is set to 0. You have to set it to a minimum of 1. I will add some code to detect if the user enters 0 and substitute the value to a default of 1.

Again, thanks for the report!  :D
Title: Re: AutoVersioning Plugin
Post by: JGM on October 07, 2007, 01:31:35 am
I need it!
Thank you !

You're welcome!  :D
Title: Re: AutoVersioning Plugin
Post by: JGM on October 09, 2007, 03:43:45 am
Well finally, new version 0.9 compiled and ready to install, with corrections to the problems marked by users since version 0.8

Check the first post for the recent list of changes on page 1 of this topic or the links above in my signature.
Title: Re: AutoVersioning Plugin
Post by: Jeisson on October 09, 2007, 10:26:19 pm
I beg your pardon if these questions are posted already. I am using wx in unicode, so when I try to convert a char[] static variable to unicode, I get errors:
Code
// This line in MainFrame.cpp
wxT(AutoVersion::YEAR)

// generate these errors:
MainFrame.cpp:344: error: `LAutoVersion' has not been declared
MainFrame.cpp:344: error: `YEAR' was not declared in this scope
MainFrame.cpp:344: warning: unused variable 'YEAR'

// And not used variables in version.h generate warnings:
.\version.h:9: warning: 'AutoVersion::YEAR' defined but not used
.\version.h:10: warning: 'AutoVersion::UBUNTU_VERSION_STYLE' defined but not used
//...

Have somebody experienced that problems? I think, warnings could be avoided if the plugin generated a class instead of a namespace.

Thanks a lot in advance!
Title: Re: AutoVersioning Plugin
Post by: JGM on October 10, 2007, 01:35:24 am
I beg your pardon if these questions are posted already. I am using wx in unicode, so when I try to convert a char[] static variable to unicode, I get errors:
Code
// This line in MainFrame.cpp
wxT(AutoVersion::YEAR)

// generate these errors:
MainFrame.cpp:344: error: `LAutoVersion' has not been declared

You don't have to beg anything, is fine, in fact, is a good question. Answering your question, well I tried to make the plug in general with variables using C/C++ standards, for convenience. :)

I personally use these custom functions using a wxwidgets compiled as unicode on linux and windows without any problems.

Code
//wxString to std::string
string ws2s(wxString as){
    return string(as.mb_str(wxConvISO8859_1));
}

//std::string to wxString
wxString s2ws(string s){
    return wxString((s).c_str(),wxConvISO8859_1);
}

//C string to wxString
wxString cs2ws(const char* s){
    return wxString(s,wxConvISO8859_1);
}

Code
MainFrame.cpp:344: error: `YEAR' was not declared in this scope
MainFrame.cpp:344: warning: unused variable 'YEAR'

// And not used variables in version.h generate warnings:
.\version.h:9: warning: 'AutoVersion::YEAR' defined but not used
.\version.h:10: warning: 'AutoVersion::UBUNTU_VERSION_STYLE' defined but not used
//...

I think, warnings could be avoided if the plugin generated a class instead of a namespace.

Good Idea  :) I doesn't thought that. Well I will leave the namespace, for some good reasons recommended by killerbot,  and add a static class inside, named VersionInfo (or something shorter, I don't know). So it will be like this:

AutoVersion::VersionInfo::Major

or

using namesapce AutoVersion;
VersionInfo::Major

Those warnings where peacing me off too :P

But I don't know how to do it with the C header version, to stop the warnings from coming. May be with a struct, i don't remember if struct's could be initialized on C. Well create some struct interface, declare a variable of class struct and initialize the values there for the users to use.

I will like to know the opinions of the people using the plug in before changing the code. So my eyes and ears are open  :)
Title: Re: AutoVersioning Plugin
Post by: Jeisson on October 10, 2007, 07:19:05 pm
Thanks JGM for your affable words. You are right, the conversion constructor for single byte strings to wxString works perfectly:

Code
wxString(AutoVersion::YEAR, wxConvISO8859_1)

I found a simpler solution for avoiding warning messages. Instead of generating global variables into the namespace, you could generate consts. Moreover, this change prevents the user can change the values accidentally. The following could be an example:

Code
#ifndef VERSION_H
#define VERSION_H

namespace AutoVersion{

//Date Version Types
static const char DATE[] = "10";
static const char MONTH[] = "10";
static const char YEAR[] = "2007";
static const double UBUNTU_VERSION_STYLE = 7.10;

//Software Status
static const char STATUS[] = "Alpha";
static const char STATUS_SHORT[] = "a";

//Standard Version Type
static const long MAJOR = 0;
static const long MINOR = 1;
static const long BUILD = 1;
static const long REVISION = 53;

//Miscellaneous Version Types
static const long BUILDS_COUNT = 65;
#define RC_FILEVERSION 0,1,1,53
#define RC_FILEVERSION_STRING "0, 1, 1, 53\0"
static const char FULLVERSION_STRING[] = "0.1.1.53";

}
#endif //VERSION_h

Simply, add the const reserved word in each declaration :D.
Thanks again for your amiability.
Title: Re: AutoVersioning Plugin
Post by: JGM on October 10, 2007, 08:36:18 pm
I found a simpler solution for avoiding warning messages. Instead of generating global variables into the namespace, you could generate consts. Moreover, this change prevents the user can change the values accidentally.

Great I test it and warnings are gone. Well I have committed the changes to svn.
Thanks for your help  :D
Title: Re: AutoVersioning Plugin
Post by: JGM on October 11, 2007, 12:52:16 am
C::B crushed on uninstall you plugin. :(
Somebody may confirm it?

Actually it only crashes on windows if you don't disable it before uninstalling it. I have tested it on ubuntu and it could be uninstalled without disabling it first. So it's may be a windows thing.
Title: Re: AutoVersioning Plugin
Post by: JGM on October 12, 2007, 07:30:57 am
Uploaded new binaries to berlios of revision 9, v0.9.1
Now variables are declared const to avoid warnings
Title: Re: AutoVersioning Plugin
Post by: Jeisson on November 01, 2007, 01:56:18 am
Hi JGM!

I have another question. Programs typically use 3 first values for displaying version: major.minor.buildNumber. Last one is autoincremented each time I press F9, so, my About dialog always shows a big unrealistic third number, something like 0.1.146.

I would like to increment them manually when I am releasing a public version (I can do it setting the "Commit changes" flag); but I want the plugin always updates dates and the Build Count, because they are useful in developing stage.

Would be it possible or am I configurating something wrong?
Thanks a lot in advance.
Title: Re: AutoVersioning Plugin
Post by: JGM on November 01, 2007, 02:34:03 am
Hi JGM!

I have another question. Programs typically use 3 first values for displaying version: major.minor.buildNumber. Last one is autoincremented each time I press F9, so, my About dialog always shows a big unrealistic third number, something like 0.1.146.

Hi, good to read from you. :)
Well the Build Number is supposed to increment every time you modify a file in the project, on the other hand Build count is the value that always increment before building/running (F9). So MAJOR, MINOR and BUILD are the values  to use in your case.

I would like to increment them manually when I am releasing a public version (I can do it setting the "Commit changes" flag); but I want the plugin always updates dates and the Build Count, because they are useful in developing stage.

Would be it possible or am I configurating something wrong?
Thanks a lot in advance.

That should be the default behavior. When updating version.h the dates are always updated to the actual, but the build count is only updated before compiling or running. It's a value supposed to indicate how many times we compile or run our program changed or unchanged, while Build Number increments with commit changes or auto only when changes on source are found.

You could test editing the scheme to set a build number maximum for example 100. Also try reading the documentation that I wrote on the C::B wiki, is on my signature, there is a short description of the values. Also posting your version.ini would be of help  :)

Any other questions, feel free to post :D
Title: Re: AutoVersioning Plugin
Post by: JGM on December 07, 2007, 09:20:55 pm
New update of the plugin:

[Changes 1.0]
  - Now the plugin uses the project file to store settings instead of the ini file, thanks to killerbot.
  - You can choose where to store the version.h header as change the filename.
  - You can choose where to store the changeslog as change the filename.
  - The settings tab option AutoIncrement has been changed to Do Autoincrement, because of some different behaviour.
  - Also the Commit Changes menu was renamed to Increment Version.
  - Now the version.h file is parsed to obtain the version values.
  - You will have to increment version before closing the project if changes, since it doesn't store the modified flag as a configuration anymore.
  - The build history is now part of the header file.
  - Many other internal changes thanks to killerbot.

check the first post for downloads or my signature.
Title: Re: AutoVersioning Plugin
Post by: pasgui on December 07, 2007, 09:55:41 pm
check the first post for downloads or my signature.

The link to the berlios project in your sig isn't correct.

regards, pasgui
Title: Re: AutoVersioning Plugin
Post by: Vuki on December 07, 2007, 11:26:16 pm
The link to the berlios project in your sig isn't correct.

It works if you add a missing 'g' at the end of the URL
Title: Re: AutoVersioning Plugin
Post by: JGM on December 07, 2007, 11:31:48 pm
The link to the berlios project in your sig isn't correct.

It works if you add a missing 'g' at the end of the URL

thanks! I corrected it, it seems that while editing the signature erased that letter accidentally.
Title: Re: AutoVersioning Plugin
Post by: Jeisson on December 09, 2007, 04:17:43 am
Hi JGM, nice read from you too! and I want to congratulate you for changes included in version 1.0 of the plugin.

You affably gave me an answer some posts before. Sorry I didn't replied it. I found an alternative to use the plugin. I enabled the "Commit changes" option, so when I press F9 the Revision number is not autoincrement. It happens until I enter to the Autoversioning editor and I change it manually. That works fine for me, because normally I only want to update dates and Build Count value in the executable file.

Now I am eager for tasting new changes in the plugin :D
So many thanks for you effort!
Title: Re: AutoVersioning Plugin
Post by: JGM on December 09, 2007, 03:39:26 pm
So many thanks for you effort!

You're welcome!

Still have to update the documentation page to reflect the new changes.
Title: Re: AutoVersioning Plugin
Post by: Jeisson on December 09, 2007, 04:56:44 pm
Hi JGM!.

I am trying to use the Change log feature. Is it possible to write changes in the log without incrementing the version?. For example. While I am working in the project, I fix a bug, so I want to track the change before I do some other tasks (and before I forget the change's details :D), but I am not ready for incrementing the version yet. So change events could be grouped by date then project version. That is only an idea, it seems laborious to implement...

I feel so thankful for the new changes.
Greetings!
Title: Re: AutoVersioning Plugin
Post by: JGM on December 09, 2007, 10:51:18 pm
I am trying to use the Change log feature. Is it possible to write changes in the log without incrementing the version?. For example. While I am working in the project, I fix a bug, so I want to track the change before I do some other tasks (and before I forget the change's details :D), but I am not ready for incrementing the version yet. So change events could be grouped by date then project version. That is only an idea, it seems laborious to implement...

That was something that I thought when implementing that feature of the plugin, but I did'nt do it because I was on a hurry :(. I was thinking on doing a data grid consisting of two cells, the first cell to select the type of changes as:
 1. Fixed
 2. New Feature
 3. etc...
and the second cell to write the description. And store those changes, until the user feel is time to make a release.

For example:
[Type]   [Description]
"Fixed" "Crash on destructor, deleting pointer already deleted"
"New"  "Now the user can modified some internal settings"

So the user should be able to write row by row the changes on the data grid and then choose when to write them to the change log, using the actual date that the user wrote the changes to the file, instead of storing the date when the user wrote the row in the data grid.

In that way the user will have the ability to keep adding to the list of changes every time he mades a change, and when hi finish the software, write the changes to the change log and the date he wrote the changes to the change log, so there should be an option where the user should be able to select if he wants the data grid to appear before compilation after a change has been made, and a button on the autoversioning dialog to show that data grid to edit or add rows of changes, even a menu item under the project menu named ChangeLog, to call the data grid.

I will implement that! :)
Title: Re: AutoVersioning Plugin
Post by: Jeisson on December 10, 2007, 12:41:19 am
Fantastic idea!

I plenty understand your hurry situation, I am in the same conditions :(. Of course, no stress, take all the time you need for the amusement adventure :D. I think is a very great job!, and again, thanks for sharing it with us.

Greetings :wink:
Title: Re: AutoVersioning Plugin
Post by: JGM on December 13, 2007, 08:43:00 am
FInally made the corresponding changes to the changes log editor, now it uses a data grid and has the ability to save the changes temporarily to write them later. Attached is a screenshot

Here is a sample output:
Code
13 December 2007
   released version 1.1.0 of AutoVersioning-Linux

     Change log:
        -Added: Now the changes log has a data grid
        -Applied: Nice drop down menu for the "Type" column

[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: JGM on December 13, 2007, 10:48:11 pm
Updated the wiki page to reflect the new changes of the plugin as the new changes log generator (v1.1)
Title: Re: AutoVersioning Plugin
Post by: foldingBLACKlinesSUCK on March 23, 2008, 03:38:37 am
Referring to Plugin included in CodeBlocks 8.02 (official release NOT SVN)

Quote
make.exe: Nothing to be done for `all'.
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings


1) Why does Build Count increment even if BUILD is NOT DONE as in above message? Could you please fix it? :(
    It makes sense that it increments if "Rebuild" is done / "Clean" + "Build" but not the above case.

2) Why does the Revision increment randomly. The use? ofcourse, we can choose not to use it. But still, isn't it redundant?

GREAT PLUGIN other than that  :P
Title: Re: AutoVersioning Plugin
Post by: JGM on March 23, 2008, 04:32:46 am
1) Why does Build Count increment even if BUILD is NOT DONE as in above message? Could you please fix it? :(
    It makes sense that it increments if "Rebuild" is done / "Clean" + "Build" but not the above case.

Well, build count is a value to keep track of every test we make, to know how many times we ran the program no matter what (good for our bosses, if any). For the exact times that you build the program you should use the BUILD variable not the BUILDS_COUNT

2) Why does the Revision increment randomly. The use? ofcourse, we can choose not to use it. But still, isn't it redundant?

That was a suggestion of Thomas if I recall correctly, and is similar in the way microsoft does it on their IDE's. You can set the incrementation value of random numbers to 1 and will eventually increment by one and not randomly (just set preferences on the scheme tab).

However, in some circles, it is also understood as:
  • major: must be a bigger number than the competitor's product
  • minor: increments with every new feature
  • release: increments by a random amount in regular intervals, even in absence of changes to code

There I found it, release is equivalent to revision on the autoversioning plugin
Title: Re: AutoVersioning Plugin
Post by: mariocup on April 12, 2008, 10:40:07 pm
Hi JGM,

i found a strange bug in your plugin.

How to reproduce:
1. Save two projects in a workspace
2. Close the workspace
3. Open a workspace in Code::Blocks that contains 2 projects
4. Select Project->Autoversioning

Now Autoversioning tries to configure the second project although the first project is activated. The strange thing is that if you open these projects (not from a workspace) everything works well.

Bye,

Mario
Title: Re: AutoVersioning Plugin
Post by: JGM on April 14, 2008, 06:47:23 pm
If I recall correctly that was a problem of codeblocks not notifying the activated project after a workspace is completely loaded. First it reads the workspace then activates the first project so autoversioning sets it as the activated project, then loads the seconds projects and activates it so autoversioning change to this project as the activated one. After all the projects are loaded codeblocks switch back to the first project as the activated one but the plugin doesn't get notified so here is why the plugin still manages the seconds project (last one) and not the activated one (first one).

Anyways I will make some deep test this night if I have the time, since now I'm self employed and I'm working really hard to get my company going on. Thanks for pointing the problem  :D
Title: Re: AutoVersioning Plugin
Post by: JGM on April 16, 2008, 05:50:26 am
Well I finally had the time to check the codeblocks sources, since I want to be able to create a patch ready to applied to svn. Well It has been a lot of time I doesn't saw c++ code, actually like 3 weeks, that's for me too many time :shock:

Well, mariocup  this is the event that was not getting notified the last time I worked with the plugin, with the situation that you described.

Code
void AutoVersioning::OnProjectActivated(CodeBlocksEvent& event)
{
if (IsAttached())
{
// switch to the settings of the now activated project [I assume it has already been loaded before this triggers]
m_Project = event.GetProject();
}
}

I haven't found the time to make another deep test since only I had the time to check the new sources and write this message, but I think is a codeblocks problem, like the other similar problem that I found with the oncompilerstartedevent that was fixed on codeblocks some hundred of revisions ago :D But when I make the deep test I will report back so developers could fix it if possible.

PS: That nick "mariocup" reminds me of the nintendo 64 game mario kart :) oohh those days!!
Title: Re: AutoVersioning Plugin
Post by: mandrav on April 16, 2008, 08:27:48 am
Quote
If I recall correctly that was a problem of codeblocks not notifying the activated project after a workspace is completely loaded.

I 'm not sure what your question exactly is but, trust me, this event gets sent alright.
Another event you might want to check out would be WORKSPACE_CHANGED...
Title: Re: AutoVersioning Plugin
Post by: JGM on April 16, 2008, 11:25:08 pm
I 'm not sure what your question exactly is but, trust me, this event gets sent alright.
Another event you might want to check out would be WORKSPACE_CHANGED...

Mandrav, you're the main creator of codeblocks (so you know what you're saying) and yes is been called right  :D
I found the bug, and was actually on this function

===========================================================
void AutoVersioning::OnProjectLoadingHook(cbProject* project, TiXmlElement* elem, bool loading)
{
   if(loading)
   {
       wxMessageBox(_T("Loading: ") + project->GetTitle());
      // TODO (KILLERBOT) : should we have default values, in case something would be missing ?
      // OPTI : we could choose not to write out default values in the xml --> smaller cbp
      avConfig Config;
      m_IsCurrentProjectVersioned = false; // default not active unless we find xml for it
      const TiXmlElement* Node = elem->FirstChildElement("AutoVersioning");
      if (Node)
      {
         m_IsCurrentProjectVersioned = true;
         TiXmlHandle Handle(const_cast<TiXmlElement*>(Node));
         if(const TiXmlElement* pElem = Handle.FirstChildElement("Scheme").ToElement())
         {
            int Help = 0;
            if(pElem->QueryIntAttribute("minor_max", &Help) == TIXML_SUCCESS)
            {
               Config.Scheme.MinorMax = static_cast<long>(Help);
            }
            if(pElem->QueryIntAttribute("build_max", &Help) == TIXML_SUCCESS)
            {
               Config.Scheme.BuildMax = static_cast<long>(Help);
            }
            if(pElem->QueryIntAttribute("rev_max", &Help) == TIXML_SUCCESS)
            {
               Config.Scheme.RevisionMax = static_cast<long>(Help);
            }
            if(pElem->QueryIntAttribute("rev_rand_max", &Help) == TIXML_SUCCESS)
            {
               Config.Scheme.RevisionRandMax = static_cast<long>(Help);
            }
            if(pElem->QueryIntAttribute("build_times_to_increment_minor", &Help) == TIXML_SUCCESS)
            {
               Config.Scheme.BuildTimesToIncrementMinor = static_cast<long>(Help);
            }
         }
         if(const TiXmlElement* pElem = Handle.FirstChildElement("Settings").ToElement())
         {
            Config.Settings.Language = pElem->Attribute("language");
            Config.Settings.SvnDirectory = pElem->Attribute("svn_directory");
            Config.Settings.HeaderPath = pElem->Attribute("header_path");

            int Help = 0;
            if(pElem->QueryIntAttribute("autoincrement", &Help) == TIXML_SUCCESS)
            {
               Config.Settings.Autoincrement = Help?true:false;
            }
            if(pElem->QueryIntAttribute("date_declarations", &Help) == TIXML_SUCCESS)
            {
               Config.Settings.DateDeclarations = Help?true:false;
            }
            if(pElem->QueryIntAttribute("do_auto_increment", &Help) == TIXML_SUCCESS)
            {
               Config.Settings.DoAutoIncrement = Help?true:false;
            }
            if(pElem->QueryIntAttribute("ask_to_increment", &Help) == TIXML_SUCCESS)
            {
               Config.Settings.AskToIncrement = Help?true:false;
            }
            if(pElem->QueryIntAttribute("svn", &Help) == TIXML_SUCCESS)
            {
               Config.Settings.Svn = Help?true:false;
            }
         }
         if(const TiXmlElement* pElem = Handle.FirstChildElement("Changes_Log").ToElement())
         {
            Config.ChangesLog.AppTitle = pElem->Attribute("app_title");
            Config.ChangesLog.ChangesLogPath = pElem->Attribute("changeslog_path");

            int Help = 0;
            if(pElem->QueryIntAttribute("show_changes_editor", &Help) == TIXML_SUCCESS)
            {
               Config.ChangesLog.ShowChangesEditor = Help?true:false;
            }
         }
      }
      avVersionState VersionState;
      m_versionHeaderPath = FileNormalize(cbC2U(Config.Settings.HeaderPath.c_str()),project->GetBasePath());

      avHeader VersionHeader;
        if(VersionHeader.LoadFile(m_versionHeaderPath))
        {
            VersionState.Values.Major = VersionHeader.GetValue(_("MAJOR"));
            VersionState.Values.Minor = VersionHeader.GetValue(_("MINOR"));
            VersionState.Values.Build = VersionHeader.GetValue(_("BUILD"));
            VersionState.Values.Revision = VersionHeader.GetValue(_("REVISION"));
            VersionState.Values.BuildCount = VersionHeader.GetValue(_("BUILDS_COUNT"));
            VersionState.Status.SoftwareStatus = cbU2C(VersionHeader.GetString(_("STATUS")));
            VersionState.Status.Abbreviation = cbU2C(VersionHeader.GetString(_("STATUS_SHORT")));
            VersionState.BuildHistory = VersionHeader.GetValue(_("BUILD_HISTORY"));
        }
      m_ProjectMap[project] = Config;
      m_ProjectMapVersionState[project] = VersionState;
      m_Project = project; //Here is the bug
   }
   else
   {
        wxMessageBox(_T("Saving: ") + project->GetTitle());
      // Hook called when saving project file.

      // since rev4332, the project keeps a copy of the <Extensions> element
      // and re-uses it when saving the project (so to avoid losing entries in it
      // if plugins that use that element are not loaded atm).
      // so, instead of blindly inserting the element, we must first check it's
      // not already there (and if it is, clear its contents)
      if(m_IsCurrentProjectVersioned)
      {
         TiXmlElement* node = elem->FirstChildElement("AutoVersioning");
         if (!node)
         {
            node = elem->InsertEndChild(TiXmlElement("AutoVersioning"))->ToElement();
         }
         node->Clear();

         //Used this instead of GetConfig() since if the project is not activated
         //before saving, then the m_Project is not updated.
         //This will happen when having multiple projects opened.
         avConfig NewConfig = m_ProjectMap[project];

         TiXmlElement Scheme("Scheme");
         Scheme.SetAttribute("minor_max", NewConfig.Scheme.MinorMax);
         Scheme.SetAttribute("build_max", NewConfig.Scheme.BuildMax);
         Scheme.SetAttribute("rev_max", NewConfig.Scheme.RevisionMax);
         Scheme.SetAttribute("rev_rand_max", NewConfig.Scheme.RevisionRandMax);
         Scheme.SetAttribute("build_times_to_increment_minor", NewConfig.Scheme.BuildTimesToIncrementMinor);
         node->InsertEndChild(Scheme);
         TiXmlElement Settings("Settings");
         Settings.SetAttribute("autoincrement", NewConfig.Settings.Autoincrement);
         Settings.SetAttribute("date_declarations", NewConfig.Settings.DateDeclarations);
         Settings.SetAttribute("do_auto_increment", NewConfig.Settings.DoAutoIncrement);
         Settings.SetAttribute("ask_to_increment", NewConfig.Settings.AskToIncrement);
         Settings.SetAttribute("language", NewConfig.Settings.Language.c_str());
         Settings.SetAttribute("svn", NewConfig.Settings.Svn);
         Settings.SetAttribute("svn_directory", NewConfig.Settings.SvnDirectory.c_str());
         Settings.SetAttribute("header_path", NewConfig.Settings.HeaderPath.c_str());
         node->InsertEndChild(Settings);
         TiXmlElement ChangesLog("Changes_Log");
         ChangesLog.SetAttribute("show_changes_editor", NewConfig.ChangesLog.ShowChangesEditor);
         ChangesLog.SetAttribute("app_title", NewConfig.ChangesLog.AppTitle.c_str());
         ChangesLog.SetAttribute("changeslog_path", NewConfig.ChangesLog.ChangesLogPath.c_str());
         node->InsertEndChild(ChangesLog);
      }
      // TODO (KILLERBOT) : what if we decide to not version anymore : how to remove ??
   }
}// OnProjectLoadingHook
===========================================================

well that statement ( m_Project = project;) should be only called when the project is activated not when loading oops   :oops:

Now, I have found other bug  :(, the configuration stored on the project file is not working (to not say loading) fine when loading a workspace instead of a project directly. Im currently checking this.
Title: Re: AutoVersioning Plugin
Post by: JGM on April 16, 2008, 11:39:56 pm
Now, I have found other bug  :(, the configuration stored on the project file is not working (to not say loading) fine when loading a workspace instead of a project directly. Im currently checking this.

Ok, I found what the problem is, bool m_IsCurrentProjectVersioned is a member variable of the main autoversioning class (global variable) and it should be a member of the project struct.

Oh men, this are really silly things :P
Title: Re: AutoVersioning Plugin
Post by: JGM on April 16, 2008, 11:54:16 pm
Problems fixed!

Now going to solve the problems pointed by jomeggs

Thanks mariocup and mandrave!
Title: Re: AutoVersioning Plugin
Post by: killerbot on April 16, 2008, 11:58:02 pm
Now, I have found other bug  :(, the configuration stored on the project file is not working (to not say loading) fine when loading a workspace instead of a project directly. Im currently checking this.

Ok, I found what the problem is, bool m_IsCurrentProjectVersioned is a member variable of the main autoversioning class (global variable) and it should be a member of the project struct.

Oh men, this are really silly things :P

or it is not correctly updated during switching of the projects ... ?
Title: Re: AutoVersioning Plugin
Post by: JGM on April 17, 2008, 01:07:58 am
or it is not correctly updated during switching of the projects ... ?

Yep, thats the problem, to stop the headache inmmediatley just replaced the member with this:
std::map<cbProject*, bool> m_IsVersioned;

The patch is attached to this message

Changes:

 - Now works correctly on workspaces
 - Warns when first time configuration and version.h exist on the projects path
 - Formats the header file name and uses it as the header guard

If you want to have a quick look
Code
Index: src/plugins/contrib/AutoVersioning/AutoVersioning.cpp
===================================================================
--- src/plugins/contrib/AutoVersioning/AutoVersioning.cpp (revision 5005)
+++ src/plugins/contrib/AutoVersioning/AutoVersioning.cpp (working copy)
@@ -65,7 +65,6 @@
     ProjectLoaderHooks::HookFunctorBase* AutoVerHook =

       new ProjectLoaderHooks::HookFunctor<AutoVersioning>(this, &AutoVersioning::OnProjectLoadingHook);

     m_AutoVerHookId = ProjectLoaderHooks::RegisterHook(AutoVerHook);

-    m_IsCurrentProjectVersioned = false;

     m_Modified = false;

     m_Project = 0;

 } // end of constructor
@@ -128,11 +127,11 @@
  // TODO (KILLERBOT) : should we have default values, in case something would be missing ?

  // OPTI : we could choose not to write out default values in the xml --> smaller cbp

  avConfig Config;

- m_IsCurrentProjectVersioned = false; // default not active unless we find xml for it

+ m_IsVersioned[project] = false; // default not active unless we find xml for it

  const TiXmlElement* Node = elem->FirstChildElement("AutoVersioning");

  if (Node)

  {

- m_IsCurrentProjectVersioned = true;

+ m_IsVersioned[project] = true;

  TiXmlHandle Handle(const_cast<TiXmlElement*>(Node));

  if(const TiXmlElement* pElem = Handle.FirstChildElement("Scheme").ToElement())

  {

@@ -215,7 +214,6 @@
         }

  m_ProjectMap[project] = Config;

  m_ProjectMapVersionState[project] = VersionState;

- m_Project = project;

  }

  else

  {

@@ -226,7 +224,7 @@
  // if plugins that use that element are not loaded atm).

  // so, instead of blindly inserting the element, we must first check it's

  // not already there (and if it is, clear its contents)

- if(m_IsCurrentProjectVersioned)

+ if(m_IsVersioned[project])

  {

  TiXmlElement* node = elem->FirstChildElement("AutoVersioning");

  if (!node)

@@ -281,7 +279,8 @@
  if (IsAttached())

  {

  m_ProjectMap.erase(event.GetProject());

- m_ProjectMapVersionState.erase(event.GetProject());

+ m_ProjectMapVersionState.erase(event.GetProject());
+        m_IsVersioned.erase(event.GetProject());

  if(m_Project == event.GetProject())

  {   // should always be the case (??? we hope ??)

      m_Project = 0;

@@ -294,7 +293,7 @@
 // be activated and each has the compilerstarted/Finished ?????
 void AutoVersioning::OnCompilerStarted(CodeBlocksEvent& event)
 {
-    if (m_Project && IsAttached() && m_IsCurrentProjectVersioned)

+    if (m_Project && IsAttached() && m_IsVersioned[event.GetProject()])

     {
  if (m_Modified)
  {
@@ -317,7 +316,7 @@
 
 void AutoVersioning::OnCompilerFinished(CodeBlocksEvent& event)
 {
-    if (m_Project && IsAttached() && m_IsCurrentProjectVersioned)

+    if (m_Project && IsAttached() && m_IsVersioned[event.GetProject()])

  {
  ++(GetVersionState().Values.BuildCount);
  }
@@ -325,7 +324,7 @@
 
 void AutoVersioning::OnTimerVerify(wxTimerEvent& event)
 {
-    if (m_Project && IsAttached() && m_IsCurrentProjectVersioned)

+    if (m_Project && IsAttached() && m_IsVersioned[m_Project])

     {
  if (!m_Modified)
  {
@@ -348,7 +347,7 @@
     {
         if (m_Project)
         {
-            if (m_IsCurrentProjectVersioned)
+            if (m_IsVersioned[m_Project])
             {
                 SetVersionAndSettings(*m_Project, true);
                 UpdateVersionHeader();
@@ -357,8 +356,20 @@
             {
                 if (wxMessageBox(_("Configure the project \"") + m_Project->GetTitle() + _("\" for Autoversioning?"),_("Autoversioning"),wxYES_NO) == wxYES)
                 {
+                    if(wxFileExists(m_Project->GetBasePath() + _T("version.h")))
+                    {
+                        wxMessageBox(
+                         _T("The header version.h already exist on your projects path. "
+                            "The content will be overwritten by the the version info generated code."
+                            "\n\nYou can change the default version.h file on the \"Settings\" Tab."
+                           ),
+                         _T("Warning"),
+                         wxICON_EXCLAMATION  | wxOK
+                        );
+                    }
+
  // we activated
- m_IsCurrentProjectVersioned = true;
+ m_IsVersioned[m_Project] = true;
  // just becasue we activated the project becomes modified
  m_Project->SetModified();
 
@@ -382,7 +393,7 @@
 
 void AutoVersioning::OnMenuCommitChanges(wxCommandEvent&)
 {
-    if (m_Project && IsAttached() && m_IsCurrentProjectVersioned)
+    if (m_Project && IsAttached() && m_IsVersioned[m_Project])
     {

         if(m_Modified)

         {
@@ -406,7 +417,7 @@
             {
                 event.Enable(true);
             }
-            else if (m_IsCurrentProjectVersioned)
+            else if (m_IsVersioned[m_Project])
             {
                 if (m_Modified)
                 {
@@ -528,9 +539,15 @@
 {
     m_timerStatus->Stop();
 
+    //Declares the header guard to be used based on the filename
+    wxFileName filename(cbC2U(GetConfig().Settings.HeaderPath.c_str()));
+    wxString headerGuard = filename.GetName() + _T("_") + filename.GetExt();
+    headerGuard.Replace(_T(" "), _T("_"), true);
+    headerGuard.UpperCase();
+
     wxString headerOutput = _T("");
-    headerOutput << _T("#ifndef VERSION_H") << _T("\n");
-    headerOutput << _T("#define VERSION_H") << _T("\n");
+    headerOutput << _T("#ifndef ") << headerGuard << _T("\n");
+    headerOutput << _T("#define ") << headerGuard  << _T("\n");
     headerOutput << _T("\n");
 
     if(cbC2U(GetConfig().Settings.Language.c_str()) == _T("C++"))
@@ -610,9 +627,9 @@
         headerOutput << _T("}") << _T("\n");
     }
 
-    headerOutput << _T("#endif //VERSION_h\n");
+    headerOutput << _T("#endif //") << headerGuard << _T("\n");
 
-    m_versionHeaderPath = FileNormalize(cbC2U(GetConfig().Settings.HeaderPath.c_str()),m_Project->GetBasePath());;
+    m_versionHeaderPath = FileNormalize(cbC2U(GetConfig().Settings.HeaderPath.c_str()),m_Project->GetBasePath());
     wxFile versionHeaderFile(m_versionHeaderPath, wxFile::write);
     versionHeaderFile.Write(headerOutput);
     versionHeaderFile.Close();
@@ -622,7 +639,7 @@
 
 void AutoVersioning::CommitChanges()
 {
-    if (m_Project && IsAttached() && m_IsCurrentProjectVersioned)
+    if (m_Project && IsAttached() && m_IsVersioned[m_Project])
     {
         if (m_Modified)
         {
Index: src/plugins/contrib/AutoVersioning/AutoVersioning.h
===================================================================
--- src/plugins/contrib/AutoVersioning/AutoVersioning.h (revision 5005)
+++ src/plugins/contrib/AutoVersioning/AutoVersioning.h (working copy)
@@ -56,10 +56,10 @@
     wxTimer* m_timerStatus;

     int m_AutoVerHookId; //!< project loader hook ID

     std::map<cbProject*, avConfig> m_ProjectMap;

-    std::map<cbProject*, avVersionState> m_ProjectMapVersionState;

+    std::map<cbProject*, avVersionState> m_ProjectMapVersionState;
+    std::map<cbProject*, bool> m_IsVersioned;

     cbProject* m_Project; // keeps track of the last 'activated' project
     bool m_Modified; // have some settings been modified

-    bool m_IsCurrentProjectVersioned;

     /// fires when a project is being loaded / saved

     void OnProjectLoadingHook(cbProject* project, TiXmlElement* elem, bool loading);

 

Index: src/plugins/contrib/AutoVersioning/manifest.xml
===================================================================
--- src/plugins/contrib/AutoVersioning/manifest.xml (revision 5005)
+++ src/plugins/contrib/AutoVersioning/manifest.xml (working copy)
@@ -3,7 +3,7 @@
     <SdkVersion major="1" minor="10" release="0" />

     <Plugin name="AutoVersioning">

         <Value title="AutoVersioning" />

-        <Value version="1.1" />

+        <Value version="1.2" />

         <Value description="Auto increments the version and build number of your application every time a change has been made and stores it in version.h with easy to use variable declarations. Also have a feature for committing changes a la SVN style, a version scheme editor and a change log generator.

 

 Example:

@@ -40,7 +40,7 @@
    static const char SVN_REVISION[]

    static const char SVN_DATE[]

 " />

-        <Value author="JGM" />

+        <Value author="Jefferson Gonzalez" />

         <Value authorEmail="jgmdev@gmail.com" />

         <Value authorWebsite="" />

         <Value thanksTo="Killerbot - Code Optimizations, conversion from version.ini to project file and many more...


[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: mandrav on April 17, 2008, 08:46:33 am
Well done JGM, sorting things out :)
Title: Re: AutoVersioning Plugin
Post by: JGM on April 17, 2008, 03:02:43 pm
Thank you, I have learned a lot from the codeblocks team (especially killerbot) :D
Title: Re: AutoVersioning Plugin
Post by: JGM on April 19, 2008, 12:44:55 am
Submitted the patch to berlios, so it doesn't get lost or forgetted
Title: Re: AutoVersioning Plugin
Post by: killerbot on April 19, 2008, 11:04:47 am
 :lol: wanted to apply the patch, couldn't find it at berlios, so was gonna use the above attached one, and I saw no differences  :? ----> biplab was way faster than me  :P
Title: Re: AutoVersioning Plugin
Post by: JGM on April 19, 2008, 08:05:17 pm
 :lol: thank you anyways!
Title: Re: AutoVersioning Plugin (Urgent)
Post by: JGM on April 21, 2008, 06:44:47 pm
Discovered a bug introduced by the new changes while using the plugin on the development of my simple application.

The plugin is not autoincrementing the values before compiling. Here is the fix for oncompiler started and oncompilerfinished:

==================================================
void AutoVersioning::OnCompilerStarted(CodeBlocksEvent& event)
{
    if (m_Project && IsAttached() && m_IsVersioned[m_Project])
    {
      if (m_Modified)
      {
         const bool doAutoIncrement = GetConfig().Settings.DoAutoIncrement;
         const bool askToIncrement = GetConfig().Settings.AskToIncrement;
         if (doAutoIncrement && askToIncrement)
         {
            if (wxMessageBox(_("Do you want to increment the version?"),_T(""),wxYES_NO) == wxYES)
            {
               CommitChanges();
            }
         }
         else if(doAutoIncrement)
         {
            CommitChanges();
         }
      }
    }
} // end of OnCompilerStarted

void AutoVersioning::OnCompilerFinished(CodeBlocksEvent& event)
{
    if (m_Project && IsAttached() && m_IsVersioned[m_Project])
   {
      ++(GetVersionState().Values.BuildCount);
   }
}
==================================================

I dont know why but the previous code wasn't working:
m_IsVersioned[event.GetProject()]

Maybe the function (event) wasn't passing the correct project pointer, I didn't deeply tested. I wanted to create a patch but I'm still downloading a fresh copy cb svn, since svn update sucks (I don't know how to manages it well)

I will provide a patch later since the checkouts takes an eternity :lol:
Title: Re: AutoVersioning Plugin
Post by: JGM on April 21, 2008, 11:36:28 pm
Here is the patch to resolve the bug:

Changes:
Now the auto incrementation is behaving normally again.

Quick look of the patch attached
Code
Index: src/plugins/contrib/AutoVersioning/AutoVersioning.cpp
===================================================================
--- src/plugins/contrib/AutoVersioning/AutoVersioning.cpp (revision 5010)
+++ src/plugins/contrib/AutoVersioning/AutoVersioning.cpp (working copy)
@@ -293,7 +293,7 @@
 // be activated and each has the compilerstarted/Finished ?????

 void AutoVersioning::OnCompilerStarted(CodeBlocksEvent& event)

 {

-    if (m_Project && IsAttached() && m_IsVersioned[event.GetProject()])

+    if (m_Project && IsAttached() && m_IsVersioned[m_Project])

     {

         if (m_Modified)

         {

@@ -316,7 +316,7 @@
 

 void AutoVersioning::OnCompilerFinished(CodeBlocksEvent& event)

 {

-    if (m_Project && IsAttached() && m_IsVersioned[event.GetProject()])

+    if (m_Project && IsAttached() && m_IsVersioned[m_Project])

     {

         ++(GetVersionState().Values.BuildCount);

     }

Index: src/plugins/contrib/AutoVersioning/manifest.xml
===================================================================
--- src/plugins/contrib/AutoVersioning/manifest.xml (revision 5010)
+++ src/plugins/contrib/AutoVersioning/manifest.xml (working copy)
@@ -3,7 +3,7 @@
     <SdkVersion major="1" minor="10" release="0" />

     <Plugin name="AutoVersioning">

         <Value title="AutoVersioning" />

-        <Value version="1.2" />

+        <Value version="1.3" />

         <Value description="Auto increments the version and build number of your application every time a change has been made and stores it in version.h with easy to use variable declarations. Also have a feature for committing changes a la SVN style, a version scheme editor and a change log generator.

 

 Example:


[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: killerbot on April 22, 2008, 08:32:27 am
I will apply it soon ;-)

However I think it is good to find out why that event.GetProject() *might* be incorrect ?
Could you specify how you saw this misbehavior and how easily we could reproduce it (workspace with project in a zip file or something)

We should find the real cause and fix it over there ;-)
Title: Re: AutoVersioning Plugin
Post by: JGM on April 22, 2008, 06:12:05 pm
I submitted the patch to berlios also.

I will make some testing this night if possible, to check if it is an autoversioning error not updating the m_Project pointer correctly or it's the event.getproject sending a diffrent pointer value, since the pointer by event.getproject is not found on the m_IsVersioned map :?
Title: Re: AutoVersioning Plugin
Post by: killerbot on April 22, 2008, 06:44:47 pm
okay I will wait till you have finished that experiment.
Title: Re: AutoVersioning Plugin
Post by: JGM on April 22, 2008, 06:54:28 pm
I have found the time in the day to do the testing since my daughter was sleeping so i waited until she woke up to go now to do some business  :D

Well the oncompilerstarted event.getproject is returning a null pointer 0

The test I made
===================================================
void AutoVersioning::OnCompilerStarted(CodeBlocksEvent& event)
{
    wxString print;
    print.Printf(_T("m_Project: %d event.GetProject: %d"),m_Project,event.GetProject());
    wxMessageBox(print);

    if (m_Project && IsAttached() && m_IsVersioned[m_Project])
    {
      if (m_Modified)
      {
         const bool doAutoIncrement = GetConfig().Settings.DoAutoIncrement;
         const bool askToIncrement = GetConfig().Settings.AskToIncrement;
         if (doAutoIncrement && askToIncrement)
         {
            if (wxMessageBox(_("Do you want to increment the version?"),_T(""),wxYES_NO) == wxYES)
            {
               CommitChanges();
            }
         }
         else if(doAutoIncrement)
         {
            CommitChanges();
         }
      }
    }
} // end of OnCompilerStarted
===================================================

Attached is a screenshot showing the results

[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: JGM on April 23, 2008, 04:31:17 pm
Should I submit a bug to berlios about the OnCompilerStarted event.GetProject() returning a null pointer?
Title: Re: AutoVersioning Plugin
Post by: killerbot on April 23, 2008, 04:39:12 pm
Should I submit a bug to berlios about the OnCompilerStarted event.GetProject() returning a null pointer?

yes please do that, and attach sample project/workspace if possible.
Title: Re: AutoVersioning Plugin
Post by: JGM on April 23, 2008, 06:02:30 pm
Ok, I made a bug report (id: 13676), but until the problem is solved the patch #2444 should be applied i think, since now the autoversioning plugin is not working properly:
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2444&group_id=5358

Code
Index: src/plugins/contrib/AutoVersioning/AutoVersioning.cpp
===================================================================
--- src/plugins/contrib/AutoVersioning/AutoVersioning.cpp (revision 5010)
+++ src/plugins/contrib/AutoVersioning/AutoVersioning.cpp (working copy)
@@ -293,7 +293,7 @@
 // be activated and each has the compilerstarted/Finished ?????

 void AutoVersioning::OnCompilerStarted(CodeBlocksEvent& event)

 {

-    if (m_Project && IsAttached() && m_IsVersioned[event.GetProject()])

+    if (m_Project && IsAttached() && m_IsVersioned[m_Project])

     {

         if (m_Modified)

         {

@@ -316,7 +316,7 @@
 

 void AutoVersioning::OnCompilerFinished(CodeBlocksEvent& event)

 {

-    if (m_Project && IsAttached() && m_IsVersioned[event.GetProject()])

+    if (m_Project && IsAttached() && m_IsVersioned[m_Project])

     {

         ++(GetVersionState().Values.BuildCount);

     }

Index: src/plugins/contrib/AutoVersioning/manifest.xml
===================================================================
--- src/plugins/contrib/AutoVersioning/manifest.xml (revision 5010)
+++ src/plugins/contrib/AutoVersioning/manifest.xml (working copy)
@@ -3,7 +3,7 @@
     <SdkVersion major="1" minor="10" release="0" />

     <Plugin name="AutoVersioning">

         <Value title="AutoVersioning" />

-        <Value version="1.2" />

+        <Value version="1.3" />

         <Value description="Auto increments the version and build number of your application every time a change has been made and stores it in version.h with easy to use variable declarations. Also have a feature for committing changes a la SVN style, a version scheme editor and a change log generator.

 

 Example:

Title: Re: AutoVersioning Plugin
Post by: Biplab on April 23, 2008, 07:29:13 pm
Ok, I made a bug report (id: 13676), but until the problem is solved the patch #2444 should be applied i think, since now the autoversioning plugin is not working properly:
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2444&group_id=5358

I've fixed the bug. So the patch may not be necessary. :)

I've fixed another minor bug in AutoVersioning plugin.



I think this patch is also necessary. If there are more than 2 targets, then the version.h will be added more than once.

Code
Index: src/plugins/contrib/AutoVersioning/AutoVersioning.cpp
===================================================================
--- src/plugins/contrib/AutoVersioning/AutoVersioning.cpp (revision 5016)
+++ src/plugins/contrib/AutoVersioning/AutoVersioning.cpp (working copy)
@@ -3,6 +3,7 @@
 #include <sdk.h>
 
 #ifndef CB_PRECOMP
+#include <wx/dynarray.h>
 #include <wx/file.h>
 #include <wx/filefn.h>
 #include <wx/ffile.h>
@@ -376,10 +377,12 @@
                     SetVersionAndSettings(*m_Project);
                     UpdateVersionHeader();
 
-                    for (int i = 1; i < m_Project->GetBuildTargetsCount(); ++i)
+                    wxArrayInt target_array;
+                    for (int i = 0; i < m_Project->GetBuildTargetsCount(); ++i)
                     {
-                        m_Project->AddFile(i, m_versionHeaderPath, true, true, 0);
+                        target_array.Add(i);
                     }
+                    Manager::Get()->GetProjectManager()->AddFileToProject(m_versionHeaderPath, m_Project, target_array);
                     Manager::Get()->GetProjectManager()->RebuildTree();
                     wxMessageBox(_("Project configured!"));
                 }
Title: Re: AutoVersioning Plugin
Post by: JGM on April 23, 2008, 08:00:15 pm
I've fixed the bug. So the patch may not be necessary. :)

That was fast :D

Quote
* Fixed: Refresh the project tree after AutoVersioning plugin configures a project.

Nice! Thanks!
Title: Re: AutoVersioning Plugin
Post by: Biplab on April 24, 2008, 01:38:55 pm
What do you think about the patch?

I didn't commit as I wasn't sure whether you want the plugin to be used only for release targets. :)
Title: Re: AutoVersioning Plugin
Post by: JGM on April 24, 2008, 05:19:40 pm
Um, the only problem is that the plugin would need to be completely modified to be able to handle multiple targets and save a different header file path for multiple targets, then store different autoversioning configurations on the project file for each target. Ask the user which target to configure, what is not capable since it's working on a project global manner.  I think is more than that patch. :?

But maybe I don't completely understand what you say and I'm wrong. :)
Title: Re: AutoVersioning Plugin
Post by: rododox on May 25, 2008, 02:23:20 pm

Hi

When I add the Autoversioning option to my project, it always autoincrement the build num (when i compile  the source) It's ok, but the number's also auto incremented when i click the run button in the IDE  (or from "Build->Run") . i think it musn't to that !

I'm using codeblocks under windows xp sp2, and i tried the autoversioning with the 8.02 release and the nightly build of 19/05/2008

thanks
Title: Re: AutoVersioning Plugin
Post by: JGM on May 26, 2008, 05:18:21 am
When I add the Autoversioning option to my project, it always autoincrement the build num (when i compile  the source) It's ok, but the number's also auto incremented when i click the run button in the IDE  (or from "Build->Run") . i think it musn't to that !

Did you mean the Build Count?
if yes then this value is to keep track of all test we make (builds, runs, debugs).

For the exact number of builds you should use Build Number.

I should change the Build Count label to something else (Concurrent Builds?) any suggestions are welcome since this is causing confusion :P
Title: Re: AutoVersioning Plugin
Post by: rododox on May 26, 2008, 07:16:21 pm
Quote
Did you mean the Build Count?

Yes, I mean "Build Count". I'm just a student and my english is not perfect but I think "Build Count" means the number of times we have build a project or , at least the number of times we have used the "make" command
I think it can be useful to have a box that autoincrement everytime we build (just building or rebuilding, without cleaning) the project , and his name can be... Build Count!!
And for test we make (builds, runs, debugs), you can name the box "Test count" or "Action Count"
Title: Re: AutoVersioning Plugin
Post by: JGM on June 04, 2008, 11:44:34 pm
And for test we make (builds, runs, debugs), you can name the box "Test count" or "Action Count"

Sorry for the delay, I have been busy developing 3 newspaper website with drupal and programming with php  :D
Didn't answered you since I really want to update the autoversioning plugin before, but didn't have the time to checkout some sources to create the appropriate patch. But well, thats a nice suggestion, "Action Count"  :) I have to update somethings as the documentation.
Title: Re: AutoVersioning Plugin
Post by: JGM on June 04, 2008, 11:49:08 pm
What do you think about the patch?

I didn't commit as I wasn't sure whether you want the plugin to be used only for release targets. :)

Now I understand your patch, I'm a moron :oops: sorry for that. Well is needed to only add the version.h once and not multiple times. Sorry again  :oops:
Title: Re: AutoVersioning Plugin
Post by: Arjan on June 23, 2008, 02:17:31 pm
I am using an .rc file with windows, and I would like to be able to put my SVN revision into my output file. Unfortunately, autoversion does not define SVN revision numbers (just declarations)

Could you add a define with the SVN revision?

thanks in advance!
Title: Re: AutoVersioning Plugin
Post by: Biplab on June 23, 2008, 05:15:38 pm
What do you think about the patch?

I didn't commit as I wasn't sure whether you want the plugin to be used only for release targets. :)

Now I understand your patch, I'm a moron :oops: sorry for that. Well is needed to only add the version.h once and not multiple times. Sorry again  :oops:

Sorry I didn't notice your reply. I have applied it in SVN. :)
Title: Re: AutoVersioning Plugin
Post by: Belgabor on July 13, 2008, 05:28:56 am
I recommend clarifying the svn error message. In many cases the directory isn't set wrong, but the user has not installed svn.exe (or forgot to update it to 1.5 along with TortoiseSVN as in my case...).
Title: Re: AutoVersioning Plugin
Post by: Arjan on August 01, 2008, 02:37:39 pm
As of today I got a problem with the autoversioning plugin.
Since it is now august, the Ubuntu version style has bumped up to 8.08;
I now get the following error message

Quote
version.h:10: digit exceeds base

pointing at this line:

Code
static const double UBUNTU_VERSION_STYLE = 8.08;

If I change the date back to July, the problem disappears again (ie. the version becomes 8.07). I can't explain this, but since it is related to the autoversioning plugin, I thought I should post it here.
Title: Re: AutoVersioning Plugin
Post by: JGM on August 01, 2008, 06:26:48 pm
Hi,

I made a test on linux (ubuntu hardy) with gcc 4.2.3 and it worked as expected, here is the code I used.

Code
#include <iostream>
#include "version.h"

using namespace std;

int main()
{
    cout << "Ubuntu Version: " << AutoVersion::UBUNTU_VERSION_STYLE << endl;
    return 0;
}

Outputs:
Quote
Ubuntu Version: 8.08

Can you give more details?

Maybe is the compiler.
Title: Re: AutoVersioning Plugin
Post by: Arjan on August 05, 2008, 11:41:30 am
compiler: $ ./g++.exe --version
g++.exe (GCC) 4.3.0 20080305 (alpha-testing) mingw-20080502
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

not sure how 4.3.0 got into my standard compile path, but this was indeed the problem.
With gcc 3.4.2 everything compiles as it should.

OS is windows btw.

So it's probably a compiler bug, but I would like to point out my previous post

I am using an .rc file with windows, and I would like to be able to put my SVN revision into my output file. Unfortunately, autoversion does not define SVN revision numbers (just declarations)

Could you add a define with the SVN revision?

thanks in advance!
Title: Re: AutoVersioning Plugin
Post by: riban on August 06, 2008, 09:07:55 pm
I also suffer from the problem described where the Ubuntu style date of 8.08 gives a compile error of "digit exceeds base". If I recompile immediately afterwards, the error does not occur. This is using gcc 3.4.5 (mingw-vista special) on winxp inside CodeBlocks 8.02. The problem does seem to have started in August. It is as if the compiler sees this as an ocatal value hence a vaule of 8 is too high (0 - 7). It is very odd that this error occurs only the first time after each edit. Second compile is always okay.
Further investigation show it is windres that is throwing up the error. I haven't yet found how to deal with this. It seems that including version.h in resources.rc upsets windres when there is a number defined with a leading 0 which I guess windres is interpreting as an octal number. I am currently trying to remove the Ubuntu style stuff from the plugin as I don't need it anyway.
Title: Re: AutoVersioning Plugin
Post by: JGM on August 07, 2008, 01:35:04 am
Thanks!

I will change the code to generate the declaration as a string instead of a numeric value.
That should fix it i think.
Title: Re: AutoVersioning Plugin
Post by: MaxLondon on August 09, 2008, 11:44:32 pm
Hi,

AutoVersioning is a really useful plugin for me. So, thanks for having developed it :)


How difficult would it be to include Preprocessor #define's of the values, especially of the version and build numbers and status?

e.g.:

#define DEF_MAJOR "1"
#define DEF_MINOR "2"
#define DEF_BUILD "3"
#define DEF_REVISION "4"

#define DEF_BUILDS_COUNT "5"

#define DEF_STATUS "Beta"
#define DEF_STATUS_SHORT "b"

It would be also nice to have the date as preprocessor defines:

#define DEF_DATE "09"
#define DEF_MONTH "08"
#define DEF_YEAR "2008"


Well that's basically all of the other values, just specified as preprocessor defines :).
For some values it would also be nice, to have them defined as numbers instead of strings.

For me these defines would be really helpful, and it shouldn't really hurt anyone.

So, let me know what you think.
Title: Re: AutoVersioning Plugin
Post by: killerbot on August 10, 2008, 09:56:56 am
that was really done on purpose.

Remember pp-defines are kind of bad. The circumvent the entire type system of C++.

The const values are really much better ;-)
Title: Re: AutoVersioning Plugin
Post by: MaxLondon on August 11, 2008, 03:48:03 pm
I'm aware of the improved type checking, however there are a number of things I can't do with const values, like conditional compiling and other compile time stuff like string concatenation, etc. Also anything which goes into an .rc file.

For me it would be really helpful to have these defines.

Maybe it's possible to NOT create them by default, unless some config option is enabled,

Any chance?
Title: Re: AutoVersioning Plugin
Post by: JGM on August 12, 2008, 03:40:34 am
Sorry i have been out of c++ programming these days since im running my own business and lot of work. I want to make some changes to the plugin, also some one emailed me that the DATE variable is declared on some linux headers with the same name and is having conflicts. I have all in my todo list.

I will try to work on it this week or the next one. I will try to add the defines as a option also. Also i want to work on codepacks plugin, I need to write some documentation for codepacks and reorganize some sources since i should work in conjunction with other good developer that contacted me to join forces  :D

Sorry for being so lazy  :cry:
Title: Re: AutoVersioning Plugin
Post by: killerbot on August 12, 2008, 07:47:28 am
I'm aware of the improved type checking, however there are a number of things I can't do with const values, like conditional compiling and other compile time stuff like string concatenation, etc. Also anything which goes into an .rc file.

For me it would be really helpful to have these defines.

Maybe it's possible to NOT create them by default, unless some config option is enabled,

Any chance?
notte that some things of conditional compiling can be done with regular code (implementation of interfaces). Unless you are at the driver level, it is good practice to avoid #ifdef. And it is possible to do that ;-)
Title: Re: AutoVersioning Plugin
Post by: MaxLondon on August 12, 2008, 01:42:13 pm
notte that some things of conditional compiling can be done with regular code (implementation of interfaces). Unless you are at the driver level, it is good practice to avoid #ifdef. And it is possible to do that ;-)

I have to maintain several slightly different versions of an application. For me conditional compiling is a decent way to handle this, with reasonable amount of additional effort.

Also, how would you handle Logging functions or anything you need in your debug build but don't want in your release build without using #ifdef's or PP macros? Also as mentioned before, how would you do this with .rc files?

I'm not aware of a elegant way to implement this in C++ without using the PP directives. If there's a better way please let me know. ;-)
Title: Re: AutoVersioning Plugin
Post by: Biplab on August 12, 2008, 03:02:19 pm
IMO there should be an option to generate code in C/C++ style.

PP directives, if used carefully can produce better code. But if anyone uses it to write functions which require type checking, it's the fault of that programmer; not of pre-processor. A good programmer shall be aware of such limitations and use the available features accordingly.

Would any one stop using pointers just because it may produce fatal crash in some cases (deleting null pointer)?? A good programmer should go for a check of null pointer wherever required; not avoiding the pointers all together.

C/C++ both can't provide automated garbage collection. I don't think people are going to stop using it in future because of this. Rather people will code accordingly keeping this limitation in mind.

I disagree with the philosophy that anything related to C should be avoided.
Title: Re: AutoVersioning Plugin
Post by: killerbot on August 12, 2008, 05:49:15 pm
say you create a log interface 'ILoggingInterface'. For simplicity say only 1method Log(std::string Something)

==> void ILoggingInterface::Log(std::string Something)


==>make abstract class ILoggingInterface;


Implement in 1 set of files which actually do something., say a.cpp, and a dummy empty version :b.cpp.

In your Debug target you say to use a.cpp, and in the Release you say to use b.cpp.
Title: Re: AutoVersioning Plugin
Post by: JGM on August 19, 2008, 08:24:16 pm
I have made a little patch for autoversioning.

-Ubuntu style version now declared as string instead of double.
-Added more possible causes to the svn error message box.
-Removed license file from unix project file.

I will work later to add an AV_ prefix to the declarations on C mode, since somebody wrote about conflicts with some linux headers or something like that with the date declaration.

Code
Index: AutoVersioning.cpp
===================================================================
--- AutoVersioning.cpp (revision 5189)
+++ AutoVersioning.cpp (working copy)
@@ -571,7 +571,7 @@
         actualDate.Format(_T("%y")).ToLong(&ubuntuYearNumber);

         wxString ubuntuYear;

         ubuntuYear.Printf(_T("%d"),ubuntuYearNumber);

-        headerOutput << _T("\t") << _T("static const double UBUNTU_VERSION_STYLE = ") << ubuntuYear << actualDate.Format(_T(".%m")) << _T(";\n");

+        headerOutput << _T("\t") << _T("static const char UBUNTU_VERSION_STYLE[] = \"") << ubuntuYear << actualDate.Format(_T(".%m\"")) << _T(";\n");

         headerOutput << _T("\t") << _T("\n");

     }

 

@@ -612,7 +612,7 @@
     {

         wxString revision,date;

         if (!QuerySvn(cbC2U(GetConfig().Settings.SvnDirectory.c_str()), revision, date))

-            wxMessageBox(_("Svn configuration files not found.\nVerify the Autoversioning svn directory."),_("Error"),wxICON_ERROR);

+            wxMessageBox(_("Possible Causes:\n-You don't have SVN installed.\n-Incompatible version of SVN.\n-SVN configuration files not found.\n\nVerify the Autoversioning svn directory."),_("SVN Error"),wxICON_ERROR);

         headerOutput << _T("\t") << _T("\n");

         headerOutput << _T("\t") << _T("//SVN Version") << _T("\n");

         headerOutput << _T("\t") << _T("static const char SVN_REVISION[] = ") << _T("\"") + revision + _T("\"")<< _T(";\n");

Index: AutoVersioning-unix.cbp
===================================================================
--- AutoVersioning-unix.cbp (revision 5189)
+++ AutoVersioning-unix.cbp (working copy)
@@ -46,7 +46,6 @@
  <Unit filename="avSvnRevision.h" />
  <Unit filename="avVersionEditorDlg.cpp" />
  <Unit filename="avVersionEditorDlg.h" />
- <Unit filename="license.txt" />
  <Unit filename="manifest.xml" />
  <Extensions>
  <code_completion />

[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: PathFinder_Cate on February 02, 2009, 08:09:32 pm
I'm having a small problem compiling with AutoVersioning turned on (while compiling in Windows).
AutoVersioning uses "DATE" to refer to the day of the month while the Windows include file
"wtypes.h" defines DATE as:

typedef double DATE;

The AutoVersioning plugin should use either "DAY" or a user-selected
variable to avoid this conflict:

   //Date Version Types
   static const char DAY[]   = "02";
   static const char MONTH[] = "01";
   static const char YEAR[]  = "2009";
Title: Re: AutoVersioning Plugin
Post by: JGM on February 05, 2009, 01:37:20 am
thats when generating the header file on c instead of c++?
Title: Re: AutoVersioning Plugin
Post by: riban on July 24, 2009, 12:42:00 am
Is there a way to trigger AutoVersion to start working when a new project is created from a wizard? I have a wizard that creates a project. The wizard adds AutoVersion info to the project but this is not used until the project is closed and re-opened. I want to be able to run the wizard and then for AutoVersion to start working straight away. I can't find a way to trigger this from the wizard script.
Title: Re: AutoVersioning Plugin
Post by: ajaywazir on September 03, 2009, 06:19:21 pm
Hi
Need some help
I have SVN 1.5.5 and TortoiseSVN 1.6.5
I have checked out some code using TortoiseSVN 1.6.5;
SVN.exe is in path
I cannot use svn revision in the version file.
The config dialog always gives me error, svn configuration files not found.
whereas all .svn files and folders are there.

Ajay
Title: Re: AutoVersioning Plugin
Post by: JGM on October 09, 2009, 11:22:53 am
AutoVersioning 1.3


Here I'm posting the new changes I made to the autoversioning plugin to fix the problems reported by users, here is the changes.

* Fixed ubuntu_style_version declaration now it is char string instead of double.
* Added new tab of autoversioning editor named "Code"
* New support to declare header guard define.
* New support to declare namespace name.
* New support to add a prefix to all variables helping in c mode like for example the DATE declaration found in other header files the same name.

For a better picture of it check the attached screenshot.

And here is an example output code with AV as prefix:

Code
#ifndef VERSION_H
#define VERSION_H

namespace AutoVersion{

//Date Version Types
static const char AV_DATE[] = "09";
static const char AV_MONTH[] = "10";
static const char AV_YEAR[] = "2009";
static const char AV_UBUNTU_VERSION_STYLE[] = "9.10";

//Software Status
static const char AV_STATUS[] = "Alpha";
static const char AV_STATUS_SHORT[] = "a";

//Standard Version Type
static const long AV_MAJOR = 1;
static const long AV_MINOR = 0;
static const long AV_BUILD = 2;
static const long AV_REVISION = 11;

//Miscellaneous Version Types
static const long AV_BUILDS_COUNT = 1;
#define AV_RC_FILEVERSION 1,0,2,11
#define AV_RC_FILEVERSION_STRING "1, 0, 2, 11\0"
static const char AV_FULLVERSION_STRING[] = "1.0.2.11";

//These values are to keep track of your versioning state, don't modify them.
static const long AV_BUILD_HISTORY = 2;


}
#endif //VERSION_H

I also attached the patch and im going to upload it to berlios if i remember my account information xD

[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: MortenMacFly on October 27, 2009, 03:49:34 pm
AutoVersioning 1.3
Applied in trunk after testing... Thanks! :-)
Title: Re: AutoVersioning Plugin
Post by: MaxLondon on October 27, 2009, 03:57:07 pm
Does that mean it will be part of the next CB NightlyBlds "Release" ?
Title: Re: AutoVersioning Plugin
Post by: oBFusCATed on October 27, 2009, 04:57:47 pm
Yes, the next nightly will include all fixes that have been commited to svn before the date the nightly is made :)
Title: Re: AutoVersioning Plugin
Post by: Freem on October 28, 2009, 08:10:05 pm
Hi
Need some help
I have SVN 1.5.5 and TortoiseSVN 1.6.5
I have checked out some code using TortoiseSVN 1.6.5;
SVN.exe is in path
I cannot use svn revision in the version file.
The config dialog always gives me error, svn configuration files not found.
whereas all .svn files and folders are there.

Ajay

Hi

I'm sorry to have to ask for help with this useful plug-in, but I have the same problem.
I searched in the C::B documentation, search on google, but I didn't find any information.
I think I really don't understand what I have to put in the field "current SVN directory".
I have tried to use the bin directory of subversion, the global directory of subversion, the directory of the project for which I want to try this feature, and the .svn directory in the project's directory, but this is all the time the same error... "Svn configuration files not found. Verify the Autoversioning svn directory."

Title: Re: AutoVersioning Plugin
Post by: stahta01 on October 28, 2009, 08:31:39 pm
Hi
Need some help
I have SVN 1.5.5 and TortoiseSVN 1.6.5
I have checked out some code using TortoiseSVN 1.6.5;
SVN.exe is in path
I cannot use svn revision in the version file.
The config dialog always gives me error, svn configuration files not found.
whereas all .svn files and folders are there.

Ajay

Hi

I'm sorry to have to ask for help with this useful plug-in, but I have the same problem.
I searched in the C::B documentation, search on google, but I didn't find any information.
I think I really don't understand what I have to put in the field "current SVN directory".
I have tried to use the bin directory of subversion, the global directory of subversion, the directory of the project for which I want to try this feature, and the .svn directory in the project's directory, but this is all the time the same error... "Svn configuration files not found. Verify the Autoversioning svn directory."



This is just a guess.

svn command must be in the system path or in the compiler additional exe path

The "current SVN directory" should be the top SVN directory your SVN project is checked out to. This folder/directory must contain the .svn folder.

Note: This is a problem "I have SVN 1.5.5 and TortoiseSVN 1.6.5" the svn command must be the same major/minor version as the svn project folder. Note, a higher version might work. An SVN 1.6.0 should work with TortoiseSVN 1.6.5; but not SVN 1.5.5. Format of version number major.minor.?? What the ?? is called varies from project to project.

Tim S.
 
Title: Re: AutoVersioning Plugin
Post by: Freem on October 29, 2009, 11:38:27 am
Thanks a lot, it work great, now.

I'm didn't think to upload brain to the last version, it seem :)

And thanks for this useful plugin, that improve a great IDE.
Title: Re: AutoVersioning Plugin
Post by: JGM on October 30, 2009, 03:30:37 am
AutoVersioning 1.3
Applied in trunk after testing... Thanks! :-)

yay! thanks for the commit and thanks to everyone that pointed the plugin errors (bugs)!  :D Keep the codeblocks growing!
Title: Re: AutoVersioning Plugin
Post by: polygon7 on October 30, 2009, 08:47:44 am
Hi,
I have one suggestion, this variables:
Code
	//Standard Version Type
static const long AV_MAJOR = 1;
static const long AV_MINOR = 0;
static const long AV_BUILD = 2;
static const long AV_REVISION = 11;

could be size_t / unsigned int type because usually you don't need negative version number,
and usually you don't need version number grater than max value of unsigned int (I know it doesn't
matter on 32bit, where unsigned long == unsigned int == 4 294 967 295, but on other architectures,
ex. 16bit, it makes a difference).
Title: Re: AutoVersioning Plugin
Post by: AndyJ on November 24, 2009, 05:50:03 pm
Hello,

I have a request. Where strings are currently generated as:

   static const char DATE[] = "24";

would it be possible to (optionally?) generate them as:

   #define DATE_DEFINE "24"
   static const char DATE[] = DATE_DEFINE;

or something similar as this would be more flexible for some applications (creating a custom string in yet another #define for instance). Obviously the appropriate prefix should be applied to both names.

Thanks for a great plugin,

Andy


Title: Re: AutoVersioning Plugin
Post by: Cryogen on March 05, 2010, 07:48:55 pm

 Hi Guys,

I added a new feature to the AutoVersion plug-in and posted a patch on 3/3. It adds the ability to update manifest.xml with AutoVersion's version string. I found it very tedious to have to update it manually and too easy to forget.  :D

You can control whether or not to let AutoVersion update manifest.xml via a new option in the Settings tab of the prefs dialogue.

(http://cryogen.byethost24.com/AutoVersion.png)

I've found this REALLY useful since I started using it. I hope you do, too.

Cheers,

 Cryo.

Title: Re: AutoVersioning Plugin
Post by: Cryogen on March 05, 2010, 08:42:04 pm

 Hi again,

I should probably also add that on 2/2 I also submitted a patch that enlarges the change log dialogue and sizes the rows to the content. I found it very annoying to have to resize it every single time, which is often if you're using it regularly. It's patch 2922:

https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2922&group_id=5358

This one also corrects the SVN error message and includes some spelling corrections.

I've just realised that you don't seem to be able to download patches from Berlios, so they're attached.

Cheers,

  Cryo.


[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: Cryogen on March 06, 2010, 12:39:08 am

 I noticed that I'd missed the tooltip description. I've now corrected that. An updated patch is attached and also at Berlios.

Cryo.

[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: JGM on March 06, 2010, 10:15:02 pm
whoa cool  :D!
Title: Re: AutoVersioning Plugin
Post by: Cryogen on March 17, 2010, 07:09:45 pm

It seems that I missed operator!= as well. :-(

That's now fixed, too.

[attachment deleted by admin]
Title: Re: AutoVersioning Plugin
Post by: bros on October 23, 2010, 02:17:54 am
Hi

Where wan I have a full compiled version of the lastest autversioning plugin, because i only find 1.0

Thanks
Title: Re: AutoVersioning Plugin
Post by: oBFusCATed on October 23, 2010, 02:25:32 am
It is in the contrib plugins...
Title: Re: AutoVersioning Plugin
Post by: Cryogen on February 21, 2011, 07:05:45 pm
Patches 2 & 3 merged in Berlios 2922. Recreated against SVN 7017 wxSmith branch.
Title: Re: AutoVersioning Plugin
Post by: daniloz on February 21, 2011, 09:21:06 pm
Any dev willing to commit Cryogen patches to trunk? ;-)
Title: Re: AutoVersioning Plugin
Post by: Cryogen on February 22, 2011, 01:54:35 am

Morten and killerbot should be on it soon. They are usually on it fairly quickly.

Ciao.
Title: Re: AutoVersioning Plugin
Post by: scarphin on September 07, 2011, 08:24:01 pm
Is it possible to have an option to increment the 'minor version number' when 'build number' hits its maximum and not related to 'build times' value? Maybe by entering '0' to 'build times' field. ;/
Title: Re: AutoVersioning Plugin
Post by: scarphin on September 13, 2011, 08:30:02 am
It seems no one maintains that plugin which is quite useful in my opinion. At least can someone make Cryogen's patches available for users to apply individually if they won't be applied to trunk ever?
Title: Re: AutoVersioning Plugin
Post by: scarphin on September 15, 2011, 12:35:30 am
After realizing Cryogen's patch is already applied, I modified the plugin a bit. I didn't like the idea that the minor version is automatically incremented after certain build times because I can't change the 'build times to increment minor' value. So I implemented a feature to increment the minor according to the 'build number maximum' when the 'build times' value is 0. Patch is attached for your interest.
Title: Re: AutoVersioning Plugin
Post by: scarphin on September 15, 2011, 12:39:28 am
I also didn't like all the 'Change Log:' text in a changelog file so I changed the formatting. Patch file is attached fyi.