Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » Versioning support (hack-ishly solved)
Versioning support (hack-ishly solved) [message #52155] Tue, 30 July 2019 09:33 Go to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member
It would be nice/useful to have theide update version-numbers with each successful compile of a package.
With version numbers in the form release.build.test, theide can increment 'test' with
each successful compile in Debug-mode, increment 'build' when compile succeeds in Release mode,
leaving 'release' to be adjusted by the developer - possibly in Project:[package organizer] or [Main package configuration]

Then have macros available to get these from code, to keep in a variable for later use e.g.: to
version-stamp data saved to file or db so that later releases/builds can correctly interpret the data-structure.


[Updated on: Sun, 11 August 2019 11:48]

Report message to a moderator

Re: Versioning support [message #52190 is a reply to message #52155] Wed, 07 August 2019 14:17 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member
I came up with the following macro that can do version-support.

It "key-jack"s F7 and it would also be nice if it can overload the toolbar-button.

for the macro to work it needs the following header to be part of the main package files:

Name: VersionRBT.h
#ifndef _VersionRBT_h_
#define _VersionRBT_h_

#define V_RELEASE 0
#define V_BUILD 0
#define V_TEST 0
#define N_2_S0(x) #x
#define N_2_S(x) N_2_S0(x)
#define V_VERSION "v " N_2_S(V_RELEASE) "." N_2_S(V_BUILD) "." N_2_S(V_TEST)

#endif

The #defines can be used wherever needed and the V_VERSION is just a convenient string representation.

The Versioning-macro updates the #define counts (and restore if the build fails) before the package is compiled
making the new version current for the compiled code.
Just use the V_defines where needed, they will always be current.

To test it, add the above header and import the macro ([Setup->Macro Manager.. then R-click the "Global macros"-tree and Import..])
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#include "VersionRBT.h"

GUI_APP_MAIN
{
	PromptOK("tester: " V_VERSION);
}

[Updated on: Wed, 07 August 2019 15:16]

Report message to a moderator

Re: Versioning support [message #52219 is a reply to message #52190] Sun, 11 August 2019 11:46 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member
Based on mirek's answer here: https://www.ultimatepp.org/forums/index.php?t=msg&th=107 50&goto=52210&#msg_52210
I've improved my macro as per attached - much neater I think.
thx mirek

Re: Versioning support (hack-ishly solved) [message #52223 is a reply to message #52155] Mon, 12 August 2019 08:00 Go to previous message
slashupp is currently offline  slashupp
Messages: 193
Registered: July 2009
Experienced Member
Added history-keeping to the header/macro...

The new header is:
#ifndef _VersionRBT_h_
#define _VersionRBT_h_

#define V_RELEASE 0
#define V_BUILD 0
#define V_TEST 0
#define N_2_S0(x) #x
#define N_2_S(x) N_2_S0(x)
#define V_VERSION "v " N_2_S(V_RELEASE) "." N_2_S(V_BUILD) "." N_2_S(V_TEST)


//=============================================================================
//history will be updated by the Versioning-macro..
// and can be accessed with something like:
//	{
//		std:: string s{"History\n"};
//		for (auto p:VersionHistory<>) { s+="    ["; s+=p.first; s+="] -> "; s+=p.second; s+="\n"; }
//		PromptOK(DeQtf(s.c_str()));
//	}

#include <map>

template<typename S=std::string> struct MVHIST
{
    std::map<S, S> m;
    MVHIST(const S &k, const S &v) { m[k]=v; }
    MVHIST<S>& operator()(const S &k, const S &v) { m[k]=v; return *this; }
    operator std::map<S, S>() { return m; }
};

template<typename S=std::string> std::map<S, S> VersionHistory=MVHIST<S>
//HISTORY (insertion-point, leave this comment in place - see macro)
;


#endif


and the macro is attached.
Previous Topic: Adding Zig Language Support [FEATURE REQUEST]
Goto Forum:
  


Current Time: Tue Aug 20 00:59:21 CEST 2019

Total time taken to generate the page: 0.00578 seconds