diff --git a/android/app/build.gradle b/android/app/build.gradle index 46de9642d9..699008092c 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' } @@ -128,4 +128,3 @@ dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') } - diff --git a/android/build.gradle b/android/build.gradle index f09dc97850..f1fe4ffc7f 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', @@ -542,7 +542,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 36e5a065df..029c829022 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -17,14 +17,12 @@ 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 "") - 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 @@ -46,17 +44,17 @@ 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) - endif() + endif () elseif (RELEASE_TYPE STREQUAL "PR") set(DEPLOY_PACKAGE TRUE) set(PR_BUILD 1) set(BUILD_VERSION "PR${RELEASE_NUMBER}") - set(BUILD_ORGANIZATION "High Fidelity - ${BUILD_VERSION}") + set(BUILD_ORGANIZATION "High Fidelity - PR${RELEASE_NUMBER}") set(INTERFACE_BUNDLE_NAME "Interface") set(INTERFACE_ICON_PREFIX "interface-beta") @@ -75,6 +73,54 @@ macro(SET_PACKAGING_PARAMETERS) 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 ((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=${_GIT_LOG_FORMAT} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + 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_NO_SHA ${BUILD_VERSION}) + set(BUILD_VERSION "${BUILD_VERSION}-${GIT_COMMIT_HASH}") + + # 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) # for deployed packages always grab the serverless content set(DOWNLOAD_SERVERLESS_CONTENT ON) @@ -127,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/BuildInfo.h.in b/cmake/templates/BuildInfo.h.in index 904d17293b..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 BUILD_BRANCH = "@BUILD_BRANCH@"; + 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/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/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 42a74aa2fc..e69e241182 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -176,7 +176,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] 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; @@ -1122,7 +1122,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 @@ -2684,7 +2684,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 62b2486555..c5857dac53 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -697,8 +697,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".