From 50baccdb630df6a10dc7fe16af3efc2710848890 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 9 May 2018 17:59:14 -0700 Subject: [PATCH 1/9] add the short SHA to master and PR build version --- cmake/macros/SetPackagingParameters.cmake | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index 36e5a065df..7b393bc5fe 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -32,6 +32,16 @@ macro(SET_PACKAGING_PARAMETERS) set(CLIENT_COMPONENT client) set(SERVER_COMPONENT server) + # grab the abbreviated commit SHA + # since is added to the build version for PR builds and master/nightly builds + execute_process( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + if (RELEASE_TYPE STREQUAL "PRODUCTION") set(DEPLOY_PACKAGE TRUE) set(PRODUCTION_BUILD 1) @@ -50,12 +60,15 @@ macro(SET_PACKAGING_PARAMETERS) message(STATUS "The RELEASE_TYPE is PRODUCTION and the BUILD_BRANCH is stable...") set(BUILD_GLOBAL_SERVICES "STABLE") set(USE_STABLE_GLOBAL_SERVICES 1) - endif() + else () + # assume this is a master/nightly build and append the short commit SHA + set(BUILD_VERSION "${BUILD_VERSION}-${GIT_COMMIT_HASH}") + endif () elseif (RELEASE_TYPE STREQUAL "PR") set(DEPLOY_PACKAGE TRUE) set(PR_BUILD 1) - set(BUILD_VERSION "PR${RELEASE_NUMBER}") + set(BUILD_VERSION "PR${RELEASE_NUMBER}-${GIT_COMMIT_HASH}") set(BUILD_ORGANIZATION "High Fidelity - ${BUILD_VERSION}") set(INTERFACE_BUNDLE_NAME "Interface") set(INTERFACE_ICON_PREFIX "interface-beta") From c3595a3216b67b54e60bd2e6e61390e6fbb62e25 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 9 May 2018 18:26:35 -0700 Subject: [PATCH 2/9] pass STABLE_BUILD instead of BUILD_BRANCH through cmake --- android/app/build.gradle | 3 +-- android/build.gradle | 4 +-- cmake/macros/SetPackagingParameters.cmake | 17 ++++++++----- cmake/templates/BuildInfo.h.in | 2 +- domain-server/src/DomainServer.cpp | 6 ++--- interface/src/Application.cpp | 30 +++++++++++------------ 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 70f7c622a0..c8ea89dec0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -22,7 +22,7 @@ android { '-DHIFI_ANDROID_PRECOMPILED=' + HIFI_ANDROID_PRECOMPILED, '-DRELEASE_NUMBER=' + RELEASE_NUMBER, '-DRELEASE_TYPE=' + RELEASE_TYPE, - '-DBUILD_BRANCH=' + BUILD_BRANCH, + '-DSTABLE_BUILD=' + STABLE_BUILD, '-DDISABLE_QML=OFF', '-DDISABLE_KTX_CACHE=OFF' } @@ -116,4 +116,3 @@ dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') } - diff --git a/android/build.gradle b/android/build.gradle index 74047dccab..99ed44e0dc 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -37,7 +37,7 @@ task clean(type: Delete) { ext { RELEASE_NUMBER = project.hasProperty('RELEASE_NUMBER') ? project.getProperty('RELEASE_NUMBER') : '0' RELEASE_TYPE = project.hasProperty('RELEASE_TYPE') ? project.getProperty('RELEASE_TYPE') : 'DEV' - BUILD_BRANCH = project.hasProperty('BUILD_BRANCH') ? project.getProperty('BUILD_BRANCH') : '' + STABLE_BUILD = project.hasProperty('STABLE_BUILD') ? project.getProperty('STABLE_BUILD') : '0' EXEC_SUFFIX = Os.isFamily(Os.FAMILY_WINDOWS) ? '.exe' : '' QT5_DEPS = [ 'Qt5Concurrent', @@ -536,7 +536,7 @@ task cleanDependencies(type: Delete) { -// FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. +// FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. // See the comment on the qtBundle task above /* // FIXME derive the path from the gradle environment diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index 7b393bc5fe..104dc5b68f 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -20,11 +20,8 @@ macro(SET_PACKAGING_PARAMETERS) set_from_env(RELEASE_TYPE RELEASE_TYPE "DEV") set_from_env(RELEASE_NUMBER RELEASE_NUMBER "") - set_from_env(BUILD_BRANCH BRANCH "") - string(TOLOWER "${BUILD_BRANCH}" BUILD_BRANCH) + set_from_env(STABLE_BUILD STABLE_BUILD 0) - message(STATUS "The BUILD_BRANCH variable is: ${BUILD_BRANCH}") - message(STATUS "The BRANCH environment variable is: $ENV{BRANCH}") message(STATUS "The RELEASE_TYPE variable is: ${RELEASE_TYPE}") # setup component categories for installer @@ -56,8 +53,8 @@ macro(SET_PACKAGING_PARAMETERS) # if the build is a PRODUCTION_BUILD from the "stable" branch # then use the STABLE gobal services - if (BUILD_BRANCH STREQUAL "stable") - message(STATUS "The RELEASE_TYPE is PRODUCTION and the BUILD_BRANCH is stable...") + if (STABLE_BUILD) + message(STATUS "The RELEASE_TYPE is PRODUCTION and STABLE_BUILD is 1") set(BUILD_GLOBAL_SERVICES "STABLE") set(USE_STABLE_GLOBAL_SERVICES 1) else () @@ -87,6 +84,14 @@ macro(SET_PACKAGING_PARAMETERS) endif () string(TIMESTAMP BUILD_TIME "%d/%m/%Y") + + # if STABLE_BUILD is 1, PRODUCTION_BUILD must be 1 and + # DEV_BUILD and PR_BUILD must be 0 + if (STABLE_BUILD) + if (NOT PRODUCTION_BUILD OR PR_BUILD OR DEV_BUILD) + message(FATAL_ERROR "Cannot produce STABLE_BUILD without PRODUCTION_BUILD") + endif () + endif () if (DEPLOY_PACKAGE) # for deployed packages always grab the serverless content diff --git a/cmake/templates/BuildInfo.h.in b/cmake/templates/BuildInfo.h.in index 904d17293b..8618578874 100644 --- a/cmake/templates/BuildInfo.h.in +++ b/cmake/templates/BuildInfo.h.in @@ -24,7 +24,7 @@ namespace BuildInfo { const QString MODIFIED_ORGANIZATION = "@BUILD_ORGANIZATION@"; const QString ORGANIZATION_DOMAIN = "highfidelity.io"; const QString VERSION = "@BUILD_VERSION@"; - const QString BUILD_BRANCH = "@BUILD_BRANCH@"; + const QString STABLE_BUILD = "@STABLE_BUILD@"; const QString BUILD_GLOBAL_SERVICES = "@BUILD_GLOBAL_SERVICES@"; const QString BUILD_TIME = "@BUILD_TIME@"; } diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index baeac043e4..e2936199dc 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -177,7 +177,7 @@ DomainServer::DomainServer(int argc, char* argv[]) : qDebug() << "[VERSION] Build sequence:" << qPrintable(applicationVersion()); qDebug() << "[VERSION] MODIFIED_ORGANIZATION:" << BuildInfo::MODIFIED_ORGANIZATION; qDebug() << "[VERSION] VERSION:" << BuildInfo::VERSION; - qDebug() << "[VERSION] BUILD_BRANCH:" << BuildInfo::BUILD_BRANCH; + qDebug() << "[VERSION] STABLE_BUILD:" << BuildInfo::STABLE_BUILD; qDebug() << "[VERSION] BUILD_GLOBAL_SERVICES:" << BuildInfo::BUILD_GLOBAL_SERVICES; qDebug() << "[VERSION] We will be using this name to find ICE servers:" << _iceServerAddr; @@ -1114,7 +1114,7 @@ void DomainServer::handleConnectedNode(SharedNodePointer newNode) { } void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const HifiSockAddr &senderSockAddr) { - const int NUM_DOMAIN_LIST_EXTENDED_HEADER_BYTES = NUM_BYTES_RFC4122_UUID + NLPacket::NUM_BYTES_LOCALID + + const int NUM_DOMAIN_LIST_EXTENDED_HEADER_BYTES = NUM_BYTES_RFC4122_UUID + NLPacket::NUM_BYTES_LOCALID + NUM_BYTES_RFC4122_UUID + NLPacket::NUM_BYTES_LOCALID + 4; // setup the extended header for the domain list packets @@ -2676,7 +2676,7 @@ bool DomainServer::isAuthenticatedRequest(HTTPConnection* connection, const QUrl QString settingsPassword = settingsPasswordVariant.isValid() ? settingsPasswordVariant.toString() : ""; QString hexHeaderPassword = headerPassword.isEmpty() ? "" : QCryptographicHash::hash(headerPassword.toUtf8(), QCryptographicHash::Sha256).toHex(); - + if (settingsUsername == headerUsername && hexHeaderPassword == settingsPassword) { return true; } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6a102f418b..d158b4b054 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -693,8 +693,8 @@ private: }; /**jsdoc - *

The Controller.Hardware.Application object has properties representing Interface's state. The property - * values are integer IDs, uniquely identifying each output. Read-only. These can be mapped to actions or functions or + *

The Controller.Hardware.Application object has properties representing Interface's state. The property + * values are integer IDs, uniquely identifying each output. Read-only. These can be mapped to actions or functions or * Controller.Standard items in a {@link RouteObject} mapping (e.g., using the {@link RouteObject#when} method). * Each data value is either 1.0 for "true" or 0.0 for "false".

* @@ -776,7 +776,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset"; bool suppressPrompt = cmdOptionExists(argc, const_cast(argv), SUPPRESS_SETTINGS_RESET); - // Ignore any previous crashes if running from command line with a test script. + // Ignore any previous crashes if running from command line with a test script. bool inTestMode { false }; for (int i = 0; i < argc; ++i) { QString parameter(argv[i]); @@ -1112,7 +1112,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo qCDebug(interfaceapp) << "[VERSION] Build sequence:" << qPrintable(applicationVersion()); qCDebug(interfaceapp) << "[VERSION] MODIFIED_ORGANIZATION:" << BuildInfo::MODIFIED_ORGANIZATION; qCDebug(interfaceapp) << "[VERSION] VERSION:" << BuildInfo::VERSION; - qCDebug(interfaceapp) << "[VERSION] BUILD_BRANCH:" << BuildInfo::BUILD_BRANCH; + qCDebug(interfaceapp) << "[VERSION] STABLE_BUILD:" << BuildInfo::STABLE_BUILD; qCDebug(interfaceapp) << "[VERSION] BUILD_GLOBAL_SERVICES:" << BuildInfo::BUILD_GLOBAL_SERVICES; #if USE_STABLE_GLOBAL_SERVICES qCDebug(interfaceapp) << "[VERSION] We will use STABLE global services."; @@ -1369,11 +1369,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo initializeGL(); qCDebug(interfaceapp, "Initialized GL"); - // Initialize the display plugin architecture + // Initialize the display plugin architecture initializeDisplayPlugins(); qCDebug(interfaceapp, "Initialized Display"); - // Create the rendering engine. This can be slow on some machines due to lots of + // Create the rendering engine. This can be slow on some machines due to lots of // GPU pipeline creation. initializeRenderEngine(); qCDebug(interfaceapp, "Initialized Render Engine."); @@ -1417,7 +1417,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo // In practice we shouldn't run across installs that don't have a known installer type. // Client or Client+Server installs should always have the installer.ini next to their // respective interface.exe, and Steam installs will be detected as such. If a user were - // to delete the installer.ini, though, and as an example, we won't know the context of the + // to delete the installer.ini, though, and as an example, we won't know the context of the // original install. constexpr auto INSTALLER_KEY_TYPE = "type"; constexpr auto INSTALLER_KEY_CAMPAIGN = "campaign"; @@ -2182,7 +2182,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo if (testProperty.isValid()) { auto scriptEngines = DependencyManager::get(); const auto testScript = property(hifi::properties::TEST).toUrl(); - + // Set last parameter to exit interface when the test script finishes, if so requested scriptEngines->loadScript(testScript, false, false, false, false, quitWhenFinished); @@ -2399,7 +2399,7 @@ void Application::onAboutToQuit() { } } - // The active display plugin needs to be loaded before the menu system is active, + // The active display plugin needs to be loaded before the menu system is active, // so its persisted explicitly here Setting::Handle{ ACTIVE_DISPLAY_PLUGIN_SETTING_NAME }.set(getActiveDisplayPlugin()->getName()); @@ -2633,7 +2633,7 @@ void Application::initializeGL() { // Create the GPU backend // Requires the window context, because that's what's used in the actual rendering - // and the GPU backend will make things like the VAO which cannot be shared across + // and the GPU backend will make things like the VAO which cannot be shared across // contexts _glWidget->makeCurrent(); gpu::Context::init(); @@ -2656,7 +2656,7 @@ void Application::initializeDisplayPlugins() { auto lastActiveDisplayPluginName = activeDisplayPluginSetting.get(); auto defaultDisplayPlugin = displayPlugins.at(0); - // Once time initialization code + // Once time initialization code DisplayPluginPointer targetDisplayPlugin; foreach(auto displayPlugin, displayPlugins) { displayPlugin->setContext(_gpuContext); @@ -2669,7 +2669,7 @@ void Application::initializeDisplayPlugins() { } // The default display plugin needs to be activated first, otherwise the display plugin thread - // may be launched by an external plugin, which is bad + // may be launched by an external plugin, which is bad setDisplayPlugin(defaultDisplayPlugin); // Now set the desired plugin if it's not the same as the default plugin @@ -5820,7 +5820,7 @@ void Application::update(float deltaTime) { viewIsDifferentEnough = true; } - + // if it's been a while since our last query or the view has significantly changed then send a query, otherwise suppress it static const std::chrono::seconds MIN_PERIOD_BETWEEN_QUERIES { 3 }; auto now = SteadyClock::now(); @@ -7749,7 +7749,7 @@ void Application::sendLambdaEvent(const std::function& f) { } else { LambdaEvent event(f); QCoreApplication::sendEvent(this, &event); - } + } } void Application::initPlugins(const QStringList& arguments) { @@ -7972,7 +7972,7 @@ void Application::setDisplayPlugin(DisplayPluginPointer newDisplayPlugin) { } // FIXME don't have the application directly set the state of the UI, - // instead emit a signal that the display plugin is changing and let + // instead emit a signal that the display plugin is changing and let // the desktop lock itself. Reduces coupling between the UI and display // plugins auto offscreenUi = DependencyManager::get(); From 55bf70991bd7dab97acda33836b9bb600b6a82b7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 9 May 2018 18:34:42 -0700 Subject: [PATCH 3/9] cleanup wording and formatting for version in window title --- interface/src/Application.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d158b4b054..4239cb2f2c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6188,7 +6188,8 @@ void Application::updateWindowTitle() const { auto nodeList = DependencyManager::get(); auto accountManager = DependencyManager::get(); - QString buildVersion = " (build " + applicationVersion() + ")"; + QString buildVersion = " - " + + (BuildInfo::STABLE_BUILD == "1" ? QString("Version") : QString("Build")) + " " + applicationVersion(); QString loginStatus = accountManager->isLoggedIn() ? "" : " (NOT LOGGED IN)"; From 7c852916b927f0fdaa9b31394d44541bf07c8c9d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 9 May 2018 18:43:51 -0700 Subject: [PATCH 4/9] fail master/PR build without short SHA --- cmake/macros/SetPackagingParameters.cmake | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index 104dc5b68f..91d1e1fa8f 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -29,16 +29,6 @@ macro(SET_PACKAGING_PARAMETERS) set(CLIENT_COMPONENT client) set(SERVER_COMPONENT server) - # grab the abbreviated commit SHA - # since is added to the build version for PR builds and master/nightly builds - execute_process( - COMMAND git log -1 --format=%h - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_COMMIT_HASH - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET - ) - if (RELEASE_TYPE STREQUAL "PRODUCTION") set(DEPLOY_PACKAGE TRUE) set(PRODUCTION_BUILD 1) @@ -57,16 +47,13 @@ macro(SET_PACKAGING_PARAMETERS) message(STATUS "The RELEASE_TYPE is PRODUCTION and STABLE_BUILD is 1") set(BUILD_GLOBAL_SERVICES "STABLE") set(USE_STABLE_GLOBAL_SERVICES 1) - else () - # assume this is a master/nightly build and append the short commit SHA - set(BUILD_VERSION "${BUILD_VERSION}-${GIT_COMMIT_HASH}") endif () elseif (RELEASE_TYPE STREQUAL "PR") set(DEPLOY_PACKAGE TRUE) set(PR_BUILD 1) - set(BUILD_VERSION "PR${RELEASE_NUMBER}-${GIT_COMMIT_HASH}") - set(BUILD_ORGANIZATION "High Fidelity - ${BUILD_VERSION}") + set(BUILD_VERSION "PR${RELEASE_NUMBER}") + set(BUILD_ORGANIZATION "High Fidelity - PR${RELEASE_NUMBER}") set(INTERFACE_BUNDLE_NAME "Interface") set(INTERFACE_ICON_PREFIX "interface-beta") @@ -85,6 +72,19 @@ macro(SET_PACKAGING_PARAMETERS) string(TIMESTAMP BUILD_TIME "%d/%m/%Y") + if (PRODUCTION_BUILD OR PR_BUILD AND NOT STABLE_BUILD) + # append the abbreviated commit SHA to the build version + # since this is a PR build or master/nightly builds + execute_process( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + set(BUILD_VERSION "${BUILD_VERSION}-${GIT_COMMIT_HASH}") + endif () + # if STABLE_BUILD is 1, PRODUCTION_BUILD must be 1 and # DEV_BUILD and PR_BUILD must be 0 if (STABLE_BUILD) From 45b8c1248cda38665eb1885f3b528a7b5fd62a4e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 10 May 2018 15:35:36 -0700 Subject: [PATCH 5/9] disable version checking for nightly builds --- libraries/auto-updater/src/AutoUpdater.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/auto-updater/src/AutoUpdater.cpp b/libraries/auto-updater/src/AutoUpdater.cpp index e58ac067a6..8e89edb7a7 100644 --- a/libraries/auto-updater/src/AutoUpdater.cpp +++ b/libraries/auto-updater/src/AutoUpdater.cpp @@ -11,6 +11,8 @@ #include "AutoUpdater.h" +#include + #include #include #include @@ -157,10 +159,8 @@ void AutoUpdater::parseLatestVersionData() { } void AutoUpdater::checkVersionAndNotify() { - if (QCoreApplication::applicationVersion() == "dev" || - QCoreApplication::applicationVersion().contains("PR") || - _builds.empty()) { - // No version checking is required in dev builds or when no build + if (BuildInfo::STABLE_BUILD == "0" || _builds.empty()) { + // No version checking is required in nightly/PR/dev builds or when no build // data was found for the platform return; } @@ -196,4 +196,4 @@ void AutoUpdater::appendBuildData(int versionNumber, thisBuildDetails.insert("pullRequestNumber", pullRequestNumber); _builds.insert(versionNumber, thisBuildDetails); -} \ No newline at end of file +} From 2cb7c9cc62ee4e9941cf9d512b2078629fd6720b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 10 May 2018 16:11:50 -0700 Subject: [PATCH 6/9] add a BUILD_TYPE to BuildInfo, fix conditional --- cmake/macros/SetPackagingParameters.cmake | 23 +++++++++++++--------- cmake/templates/BuildInfo.h.in | 22 +++++++++++++++++++-- domain-server/src/DomainServer.cpp | 2 +- interface/src/Application.cpp | 6 ++++-- interface/src/Crashpad.cpp | 3 +++ libraries/auto-updater/src/AutoUpdater.cpp | 2 +- 6 files changed, 43 insertions(+), 15 deletions(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index 91d1e1fa8f..ed5d3cd1fe 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -17,6 +17,7 @@ macro(SET_PACKAGING_PARAMETERS) set(DEV_BUILD 0) set(BUILD_GLOBAL_SERVICES "DEVELOPMENT") set(USE_STABLE_GLOBAL_SERVICES 0) + set(BUILD_NUMBER 0) set_from_env(RELEASE_TYPE RELEASE_TYPE "DEV") set_from_env(RELEASE_NUMBER RELEASE_NUMBER "") @@ -71,8 +72,16 @@ macro(SET_PACKAGING_PARAMETERS) endif () string(TIMESTAMP BUILD_TIME "%d/%m/%Y") - - if (PRODUCTION_BUILD OR PR_BUILD AND NOT STABLE_BUILD) + + # if STABLE_BUILD is 1, PRODUCTION_BUILD must be 1 and + # DEV_BUILD and PR_BUILD must be 0 + if (STABLE_BUILD) + if ((NOT PRODUCTION_BUILD) OR PR_BUILD OR DEV_BUILD) + message(FATAL_ERROR "Cannot produce STABLE_BUILD without PRODUCTION_BUILD") + endif () + endif () + + if ((PRODUCTION_BUILD OR PR_BUILD) AND NOT STABLE_BUILD) # append the abbreviated commit SHA to the build version # since this is a PR build or master/nightly builds execute_process( @@ -83,14 +92,10 @@ macro(SET_PACKAGING_PARAMETERS) ) set(BUILD_VERSION "${BUILD_VERSION}-${GIT_COMMIT_HASH}") - endif () - # if STABLE_BUILD is 1, PRODUCTION_BUILD must be 1 and - # DEV_BUILD and PR_BUILD must be 0 - if (STABLE_BUILD) - if (NOT PRODUCTION_BUILD OR PR_BUILD OR DEV_BUILD) - message(FATAL_ERROR "Cannot produce STABLE_BUILD without PRODUCTION_BUILD") - endif () + # pass along a release number without the SHA in case somebody + # wants to compare master or PR builds as integers + set(BUILD_NUMBER ${RELEASE_NUMBER}) endif () if (DEPLOY_PACKAGE) diff --git a/cmake/templates/BuildInfo.h.in b/cmake/templates/BuildInfo.h.in index 8618578874..9fc9d9be81 100644 --- a/cmake/templates/BuildInfo.h.in +++ b/cmake/templates/BuildInfo.h.in @@ -24,8 +24,26 @@ namespace BuildInfo { const QString MODIFIED_ORGANIZATION = "@BUILD_ORGANIZATION@"; const QString ORGANIZATION_DOMAIN = "highfidelity.io"; const QString VERSION = "@BUILD_VERSION@"; - const QString STABLE_BUILD = "@STABLE_BUILD@"; + const QString BUILD_NUMBER = "@BUILD_NUMBER@"; const QString BUILD_GLOBAL_SERVICES = "@BUILD_GLOBAL_SERVICES@"; const QString BUILD_TIME = "@BUILD_TIME@"; -} + enum BuildType { + Dev, + PR, + Master, + Stable + }; + +#if defined(PR_BUILD) + const BuildType BUILD_TYPE = PR; + const QString BUILD_TYPE_STRING = "pr"; +#elif defined(PRODUCTION_BUILD) + const BuildType BUILD_TYPE = @STABLE_BUILD@ ? Stable : Master; + const QString BUILD_TYPE_STRING = @STABLE_BUILD@ ? "stable" : "master"; +#else + const BuildType BUILD_TYPE = Dev; + const QString BUILD_TYPE_STRING = "dev"; +#endif + +} diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index e2936199dc..dcf1218b20 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -177,7 +177,7 @@ DomainServer::DomainServer(int argc, char* argv[]) : qDebug() << "[VERSION] Build sequence:" << qPrintable(applicationVersion()); qDebug() << "[VERSION] MODIFIED_ORGANIZATION:" << BuildInfo::MODIFIED_ORGANIZATION; qDebug() << "[VERSION] VERSION:" << BuildInfo::VERSION; - qDebug() << "[VERSION] STABLE_BUILD:" << BuildInfo::STABLE_BUILD; + qDebug() << "[VERSION] BUILD_TYPE_STRING:" << BuildInfo::BUILD_TYPE_STRING; qDebug() << "[VERSION] BUILD_GLOBAL_SERVICES:" << BuildInfo::BUILD_GLOBAL_SERVICES; qDebug() << "[VERSION] We will be using this name to find ICE servers:" << _iceServerAddr; diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4239cb2f2c..ddbd4b0188 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1112,7 +1112,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo qCDebug(interfaceapp) << "[VERSION] Build sequence:" << qPrintable(applicationVersion()); qCDebug(interfaceapp) << "[VERSION] MODIFIED_ORGANIZATION:" << BuildInfo::MODIFIED_ORGANIZATION; qCDebug(interfaceapp) << "[VERSION] VERSION:" << BuildInfo::VERSION; - qCDebug(interfaceapp) << "[VERSION] STABLE_BUILD:" << BuildInfo::STABLE_BUILD; + qCDebug(interfaceapp) << "[VERSION] BUILD_TYPE_STRING:" << BuildInfo::BUILD_TYPE_STRING; qCDebug(interfaceapp) << "[VERSION] BUILD_GLOBAL_SERVICES:" << BuildInfo::BUILD_GLOBAL_SERVICES; #if USE_STABLE_GLOBAL_SERVICES qCDebug(interfaceapp) << "[VERSION] We will use STABLE global services."; @@ -1465,6 +1465,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) }, { "installer_campaign", installerCampaign }, { "installer_type", installerType }, + { "build_type", BuildInfo::BUILD_TYPE_STRING }, { "previousSessionCrashed", _previousSessionCrashed }, { "previousSessionRuntime", sessionRunTime.get() }, { "cpu_architecture", QSysInfo::currentCpuArchitecture() }, @@ -6189,7 +6190,8 @@ void Application::updateWindowTitle() const { auto accountManager = DependencyManager::get(); QString buildVersion = " - " - + (BuildInfo::STABLE_BUILD == "1" ? QString("Version") : QString("Build")) + " " + applicationVersion(); + + (BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable ? QString("Version") : QString("Build")) + + " " + applicationVersion(); QString loginStatus = accountManager->isLoggedIn() ? "" : " (NOT LOGGED IN)"; diff --git a/interface/src/Crashpad.cpp b/interface/src/Crashpad.cpp index 45f1d0778f..88651925d5 100644 --- a/interface/src/Crashpad.cpp +++ b/interface/src/Crashpad.cpp @@ -18,6 +18,7 @@ #if HAS_CRASHPAD #include +#include #include #include @@ -69,6 +70,8 @@ bool startCrashHandler() { annotations["token"] = BACKTRACE_TOKEN; annotations["format"] = "minidump"; annotations["version"] = BuildInfo::VERSION.toStdString(); + annotations["build_number"] = BuildInfo::BUILD_NUMBER.toStdString(); + annotations["build_type"] = BuildInfo::BUILD_TYPE_STRING.toStdString(); arguments.push_back("--no-rate-limit"); diff --git a/libraries/auto-updater/src/AutoUpdater.cpp b/libraries/auto-updater/src/AutoUpdater.cpp index 8e89edb7a7..6749cd9e10 100644 --- a/libraries/auto-updater/src/AutoUpdater.cpp +++ b/libraries/auto-updater/src/AutoUpdater.cpp @@ -159,7 +159,7 @@ void AutoUpdater::parseLatestVersionData() { } void AutoUpdater::checkVersionAndNotify() { - if (BuildInfo::STABLE_BUILD == "0" || _builds.empty()) { + if (BuildInfo::BUILD_TYPE != BuildInfo::BuildType::Stable || _builds.empty()) { // No version checking is required in nightly/PR/dev builds or when no build // data was found for the platform return; From 2c9648daaf2ab2692203fff170637d694c5220ac Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 11 May 2018 17:01:51 -0700 Subject: [PATCH 7/9] grab correct SHA for PR_BUILD, fatally error if not found --- cmake/macros/SetPackagingParameters.cmake | 26 +++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index ed5d3cd1fe..c589d8efff 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -84,13 +84,35 @@ macro(SET_PACKAGING_PARAMETERS) if ((PRODUCTION_BUILD OR PR_BUILD) AND NOT STABLE_BUILD) # append the abbreviated commit SHA to the build version # since this is a PR build or master/nightly builds + + # for PR_BUILDS, we need to grab the abbreviated SHA + # for the second parent of HEAD (not HEAD) since that is the + # SHA of the commit merged to master for the build + if (PR_BUILD) + set(_GIT_LOG_FORMAT "%p") + else () + set(_GIT_LOG_FORMAT "%h") + endif () + execute_process( - COMMAND git log -1 --format=%h + COMMAND git log -1 --format=${_GIT_LOG_FORMAT} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_VARIABLE _GIT_LOG_OUTPUT + ERROR_VARIABLE _GIT_LOG_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE ) + if (PR_BUILD) + separate_arguments(_COMMIT_PARENTS UNIX_COMMAND ${_GIT_LOG_OUTPUT}) + list(GET _COMMIT_PARENTS 1 GIT_COMMIT_HASH) + else () + set(GIT_COMMIT_HASH _GIT_LOG_OUTPUT) + endif () + + if (_GIT_LOG_ERROR OR NOT GIT_COMMIT_HASH) + message(FATAL_ERROR "Could not retreive abbreviated SHA for PR or production master build") + endif () + set(BUILD_VERSION "${BUILD_VERSION}-${GIT_COMMIT_HASH}") # pass along a release number without the SHA in case somebody From 33a122c08eac017d3d3857a556cb62cede97627c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 30 May 2018 12:05:07 -0700 Subject: [PATCH 8/9] remove short SHA where it should not appear --- cmake/macros/SetPackagingParameters.cmake | 5 +++-- cmake/templates/console-build-info.json.in | 3 ++- server-console/src/main.js | 5 +---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index c589d8efff..bde6d55e84 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -113,6 +113,7 @@ macro(SET_PACKAGING_PARAMETERS) message(FATAL_ERROR "Could not retreive abbreviated SHA for PR or production master build") endif () + set(BUILD_VERSION_NO_SHA ${BUILD_VERSION}) set(BUILD_VERSION "${BUILD_VERSION}-${GIT_COMMIT_HASH}") # pass along a release number without the SHA in case somebody @@ -172,8 +173,8 @@ macro(SET_PACKAGING_PARAMETERS) set(INTERFACE_SHORTCUT_NAME "High Fidelity Interface") set(CONSOLE_SHORTCUT_NAME "Sandbox") else () - set(INTERFACE_SHORTCUT_NAME "High Fidelity Interface - ${BUILD_VERSION}") - set(CONSOLE_SHORTCUT_NAME "Sandbox - ${BUILD_VERSION}") + set(INTERFACE_SHORTCUT_NAME "High Fidelity Interface - ${BUILD_VERSION_NO_SHA}") + set(CONSOLE_SHORTCUT_NAME "Sandbox - ${BUILD_VERSION_NO_SHA}") endif () set(INTERFACE_HF_SHORTCUT_NAME "${INTERFACE_SHORTCUT_NAME}") diff --git a/cmake/templates/console-build-info.json.in b/cmake/templates/console-build-info.json.in index c1ef010e08..6b4ee99292 100644 --- a/cmake/templates/console-build-info.json.in +++ b/cmake/templates/console-build-info.json.in @@ -1,4 +1,5 @@ { "releaseType": "@RELEASE_TYPE@", - "buildIdentifier": "@BUILD_VERSION@" + "buildIdentifier": "@BUILD_VERSION@", + "organization": "@BUILD_ORGANIZATION@" } diff --git a/server-console/src/main.js b/server-console/src/main.js index b08db6222f..8a92fc8a5d 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -76,10 +76,7 @@ function getBuildInfo() { const buildInfo = getBuildInfo(); function getRootHifiDataDirectory() { - var organization = "High Fidelity"; - if (buildInfo.releaseType != "PRODUCTION") { - organization += ' - ' + buildInfo.buildIdentifier; - } + var organization = buildInfo.organization; if (osType == 'Windows_NT') { return path.resolve(osHomeDir(), 'AppData/Roaming', organization); } else if (osType == 'Darwin') { From b9e9c952de3473b6e8a52893c2b1b6e8afd8ff65 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 30 May 2018 12:15:39 -0700 Subject: [PATCH 9/9] fix setting of abbreviated SHA for master builds --- cmake/macros/SetPackagingParameters.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index bde6d55e84..029c829022 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -106,7 +106,7 @@ macro(SET_PACKAGING_PARAMETERS) separate_arguments(_COMMIT_PARENTS UNIX_COMMAND ${_GIT_LOG_OUTPUT}) list(GET _COMMIT_PARENTS 1 GIT_COMMIT_HASH) else () - set(GIT_COMMIT_HASH _GIT_LOG_OUTPUT) + set(GIT_COMMIT_HASH ${_GIT_LOG_OUTPUT}) endif () if (_GIT_LOG_ERROR OR NOT GIT_COMMIT_HASH)