mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-14 01:30:49 +00:00
Clean up build information and version interface.
This removes git dependencies from everything except for version.cpp, and removes the associated interfaces in version.h. Since the full version string contains the branch and revision number where applicable, the build information no longer needs to report branch and revision separately. It also now queries version.cpp for a more consistent and reliable build time. Debug output of build information is also now more consistent with less redundant code.
This commit is contained in:
parent
2e92107cce
commit
1f4bb2d435
@ -185,16 +185,9 @@ QString getGraphicsEngine()
|
|||||||
|
|
||||||
QStringList buildInfo;
|
QStringList buildInfo;
|
||||||
|
|
||||||
QStringList makeBuildInfo (QString relinfo, QString forcedEngine){
|
QStringList makeBuildInfo (QString forcedEngine){
|
||||||
buildInfo << (STR_AppName + " " + getVersion() + " " + relinfo);
|
// application name and version has already been added
|
||||||
buildInfo << (QObject::tr("Built with Qt") + " " + QT_VERSION_STR + " on " + __DATE__ + " " + __TIME__);
|
buildInfo << (QObject::tr("Built with Qt %1 on %2").arg(QT_VERSION_STR).arg(getBuildDateTime()));
|
||||||
QString branch = "";
|
|
||||||
if (gitBranch() != "master") {
|
|
||||||
branch = QObject::tr("Branch:") + " " + gitBranch() + ", ";
|
|
||||||
}
|
|
||||||
buildInfo << branch + (QObject::tr("Revision")) + " " + gitRevision();
|
|
||||||
if (getAppName() != STR_AppName) // Report any non-standard app key
|
|
||||||
buildInfo << (QObject::tr("App key:") + " " + getAppName());
|
|
||||||
buildInfo << QString("");
|
buildInfo << QString("");
|
||||||
buildInfo << (QObject::tr("Operating system:") + " " + QSysInfo::prettyProductName());
|
buildInfo << (QObject::tr("Operating system:") + " " + QSysInfo::prettyProductName());
|
||||||
buildInfo << (QObject::tr("Graphics Engine:") + " " + getOpenGLVersionString());
|
buildInfo << (QObject::tr("Graphics Engine:") + " " + getOpenGLVersionString());
|
||||||
@ -202,6 +195,11 @@ QStringList makeBuildInfo (QString relinfo, QString forcedEngine){
|
|||||||
if (forcedEngine != "")
|
if (forcedEngine != "")
|
||||||
buildInfo << forcedEngine;
|
buildInfo << forcedEngine;
|
||||||
|
|
||||||
|
buildInfo << QString("");
|
||||||
|
if (getAppName() != STR_AppName) // Report any non-standard app key
|
||||||
|
buildInfo << (QObject::tr("App key:") + " " + getAppName());
|
||||||
|
// Data directory will always be added, later.
|
||||||
|
|
||||||
return buildInfo;
|
return buildInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ QString getGraphicsEngine();
|
|||||||
QString getOpenGLVersionString();
|
QString getOpenGLVersionString();
|
||||||
float getOpenGLVersion();
|
float getOpenGLVersion();
|
||||||
|
|
||||||
QStringList makeBuildInfo(QString relinfo, QString forcedEngine);
|
QStringList makeBuildInfo(QString forcedEngine);
|
||||||
QStringList getBuildInfo();
|
QStringList getBuildInfo();
|
||||||
QStringList addBuildInfo (QString value);
|
QStringList addBuildInfo (QString value);
|
||||||
|
|
||||||
|
@ -30,16 +30,8 @@ AboutDialog::AboutDialog(QWidget *parent) :
|
|||||||
ui->relnotesText->setHtml(getRelnotes());
|
ui->relnotesText->setHtml(getRelnotes());
|
||||||
ui->versionLabel->setText("");
|
ui->versionLabel->setText("");
|
||||||
|
|
||||||
// QString gitrev = gitRevision();
|
|
||||||
//
|
|
||||||
// if (!gitrev.isEmpty()) {
|
|
||||||
// gitrev = tr("Revision: %1").arg(QString("<a href='https://gitlab.com/sleepyhead/sleepyhead-code/commit/%1'>%1</a>").arg(gitrev))+"<br/>"
|
|
||||||
// +tr("Branch: %1").arg(QString("<a href='https://gitlab.com/sleepyhead/sleepyhead-code/commits/%1'>%1</a>").arg(gitBranch()))+"<br/>"
|
|
||||||
// +tr("Build Date: %1").arg(__DATE__)+"<br/>"
|
|
||||||
// +tr("Graphics Engine: %1").arg(getGraphicsEngine());
|
|
||||||
// }
|
|
||||||
|
|
||||||
QString path = GetAppData();
|
QString path = GetAppData();
|
||||||
|
// TODO: consider replacing gitrev below with a link or button to the System Information window
|
||||||
QString text = /* gitrev + */ "<br/><br/><a href=\"file:///"+path+"\">"+tr("Show data folder")+"</a>";
|
QString text = /* gitrev + */ "<br/><br/><a href=\"file:///"+path+"\">"+tr("Show data folder")+"</a>";
|
||||||
ui->infoLabel->setText(text);
|
ui->infoLabel->setText(text);
|
||||||
|
|
||||||
|
@ -340,14 +340,19 @@ int main(int argc, char *argv[]) {
|
|||||||
initializeLogger();
|
initializeLogger();
|
||||||
QThread::msleep(50); // Logger takes a little bit to catch up
|
QThread::msleep(50); // Logger takes a little bit to catch up
|
||||||
|
|
||||||
|
qDebug().noquote() << "OSCAR starting" << QDateTime::currentDateTime().toString();
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
QString relinfo = " debug";
|
QString relinfo = " debug";
|
||||||
#else
|
#else
|
||||||
QString relinfo = "";
|
QString relinfo = "";
|
||||||
#endif
|
#endif
|
||||||
relinfo = "("+QSysInfo::kernelType()+" "+QSysInfo::currentCpuArchitecture()+relinfo+")";
|
relinfo = "("+QSysInfo::kernelType()+" "+QSysInfo::currentCpuArchitecture()+relinfo+")";
|
||||||
qDebug() << "OSCAR starting" << QDateTime::currentDateTime();
|
relinfo = STR_AppName + " " + getVersion() + " " + relinfo;
|
||||||
qDebug().noquote() << STR_AppName << getVersion() << relinfo << "Built with Qt" << QT_VERSION_STR << __DATE__ << __TIME__;
|
|
||||||
|
qDebug().noquote() << relinfo;
|
||||||
|
qDebug().noquote() << "Built with Qt" << QT_VERSION_STR << "on" << getBuildDateTime();
|
||||||
|
addBuildInfo(relinfo); // immediately add it to the build info that's accessible from the UI
|
||||||
|
|
||||||
SetDateFormat();
|
SetDateFormat();
|
||||||
|
|
||||||
@ -365,7 +370,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// Moved buildInfo calls to after translation is available as makeBuildInfo includes tr() calls
|
// Moved buildInfo calls to after translation is available as makeBuildInfo includes tr() calls
|
||||||
|
|
||||||
QStringList info = makeBuildInfo(relinfo, forcedEngine);
|
QStringList info = makeBuildInfo(forcedEngine);
|
||||||
for (int i = 0; i < info.size(); ++i)
|
for (int i = 0; i < info.size(); ++i)
|
||||||
qDebug().noquote() << info.at(i);
|
qDebug().noquote() << info.at(i);
|
||||||
|
|
||||||
@ -476,9 +481,8 @@ int main(int argc, char *argv[]) {
|
|||||||
} // The folder doesn't exist
|
} // The folder doesn't exist
|
||||||
else
|
else
|
||||||
qDebug() << "AppData folder already exists, so ...";
|
qDebug() << "AppData folder already exists, so ...";
|
||||||
qDebug() << "Using " + GetAppData() + " as OSCAR data folder";
|
qDebug().noquote() << "Using " + GetAppData() + " as OSCAR data folder";
|
||||||
|
|
||||||
addBuildInfo("");
|
|
||||||
QString path = GetAppData();
|
QString path = GetAppData();
|
||||||
addBuildInfo(QObject::tr("Data directory:") + " <a href=\"file:///" + path + "\">" + path + "</a>");
|
addBuildInfo(QObject::tr("Data directory:") + " <a href=\"file:///" + path + "\">" + path + "</a>");
|
||||||
|
|
||||||
|
@ -25,23 +25,18 @@ const QString PlatformString = "Linux";
|
|||||||
const QString PlatformString = "Haiku";
|
const QString PlatformString = "Haiku";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Technically this is the date and time that version.cpp was compiled, but since
|
||||||
const QString & gitRevision()
|
// it gets recompiled whenever git_info.h changes, it's about as close as we can
|
||||||
{
|
// come without forcing recompiles every single build.
|
||||||
return GIT_REVISION;
|
static const QString s_BuildDateTime = __DATE__ " " __TIME__;
|
||||||
}
|
|
||||||
const QString & gitBranch()
|
|
||||||
{
|
|
||||||
return GIT_BRANCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString getPrereleaseSuffix()
|
QString getPrereleaseSuffix()
|
||||||
{
|
{
|
||||||
QString suffix;
|
QString suffix;
|
||||||
|
|
||||||
// Append branch if there is a branch specified
|
// Append branch if there is a branch specified
|
||||||
if (gitBranch() != "master") {
|
if (GIT_BRANCH != "master") {
|
||||||
suffix += "-"+gitBranch();
|
suffix += "-"+GIT_BRANCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append "-test" if not release or release candidate
|
// Append "-test" if not release or release candidate
|
||||||
@ -54,6 +49,11 @@ QString getPrereleaseSuffix()
|
|||||||
return suffix;
|
return suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString & getBuildDateTime()
|
||||||
|
{
|
||||||
|
return s_BuildDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: add preprocessor macros to build full version number including build metadata, accounting for tarball/non-git builds.
|
// TODO: add preprocessor macros to build full version number including build metadata, accounting for tarball/non-git builds.
|
||||||
|
|
||||||
static const Version s_Version(VERSION "+" + GIT_BRANCH + "-" + GIT_REVISION);
|
static const Version s_Version(VERSION "+" + GIT_BRANCH + "-" + GIT_REVISION);
|
||||||
|
@ -51,8 +51,9 @@ protected:
|
|||||||
//!brief Get the current version of the application.
|
//!brief Get the current version of the application.
|
||||||
const Version & getVersion();
|
const Version & getVersion();
|
||||||
|
|
||||||
|
//!brief Get the date and time of the application was built.
|
||||||
|
const QString & getBuildDateTime();
|
||||||
|
|
||||||
QString getPrereleaseSuffix();
|
QString getPrereleaseSuffix();
|
||||||
const QString & gitRevision();
|
|
||||||
const QString & gitBranch();
|
|
||||||
|
|
||||||
#endif // VERSION_H
|
#endif // VERSION_H
|
||||||
|
Loading…
Reference in New Issue
Block a user