Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
AutoVersioning Plugin
JGM:
--- Quote from: 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.
--- End quote ---
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.
JGM:
--- Quote from: 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
--- End quote ---
Done! Finished adding this feature. Check the first post for screenshot and download :D
mp:
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
--- End code ---
Could You provide compiled version?
JGM:
--- Quote from: 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
--- End code ---
Could You provide compiled version?
--- End quote ---
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
killerbot:
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);
--- End code ---
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();
}
}
--- End code ---
- don't use memset when it is not needed, you can easily replace :
--- Code: --- char buf[16384];
memset(buf, 0, 16384);
--- End code ---
by :
--- Code: --- char buf[16384] = {'\0'};
--- End code ---
- 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.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version