Merge pull request #1336 from G10h4ck/rs_version

Clean up the mess with RetroShare version
This commit is contained in:
G10h4ck 2018-09-14 13:24:14 +02:00 committed by GitHub
commit d1804b480d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 199 additions and 189 deletions

View file

@ -1,3 +1,6 @@
git:
depth: 2000
language: cpp language: cpp
matrix: matrix:

View file

@ -58,7 +58,7 @@ clone_folder: C:\projects\RetroShare
#shallow_clone: true # default is "false" #shallow_clone: true # default is "false"
# set clone depth # set clone depth
clone_depth: 1 # clone entire repository history if not defined clone_depth: 2000 # clone entire repository history if not defined
environment: environment:
global: global:

View file

@ -31,19 +31,7 @@ registerHandler("$%apiPath%$",
const std::shared_ptr<rb::Session> session, const std::shared_ptr<rb::Session> session,
const rb::Bytes& body ) const rb::Bytes& body )
{ {
RsGenericSerializer::SerializeContext cReq( INITIALIZE_API_CALL_JSON_CONTEXT;
nullptr, 0,
RsGenericSerializer::SERIALIZATION_FLAG_YIELDING );
RsJson& jReq(cReq.mJson);
jReq.Parse(reinterpret_cast<const char*>(body.data()), body.size());
RsGenericSerializer::SerializeContext cAns;
RsJson& jAns(cAns.mJson);
// if caller specified caller_data put it back in the answhere
const char kcd[] = "caller_data";
if(jReq.HasMember(kcd))
jAns.AddMember(kcd, jReq[kcd], jAns.GetAllocator());
if( !checkRsServicePtrReady( if( !checkRsServicePtrReady(
$%instanceName%$, "$%instanceName%$", cAns, session ) ) $%instanceName%$, "$%instanceName%$", cAns, session ) )

View file

@ -24,19 +24,7 @@ registerHandler("$%apiPath%$",
const std::shared_ptr<rb::Session> session, const std::shared_ptr<rb::Session> session,
const rb::Bytes& body ) const rb::Bytes& body )
{ {
RsGenericSerializer::SerializeContext cReq( INITIALIZE_API_CALL_JSON_CONTEXT;
nullptr, 0,
RsGenericSerializer::SERIALIZATION_FLAG_YIELDING );
RsJson& jReq(cReq.mJson);
jReq.Parse(reinterpret_cast<const char*>(body.data()), body.size());
RsGenericSerializer::SerializeContext cAns;
RsJson& jAns(cAns.mJson);
// if caller specified caller_data put it back in the answhere
const char kcd[] = "caller_data";
if(jReq.HasMember(kcd))
jAns.AddMember(kcd, jReq[kcd], jAns.GetAllocator());
if( !checkRsServicePtrReady( if( !checkRsServicePtrReady(
$%instanceName%$, "$%instanceName%$", cAns, session ) ) $%instanceName%$, "$%instanceName%$", cAns, session ) )
@ -54,15 +42,7 @@ $%functionCall%$
$%outputParamsSerialization%$ $%outputParamsSerialization%$
// return them to the API caller // return them to the API caller
std::stringstream ss; DEFAULT_API_CALL_JSON_RETURN(rb::OK);
ss << jAns;
std::string&& ans(ss.str());
const std::multimap<std::string, std::string> headers
{
{ "Content-Type", "text/json" },
{ "Content-Length", std::to_string(ans.length()) }
};
session->close(rb::OK, ans, headers);
} ); } );
}); });

View file

@ -26,10 +26,38 @@
#include "util/rsjson.h" #include "util/rsjson.h"
#include "retroshare/rsfiles.h" #include "retroshare/rsfiles.h"
#include "util/radix64.h" #include "util/radix64.h"
#include "retroshare/rsversion.h"
// Generated at compile time // Generated at compile time
#include "jsonapi-includes.inl" #include "jsonapi-includes.inl"
#define INITIALIZE_API_CALL_JSON_CONTEXT \
RsGenericSerializer::SerializeContext cReq( \
nullptr, 0, \
RsGenericSerializer::SERIALIZATION_FLAG_YIELDING ); \
RsJson& jReq(cReq.mJson); \
jReq.Parse(reinterpret_cast<const char*>(body.data()), body.size()); \
\
RsGenericSerializer::SerializeContext cAns; \
RsJson& jAns(cAns.mJson); \
\
/* if caller specified caller_data put it back in the answhere */ \
const char kcd[] = "caller_data"; \
if(jReq.HasMember(kcd)) \
jAns.AddMember(kcd, jReq[kcd], jAns.GetAllocator())
#define DEFAULT_API_CALL_JSON_RETURN(RET_CODE) \
std::stringstream ss; \
ss << jAns; \
std::string&& ans(ss.str()); \
const std::multimap<std::string, std::string> headers \
{ \
{ "Content-Type", "text/json" }, \
{ "Content-Length", std::to_string(ans.length()) } \
}; \
session->close(RET_CODE, ans, headers)
static bool checkRsServicePtrReady( static bool checkRsServicePtrReady(
void* serviceInstance, const std::string& serviceName, void* serviceInstance, const std::string& serviceName,
RsGenericSerializer::SerializeContext& ctx, RsGenericSerializer::SerializeContext& ctx,
@ -45,18 +73,12 @@ static bool checkRsServicePtrReady(
RsGenericSerializer::SerializeJob j(RsGenericSerializer::TO_JSON); RsGenericSerializer::SerializeJob j(RsGenericSerializer::TO_JSON);
RS_SERIAL_PROCESS(jsonApiError); RS_SERIAL_PROCESS(jsonApiError);
std::stringstream ss; RsJson& jAns(ctx.mJson);
ss << ctx.mJson; DEFAULT_API_CALL_JSON_RETURN(rb::CONFLICT);
std::string&& ans(ss.str());
const std::multimap<std::string, std::string> headers
{
{ "Content-Type", "text/json" },
{ "Content-Length", std::to_string(ans.length()) }
};
session->close(rb::CONFLICT, ans, headers);
return false; return false;
} }
JsonApiServer::JsonApiServer( JsonApiServer::JsonApiServer(
uint16_t port, const std::string& bindAddress, uint16_t port, const std::string& bindAddress,
const std::function<void(int)> shutdownCallback ) : const std::function<void(int)> shutdownCallback ) :
@ -69,6 +91,32 @@ JsonApiServer::JsonApiServer(
shutdown(); shutdown();
}); });
registerHandler("/jsonApiServer/version",
[](const std::shared_ptr<rb::Session> session)
{
size_t reqSize = session->get_request()->get_header("Content-Length", 0);
session->fetch( reqSize, [](
const std::shared_ptr<rb::Session> session,
const rb::Bytes& body )
{
INITIALIZE_API_CALL_JSON_CONTEXT;
uint32_t major = RS_MAJOR_VERSION;
uint32_t minor = RS_MINOR_VERSION;
uint32_t mini = RS_MINI_VERSION;
std::string human = RS_HUMAN_READABLE_VERSION;
RsGenericSerializer::SerializeContext& ctx(cAns);
RsGenericSerializer::SerializeJob j(RsGenericSerializer::TO_JSON);
RS_SERIAL_PROCESS(major);
RS_SERIAL_PROCESS(minor);
RS_SERIAL_PROCESS(mini);
RS_SERIAL_PROCESS(human);
DEFAULT_API_CALL_JSON_RETURN(rb::OK);
} );
});
registerHandler("/rsFiles/getFileData", registerHandler("/rsFiles/getFileData",
[](const std::shared_ptr<rb::Session> session) [](const std::shared_ptr<rb::Session> session)
{ {
@ -77,19 +125,7 @@ JsonApiServer::JsonApiServer(
const std::shared_ptr<rb::Session> session, const std::shared_ptr<rb::Session> session,
const rb::Bytes& body ) const rb::Bytes& body )
{ {
RsGenericSerializer::SerializeContext cReq( INITIALIZE_API_CALL_JSON_CONTEXT;
nullptr, 0,
RsGenericSerializer::SERIALIZATION_FLAG_YIELDING );
RsJson& jReq(cReq.mJson);
jReq.Parse(reinterpret_cast<const char*>(body.data()), body.size());
RsGenericSerializer::SerializeContext cAns;
RsJson& jAns(cAns.mJson);
// if caller specified caller_data put it back in the answhere
const char kcd[] = "caller_data";
if(jReq.HasMember(kcd))
jAns.AddMember(kcd, jReq[kcd], jAns.GetAllocator());
if(!checkRsServicePtrReady(rsFiles, "rsFiles", cAns, session)) if(!checkRsServicePtrReady(rsFiles, "rsFiles", cAns, session))
return; return;
@ -133,16 +169,7 @@ JsonApiServer::JsonApiServer(
if(!errorMessage.empty()) RS_SERIAL_PROCESS(errorMessage); if(!errorMessage.empty()) RS_SERIAL_PROCESS(errorMessage);
} }
// return them to the API caller DEFAULT_API_CALL_JSON_RETURN(rb::OK);
std::stringstream ss;
ss << jAns;
std::string&& ans(ss.str());
const std::multimap<std::string, std::string> headers
{
{ "Content-Type", "text/json" },
{ "Content-Length", std::to_string(ans.length()) }
};
session->close(rb::OK, ans, headers);
} ); } );
}); });

View file

@ -515,7 +515,6 @@ HEADERS += util/folderiterator.h \
util/rsstring.h \ util/rsstring.h \
util/rsstd.h \ util/rsstd.h \
util/rsthreads.h \ util/rsthreads.h \
util/rsversioninfo.h \
util/rswin.h \ util/rswin.h \
util/rsrandom.h \ util/rsrandom.h \
util/rsmemcache.h \ util/rsmemcache.h \
@ -666,7 +665,6 @@ SOURCES += util/folderiterator.cc \
util/rsprint.cc \ util/rsprint.cc \
util/rsstring.cc \ util/rsstring.cc \
util/rsthreads.cc \ util/rsthreads.cc \
util/rsversioninfo.cc \
util/rsrandom.cc \ util/rsrandom.cc \
util/rstickevent.cc \ util/rstickevent.cc \
util/rsrecogn.cc \ util/rsrecogn.cc \

View file

@ -34,7 +34,7 @@
#include <rsserver/p3face.h> #include <rsserver/p3face.h>
#include <util/rsdir.h> #include <util/rsdir.h>
#include <util/rsversioninfo.h> #include <retroshare/rsversion.h>
#include <util/folderiterator.h> #include <util/folderiterator.h>
#include <ft/ftserver.h> #include <ft/ftserver.h>
#include <retroshare/rsplugin.h> #include <retroshare/rsplugin.h>
@ -351,7 +351,6 @@ bool RsPluginManager::loadPlugin(const std::string& plugin_name,bool first_time)
std::cerr << " -> plugin revision number: " << pinfo.svn_revision << std::endl; std::cerr << " -> plugin revision number: " << pinfo.svn_revision << std::endl;
std::cerr << " plugin API number : " << std::hex << pinfo.API_version << std::dec << std::endl; std::cerr << " plugin API number : " << std::hex << pinfo.API_version << std::dec << std::endl;
std::cerr << " retroshare svn number: " << RsUtil::retroshareRevision() << std::endl;
// Check that the plugin provides a svn revision number and a API number // Check that the plugin provides a svn revision number and a API number
// //

View file

@ -284,12 +284,6 @@ struct RsLoginHelper
* @return true if already logged in, false otherwise * @return true if already logged in, false otherwise
*/ */
bool isLoggedIn(); bool isLoggedIn();
/**
* @brief Close RetroShare session
* @jsonapi{development}
*/
void closeSession();
}; };
#endif #endif

View file

@ -205,7 +205,7 @@ class RsPlugin
// //
// All these items appear in the config->plugins tab, as a description of the plugin. // All these items appear in the config->plugins tab, as a description of the plugin.
// //
uint32_t getSvnRevision() const { return RS_REVISION_NUMBER ; } // This is read from libretroshare/retroshare/rsversion.h uint32_t getSvnRevision() const { return 0; } // This is read from libretroshare/retroshare/rsversion.h
virtual std::string getShortPluginDescription() const = 0 ; virtual std::string getShortPluginDescription() const = 0 ;
virtual std::string getPluginName() const = 0 ; virtual std::string getPluginName() const = 0 ;

View file

@ -141,7 +141,7 @@ public:
/** /**
* @brief getServiceName lookup the name of a service. * @brief getServiceName lookup the name of a service.
* @jsonapi{development} * @jsonapi{development}
* @param[in] service_id service to look up * @param[in] serviceId service to look up
* @return name of service * @return name of service
*/ */
virtual std::string getServiceName(uint32_t serviceId) = 0; virtual std::string getServiceName(uint32_t serviceId) = 0;
@ -149,7 +149,7 @@ public:
/** /**
* @brief getServiceItemNames return a map of service item names. * @brief getServiceItemNames return a map of service item names.
* @jsonapi{development} * @jsonapi{development}
* @param[in] service_id service to look up * @param[in] serviceId service to look up
* @param[out] names names of items * @param[out] names names of items
* @return true on success false otherwise * @return true on success false otherwise
*/ */

View file

@ -19,14 +19,63 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * * along with this program. If not, see <https://www.gnu.org/licenses/>. *
* * * *
*******************************************************************************/ *******************************************************************************/
#define RS_MAJOR_VERSION 0 #pragma once
#define RS_MINOR_VERSION 6
#define RS_BUILD_NUMBER 4
#define RS_BUILD_NUMBER_ADD "" // <-- do we need this? /**
// The revision number should be the 4 first bytes of the git revision hash, which is obtained using: * @def RS_MINI_VERSION
// git log --pretty="%H" | head -1 | cut -c1-8 * First number of RetroShare versioning scheme
// * Customize it trough qmake command line @see retroshare.pri
// Do not forget the 0x, since the RS_REVISION_NUMBER should be an integer. */
// #ifndef RS_MAJOR_VERSION
#define RS_REVISION_STRING "01234567" # define RS_MAJOR_VERSION 0
#define RS_REVISION_NUMBER 0x01234567 #endif
/**
* @def RS_MINI_VERSION
* Second number of RetroShare versioning scheme
* Customize it trough qmake command line @see retroshare.pri
*/
#ifndef RS_MINOR_VERSION
# define RS_MINOR_VERSION 0
#endif
/**
* @def RS_MINI_VERSION
* Third number of RetroShare versioning scheme
* Customize it trough qmake command line @see retroshare.pri
*/
#ifndef RS_MINI_VERSION
# define RS_MINI_VERSION 0
#endif
/**
* @def RS_EXTRA_VERSION
* An extra string to append to the version to make it more descriptive.
* Customize it trough qmake command line @see retroshare.pri
*/
#ifndef RS_EXTRA_VERSION
# define RS_EXTRA_VERSION "unknown"
#endif
/**
* Use this macro to check in your code if version of RetroShare is at least the
* specified.
*/
#define RS_VERSION_AT_LEAST(A,B,C) (RS_MAJOR_VERSION > (A) || \
(RS_MAJOR_VERSION == (A) && \
(RS_MINOR_VERSION > (B) || \
(RS_MINOR_VERSION == (B) && RS_MINI_VERSION >= (C)))))
#define __RS_PRIVATE_STRINGIFY2(X) #X
#define __RS_PRIVATE_STRINGIFY(X) __RS_PRIVATE_STRINGIFY2(X)
/**
* Human readable string describing RetroShare version
*/
constexpr auto RS_HUMAN_READABLE_VERSION =
__RS_PRIVATE_STRINGIFY(RS_MAJOR_VERSION) "." \
__RS_PRIVATE_STRINGIFY(RS_MINOR_VERSION) "." \
__RS_PRIVATE_STRINGIFY(RS_MINI_VERSION) RS_EXTRA_VERSION;

View file

@ -2014,11 +2014,6 @@ bool RsLoginHelper::isLoggedIn()
return RsControl::instance()->isReady(); return RsControl::instance()->isReady();
} }
void RsLoginHelper::closeSession()
{
RsControl::instance()->rsGlobalShutDown();
}
void RsLoginHelper::Location::serial_process( void RsLoginHelper::Location::serial_process(
RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx ) RsGenericSerializer::SerializeContext& ctx )

View file

@ -22,7 +22,7 @@
*******************************************************************************/ *******************************************************************************/
#include "services/p3discovery2.h" #include "services/p3discovery2.h"
#include "pqi/p3peermgr.h" #include "pqi/p3peermgr.h"
#include "util/rsversioninfo.h" #include "retroshare/rsversion.h"
#include "retroshare/rsiface.h" #include "retroshare/rsiface.h"
#include "rsserver/p3face.h" #include "rsserver/p3face.h"
@ -349,7 +349,7 @@ void p3discovery2::sendOwnContactInfo(const SSLID &sslid)
* revert an hardcoded policy. */ * revert an hardcoded policy. */
//populateContactInfo(detail, pkt, true); //populateContactInfo(detail, pkt, true);
pkt->version = RsUtil::retroshareVersion(); pkt->version = RS_HUMAN_READABLE_VERSION;
pkt->PeerId(sslid); pkt->PeerId(sslid);
#ifdef P3DISC_DEBUG #ifdef P3DISC_DEBUG
@ -408,7 +408,7 @@ void p3discovery2::recvOwnContactInfo(const SSLID &fromId, const RsDiscContactIt
sendPGPList(fromId); sendPGPList(fromId);
// Update mDiscStatus. // Update mDiscStatus.
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/ RS_STACK_MUTEX(mDiscMtx);
PGPID pgpId = getPGPId(fromId); PGPID pgpId = getPGPId(fromId);
std::map<PGPID, DiscPgpInfo>::iterator it = mFriendList.find(pgpId); std::map<PGPID, DiscPgpInfo>::iterator it = mFriendList.find(pgpId);

View file

@ -1,37 +0,0 @@
/*******************************************************************************
* libretroshare/src/util: rsversioninfo.cc *
* *
* libretroshare: retroshare core library *
* *
* Copyright 2013-2013 by Alexandrut *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "rsversioninfo.h"
#include "retroshare/rsversion.h"
#include "rsstring.h"
std::string RsUtil::retroshareVersion()
{
std::string version;
rs_sprintf(version, "%d.%d.%d%s Revision %08x", RS_MAJOR_VERSION, RS_MINOR_VERSION, RS_BUILD_NUMBER, RS_BUILD_NUMBER_ADD, RS_REVISION_NUMBER);
return version;
}
uint32_t RsUtil::retroshareRevision()
{
return RS_REVISION_NUMBER;
}

View file

@ -1,30 +0,0 @@
/*******************************************************************************
* libretroshare/src/util: rsversioninfo.h *
* *
* libretroshare: retroshare core library *
* *
* Copyright 2013-2013 by Alexandrut *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include <string>
#include <inttypes.h>
namespace RsUtil {
uint32_t retroshareRevision();
std::string retroshareVersion();
}

View file

@ -56,7 +56,7 @@ extern "C" {
#ifdef WIN32 #ifdef WIN32
__declspec(dllexport) __declspec(dllexport)
#endif #endif
uint32_t RETROSHARE_PLUGIN_revision = RS_REVISION_NUMBER ; uint32_t RETROSHARE_PLUGIN_revision = 0;
// This symbol contains the svn revision number grabbed from the executable. // This symbol contains the svn revision number grabbed from the executable.
// It will be tested by RS to load the plugin automatically, since it is safe to load plugins // It will be tested by RS to load the plugin automatically, since it is safe to load plugins
@ -72,8 +72,8 @@ void FeedReaderPlugin::getPluginVersion(int& major, int& minor, int &build, int&
{ {
major = RS_MAJOR_VERSION; major = RS_MAJOR_VERSION;
minor = RS_MINOR_VERSION; minor = RS_MINOR_VERSION;
build = RS_BUILD_NUMBER; build = RS_MINI_VERSION;
svn_rev = RS_REVISION_NUMBER; svn_rev = 0;
} }
FeedReaderPlugin::FeedReaderPlugin() FeedReaderPlugin::FeedReaderPlugin()

View file

@ -61,7 +61,7 @@ extern "C" {
// It will be tested by RS to load the plugin automatically, since it is safe to load plugins // It will be tested by RS to load the plugin automatically, since it is safe to load plugins
// with same revision numbers, assuming that the revision numbers are up-to-date. // with same revision numbers, assuming that the revision numbers are up-to-date.
// //
uint32_t RETROSHARE_PLUGIN_revision = RS_REVISION_NUMBER ; uint32_t RETROSHARE_PLUGIN_revision = 0;
// This symbol contains the svn revision number grabbed from the executable. // This symbol contains the svn revision number grabbed from the executable.
// It will be tested by RS to load the plugin automatically, since it is safe to load plugins // It will be tested by RS to load the plugin automatically, since it is safe to load plugins
@ -74,8 +74,8 @@ void VOIPPlugin::getPluginVersion(int& major, int& minor, int& build, int& svn_r
{ {
major = RS_MAJOR_VERSION ; major = RS_MAJOR_VERSION ;
minor = RS_MINOR_VERSION ; minor = RS_MINOR_VERSION ;
build = RS_BUILD_NUMBER ; build = RS_MINI_VERSION ;
svn_rev = RS_REVISION_NUMBER ; svn_rev = 0;
} }
VOIPPlugin::VOIPPlugin() VOIPPlugin::VOIPPlugin()

View file

@ -5,11 +5,11 @@
IDI_ICON1 ICON "logo/logo_64.ico" IDI_ICON1 ICON "logo/logo_64.ico"
#define STRINGIZER(version) #version #define STRINGIZER(version) #version
#define VERSION_STRING(major,minor,build,buildadd,revision) STRINGIZER(major) "." STRINGIZER(minor) "." STRINGIZER(build) buildadd "." revision #define VERSION_STRING(major,minor,mini,extra) STRINGIZER(major) "." STRINGIZER(minor) "." STRINGIZER(mini) STRINGIZER(extra)
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION RS_MAJOR_VERSION,RS_MINOR_VERSION,RS_BUILD_NUMBER,0 FILEVERSION RS_MAJOR_VERSION,RS_MINOR_VERSION,RS_MINI_VERSION,0
PRODUCTVERSION RS_MAJOR_VERSION,RS_MINOR_VERSION,RS_BUILD_NUMBER,0 PRODUCTVERSION RS_MAJOR_VERSION,RS_MINOR_VERSION,RS_MINI_VERSION,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32 FILEOS VOS_NT_WINDOWS32
@ -22,11 +22,11 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "" VALUE "CompanyName", ""
VALUE "FileDescription", "RetroShare" VALUE "FileDescription", "RetroShare"
VALUE "FileVersion", VERSION_STRING(RS_MAJOR_VERSION, RS_MINOR_VERSION, RS_BUILD_NUMBER, RS_BUILD_NUMBER_ADD, RS_REVISION_STRING) VALUE "FileVersion", VERSION_STRING(RS_MAJOR_VERSION, RS_MINOR_VERSION, RS_MINI_VERSION, RS_EXTRA_VERSION)
VALUE "InternalName", "RetroShare" VALUE "InternalName", "RetroShare"
VALUE "OriginalFilename", "RetroShare.exe" VALUE "OriginalFilename", "RetroShare.exe"
VALUE "ProductName", "RetroShare" VALUE "ProductName", "RetroShare"
VALUE "ProductVersion", VERSION_STRING(RS_MAJOR_VERSION, RS_MINOR_VERSION, RS_BUILD_NUMBER, RS_BUILD_NUMBER_ADD, RS_REVISION_STRING) VALUE "ProductVersion", VERSION_STRING(RS_MAJOR_VERSION, RS_MINOR_VERSION, RS_MINI_VERSION, RS_EXTRA_VERSION)
VALUE "LegalCopyright", "" VALUE "LegalCopyright", ""
END END
END END

View file

@ -356,15 +356,7 @@ void Rshare::slotConnectionEstablished()
} }
} }
QString Rshare::retroshareVersion(bool withRevision) QString Rshare::retroshareVersion(bool) { return RS_HUMAN_READABLE_VERSION; }
{
QString version = QString("%1.%2.%3%4").arg(RS_MAJOR_VERSION).arg(RS_MINOR_VERSION).arg(RS_BUILD_NUMBER).arg(RS_BUILD_NUMBER_ADD);
if (withRevision) {
version += QString(" %1 %2").arg(tr("Revision")).arg(RS_REVISION_NUMBER,8,16,QChar('0'));
}
return version;
}
/** Enters the main event loop and waits until exit() is called. The signal /** Enters the main event loop and waits until exit() is called. The signal
* running() will be emitted when the event loop has started. */ * running() will be emitted when the event loop has started. */

View file

@ -61,7 +61,7 @@ public:
~Rshare(); ~Rshare();
/** Return the version info */ /** Return the version info */
static QString retroshareVersion(bool withRevision); static QString retroshareVersion(bool=true);
/** Return the map of command-line arguments and values. */ /** Return the map of command-line arguments and values. */
static QMap<QString, QString> arguments() { return _args; } static QMap<QString, QString> arguments() { return _args; }

View file

@ -144,6 +144,23 @@ CONFIG+=no_rs_deep_search
CONFIG *= rs_deep_search CONFIG *= rs_deep_search
no_rs_deep_search:CONFIG -= rs_deep_search no_rs_deep_search:CONFIG -= rs_deep_search
# Specify RetroShare major version appending the following assignation to qmake
# command line 'RS_MAJOR_VERSION=0'
#RS_MAJOR_VERSION=0
# Specify RetroShare major version appending the following assignation to qmake
# command line 'RS_MINOR_VERSION=6'
#RS_MINOR_VERSION=6
# Specify RetroShare major version appending the following assignation to qmake
# command line 'RS_MINI_VERSION=4'
#RS_MINI_VERSION=4
# Specify RetroShare major version appending the following assignation to qmake
# command line 'RS_EXTRA_VERSION=""'
#RS_EXTRA_VERSION=git
########################################################################################################################################################### ###########################################################################################################################################################
# #
# V07_NON_BACKWARD_COMPATIBLE_CHANGE_001: # V07_NON_BACKWARD_COMPATIBLE_CHANGE_001:
@ -259,7 +276,6 @@ defineReplace(linkDynamicLibs) {
return($$retDlib) return($$retDlib)
} }
################################################################################ ################################################################################
## Statements and variables that depends on build options (CONFIG) goes here ### ## Statements and variables that depends on build options (CONFIG) goes here ###
################################################################################ ################################################################################
@ -283,6 +299,42 @@ defineReplace(linkDynamicLibs) {
## RS_THREAD_LIB String viariable containing the name of the multi threading ## RS_THREAD_LIB String viariable containing the name of the multi threading
## library to use (pthread, "") it usually depend on platform. ## library to use (pthread, "") it usually depend on platform.
defined(RS_MAJOR_VERSION,var):\
defined(RS_MINOR_VERSION,var):\
defined(RS_MINI_VERSION,var):\
defined(RS_EXTRA_VERSION,var) {
message("RetroShare version $${RS_MAJOR_VERSION}.$${RS_MINOR_VERSION}.$${RS_MINI_VERSION}$${RS_EXTRA_VERSION} defined in command line")
DEFINES += RS_MAJOR_VERSION=$${RS_MAJOR_VERSION}
DEFINES += RS_MINOR_VERSION=$${RS_MINOR_VERSION}
DEFINES += RS_MINI_VERSION=$${RS_MINI_VERSION}
DEFINES += RS_EXTRA_VERSION=\\\"$${RS_EXTRA_VERSION}\\\"
} else {
RS_GIT_DESCRIBE = $$system(git describe)
isEmpty(RS_GIT_DESCRIBE) {
warning("Determining RetroShare version via git failed plese specify it trough qmake command line arguments!")
} else {
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE,v)
RS_GIT_DESCRIBE_SPLIT = $$take_first(RS_GIT_DESCRIBE_SPLIT)
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT,.)
RS_MAJOR_VERSION = $$take_first(RS_GIT_DESCRIBE_SPLIT)
RS_MINOR_VERSION = $$take_first(RS_GIT_DESCRIBE_SPLIT)
RS_GIT_DESCRIBE_SPLIT = $$take_first(RS_GIT_DESCRIBE_SPLIT)
RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT,-)
RS_MINI_VERSION = $$take_first(RS_GIT_DESCRIBE_SPLIT)
RS_EXTRA_VERSION = $$join(RS_GIT_DESCRIBE_SPLIT,-,-)
message("RetroShare version $${RS_MAJOR_VERSION}.$${RS_MINOR_VERSION}.$${RS_MINI_VERSION}$${RS_EXTRA_VERSION} determined via git")
DEFINES += RS_MAJOR_VERSION=$${RS_MAJOR_VERSION}
DEFINES += RS_MINOR_VERSION=$${RS_MINOR_VERSION}
DEFINES += RS_MINI_VERSION=$${RS_MINI_VERSION}
DEFINES += RS_EXTRA_VERSION=\\\"$${RS_EXTRA_VERSION}\\\"
}
}
gxsdistsync:DEFINES *= RS_USE_GXS_DISTANT_SYNC gxsdistsync:DEFINES *= RS_USE_GXS_DISTANT_SYNC
wikipoos:DEFINES *= RS_USE_WIKI wikipoos:DEFINES *= RS_USE_WIKI
rs_gxs:DEFINES *= RS_ENABLE_GXS rs_gxs:DEFINES *= RS_ENABLE_GXS