Author Topic: AutoVersioning Plugin  (Read 135314 times)

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #105 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.

Offline Jeisson

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: AutoVersioning Plugin
« Reply #106 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: [Select]
// 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!

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #107 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: [Select]
// 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: [Select]
//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: [Select]
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  :)
« Last Edit: October 10, 2007, 01:40:27 am by JGM »

Offline Jeisson

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: AutoVersioning Plugin
« Reply #108 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: [Select]
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: [Select]
#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.

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #109 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

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #110 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.

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #111 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

Offline Jeisson

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: AutoVersioning Plugin
« Reply #112 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.

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #113 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

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #114 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.

Offline pasgui

  • Almost regular
  • **
  • Posts: 165
    • LGP
Re: AutoVersioning Plugin
« Reply #115 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

Offline Vuki

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: AutoVersioning Plugin
« Reply #116 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

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #117 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.

Offline Jeisson

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: AutoVersioning Plugin
« Reply #118 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!

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #119 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.