Add build switch to generate time-limited test builds. Use via --testbuild <days>

master
Ansariel 2016-11-30 15:41:15 +01:00
parent 37aee9e812
commit 05c6c72b15
5 changed files with 94 additions and 5 deletions

View File

@ -35,6 +35,14 @@ else (OPENSIM)
endif (OPENSIM)
#</FS:AW optional opensim support>
#<FS:Ansariel> Support for test builds
option(TESTBUILD "Generating test build" OFF)
if(TESTBUILD AND TESTBUILDPERIOD)
add_definitions(-DTESTBUILD=1 -DTESTBUILDPERIOD=${TESTBUILDPERIOD})
message("creating test build version; test period: ${TESTBUILDPERIOD} days")
endif(TESTBUILD AND TESTBUILDPERIOD)
#</FS:Ansariel>
# <FS:Ansariel> [AVX Optimization]
option(USE_AVX_OPTIMIZATION "AVX optimization support" OFF)
option(USE_AVX2_OPTIMIZATION "AVX2 optimization support" OFF)

View File

@ -483,9 +483,52 @@ void downloadGridlistError( LLSD const &aData, std::string const &aURL )
LL_WARNS("SLGridStatusResponder") << "Error - output without </item>" << LL_ENDL;
}
}
// </FS:PP>
// <FS:Ansariel> Check for test build expiration
bool is_testbuild_expired()
{
#if TESTBUILD
std::string datestr = __DATE__;
std::istringstream iss_date(datestr);
std::string str_month;
S32 day;
S32 year;
S32 month = 1;
iss_date >> str_month >> day >> year;
if (str_month == "Jan") month = 1;
else if (str_month == "Feb") month = 2;
else if (str_month == "Mar") month = 3;
else if (str_month == "Apr") month = 4;
else if (str_month == "May") month = 5;
else if (str_month == "Jun") month = 6;
else if (str_month == "Jul") month = 7;
else if (str_month == "Aug") month = 8;
else if (str_month == "Sep") month = 9;
else if (str_month == "Oct") month = 10;
else if (str_month == "Nov") month = 11;
else if (str_month == "Dec") month = 12;
tm t = {0};
t.tm_mon = month - 1;
t.tm_mday = day;
t.tm_year = year - 1900;
t.tm_hour = 0;
t.tm_min = 0;
t.tm_sec = 0;
time_t expiry_time = mktime(&t) + (S32(TESTBUILDPERIOD) + 1) * 24 * 60 * 60;
time_t current_time = time(NULL);
return current_time > expiry_time;
#else
return false;
#endif
}
// </FS:Ansariel>
void update_texture_fetch()
{
LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread
@ -1160,6 +1203,17 @@ bool idle_startup()
if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState())
{
// <FS:Ansariel> Check for test build expiration
if (is_testbuild_expired())
{
LL_INFOS() << "This test version has expired and cannot be used any further." << LL_ENDL;
LLNotificationsUtil::add("TestversionExpired", LLSD(), LLSD(), login_alert_done);
LLStartUp::setStartupState(STATE_LOGIN_CONFIRM_NOTIFICATON);
show_connect_box = true;
return FALSE;
}
// </FS:Ansariel>
// <FS:Ansariel> Login block
LLSD blocked = FSData::instance().allowedLogin();
if (blocked.isMap()) //hack for testing for an empty LLSD

View File

@ -4733,6 +4733,12 @@ Dieses wird die folgenden Informationen an die aktuelle IM-Sitzung senden:
name="okbutton"
yestext="OK"/>
</notification>
<notification name="TestversionExpired">
Diese Testversion von [APP_NAME] is abgelaufen und kann nicht weiter verwendet werden.
<usetemplate
name="okbutton"
yestext="OK"/>
</notification>
<notification name="FireStormReqInfo">
[NAME] hat die eine Anfrage geschickt, Informationen über Ihre [APP_NAME]-Konfiguration zu übermitteln.

View File

@ -10266,6 +10266,16 @@ This will send the following information to the current IM session:
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="TestversionExpired"
type="alertmodal">
This test version of [APP_NAME] has expired and cannot be used any further.
<usetemplate
name="okbutton"
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="FireStormReqInfo"

View File

@ -37,6 +37,7 @@ WANTS_FMODEX=$FALSE
WANTS_OPENSIM=$TRUE
WANTS_AVX=$FALSE
WANTS_AVX2=$FALSE
WANTS_TESTBUILD=$FALSE
WANTS_BUILD=$FALSE
PLATFORM="darwin" # darwin, win32, win64, linux32, linux64
BTYPE="Release"
@ -44,6 +45,7 @@ CHANNEL="" # will be overwritten later with platform-specific values unless manu
LL_ARGS_PASSTHRU=""
JOBS="0"
WANTS_NINJA=$FALSE
TESTBUILD_PERIOD="0"
###
### Helper Functions
@ -70,6 +72,7 @@ showUsage()
echo " --no-opensim : Build without OpenSim support (Overrides --opensim)"
echo " --avx : Build with Advanced Vector Extensions"
echo " --avx2 : Build with Advanced Vector Extensions 2"
echo " --testbuild <period> : Create time-limited test build"
echo " --platform : darwin | win32 | win64 | linux32 | linux64"
echo " --jobs <num> : Build with <num> jobs in parallel (Linux and Darwin only)"
echo
@ -81,7 +84,7 @@ getArgs()
# $* = the options passed in from main
{
if [ $# -gt 0 ]; then
while getoptex "clean build config version package no-package fmodex ninja jobs: platform: kdu quicktime opensim no-opensim avx avx2 help chan: btype:" "$@" ; do
while getoptex "clean build config version package no-package fmodex ninja jobs: platform: kdu quicktime opensim no-opensim avx avx2 testbuild: help chan: btype:" "$@" ; do
#insure options are valid
if [ -z "$OPTOPT" ] ; then
@ -104,6 +107,8 @@ getArgs()
no-opensim) WANTS_OPENSIM=$FALSE;;
avx) WANTS_AVX=$TRUE;;
avx2) WANTS_AVX2=$TRUE;;
testbuild) WANTS_TESTBUILD=$TRUE
TESTBUILD_PERIOD="$OPTARG";;
package) WANTS_PACKAGE=$TRUE;;
no-package) WANTS_PACKAGE=$FALSE;;
build) WANTS_BUILD=$TRUE;;
@ -278,8 +283,9 @@ echo -e " PLATFORM: '$PLATFORM'" | tee -a $LOG
echo -e " KDU: `b2a $WANTS_KDU`" | tee -a $LOG
echo -e " FMODEX: `b2a $WANTS_FMODEX`" | tee -a $LOG
echo -e " OPENSIM: `b2a $WANTS_OPENSIM`" | tee -a $LOG
echo -e " AVX: `b2a $WANTS_AVX` " | tee -a $LOG
echo -e " AVX2: `b2a $WANTS_AVX2` " | tee -a $LOG
echo -e " AVX: `b2a $WANTS_AVX`" | tee -a $LOG
echo -e " AVX2: `b2a $WANTS_AVX2`" | tee -a $LOG
echo -e " TESTBUILD: `b2a $WANTS_TESTBUILD`" | tee -a $LOG
echo -e " PACKAGE: `b2a $WANTS_PACKAGE`" | tee -a $LOG
echo -e " CLEAN: `b2a $WANTS_CLEAN`" | tee -a $LOG
echo -e " BUILD: `b2a $WANTS_BUILD`" | tee -a $LOG
@ -391,6 +397,11 @@ if [ $WANTS_CONFIG -eq $TRUE ] ; then
else
AVX2_OPTIMIZATION="-DUSE_AVX2_OPTIMIZATION:BOOL=OFF"
fi
if [ $WANTS_TESTBUILD -eq $TRUE ] ; then
TESTBUILD="-DTESTBUILD:BOOL=ON -DTESTBUILDPERIOD:STRING=$TESTBUILD_PERIOD"
else
TESTBUILD="-DTESTBUILD:BOOL=OFF"
fi
if [ $WANTS_PACKAGE -eq $TRUE ] ; then
PACKAGE="-DPACKAGE:BOOL=ON"
# Also delete easy-to-copy resource files, insuring that we properly refresh resoures from the source tree
@ -446,7 +457,7 @@ if [ $WANTS_CONFIG -eq $TRUE ] ; then
UNATTENDED="-DUNATTENDED=ON"
fi
cmake -G "$TARGET" ../indra $CHANNEL $FMODEX $KDU $OPENSIM $AVX_OPTIMIZATION $AVX2_OPTIMIZATION $PACKAGE $UNATTENDED -DLL_TESTS:BOOL=OFF -DWORD_SIZE:STRING=$WORD_SIZE -DCMAKE_BUILD_TYPE:STRING=$BTYPE \
cmake -G "$TARGET" ../indra $CHANNEL $FMODEX $KDU $OPENSIM $AVX_OPTIMIZATION $AVX2_OPTIMIZATION $TESTBUILD $PACKAGE $UNATTENDED -DLL_TESTS:BOOL=OFF -DWORD_SIZE:STRING=$WORD_SIZE -DCMAKE_BUILD_TYPE:STRING=$BTYPE \
-DNDTARGET_ARCH:STRING="${TARGET_ARCH}" -DROOT_PROJECT_NAME:STRING=Firestorm $LL_ARGS_PASSTHRU | tee $LOG
if [ $PLATFORM == "win32" ] ; then