diff options
-rwxr-xr-x | build.sh | 20 | ||||
-rw-r--r-- | indra/cmake/bugsplat.cmake | 16 | ||||
-rw-r--r-- | indra/newview/CMakeLists.txt | 4 | ||||
-rw-r--r-- | indra/newview/llappdelegate-objc.mm | 19 | ||||
-rw-r--r-- | indra/newview/llappviewerwin32.cpp | 87 | ||||
-rwxr-xr-x | indra/newview/viewer_manifest.py | 12 |
6 files changed, 114 insertions, 44 deletions
@@ -95,17 +95,23 @@ pre_build() && [ -r "$master_message_template_checkout/message_template.msg" ] \ && template_verifier_master_url="-DTEMPLATE_VERIFIER_MASTER_URL=file://$master_message_template_checkout/message_template.msg" - # nat 2016-12-20: disable HAVOK on Mac until we get a 64-bit Mac build. RELEASE_CRASH_REPORTING=ON HAVOK=ON SIGNING=() - if [ "$arch" == "Darwin" ] - then - if [ "$variant" == "Release" ] - then SIGNING=("-DENABLE_SIGNING:BOOL=YES" \ - "-DSIGNING_IDENTITY:STRING=Developer ID Application: Linden Research, Inc.") - fi + if [ "$arch" == "Darwin" -a "$variant" == "Release" ] + then SIGNING=("-DENABLE_SIGNING:BOOL=YES" \ + "-DSIGNING_IDENTITY:STRING=Developer ID Application: Linden Research, Inc.") + fi + + # don't spew credentials into build log + bugsplat_sh="$build_secrets_checkout/bugsplat/bugsplat.sh" + set +x + if [ -r "$bugsplat_sh" ] + then # show that we're doing this, just not the contents + echo source "$bugsplat_sh" + source "$bugsplat_sh" fi + set -x "$autobuild" configure --quiet -c $variant -- \ -DPACKAGE:BOOL=ON \ diff --git a/indra/cmake/bugsplat.cmake b/indra/cmake/bugsplat.cmake index a7f4194905..4db9068b49 100644 --- a/indra/cmake/bugsplat.cmake +++ b/indra/cmake/bugsplat.cmake @@ -1,13 +1,7 @@ -# BUGSPLAT can be set when launching the make using the argument -DBUGSPLAT:BOOL=ON -# When building using proprietary binaries though (i.e. having access to LL private servers), -# we always build with BUGSPLAT. -# Open source devs should use the -DBUGSPLAT:BOOL=ON then if they want to -# build with BugSplat, whether they are using USESYSTEMLIBS or not. -if (INSTALL_PROPRIETARY) - set(BUGSPLAT ON CACHE BOOL "Using BugSplat crash reporting library.") -endif (INSTALL_PROPRIETARY) - -if (BUGSPLAT) +# BugSplat is engaged by setting environment variable BUGSPLAT_DB to the +# target BugSplat database name prior to running CMake (and during autobuild +# build). +if (DEFINED ENV{BUGSPLAT_DB}) if (USESYSTEMLIBS) set(BUGSPLAT_FIND_QUIETLY ON) set(BUGSPLAT_FIND_REQUIRED ON) @@ -27,4 +21,4 @@ if (BUGSPLAT) endif (WINDOWS) set(BUGSPLAT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/bugsplat) endif (USESYSTEMLIBS) -endif (BUGSPLAT) +endif (DEFINED ENV{BUGSPLAT_DB}) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c67f365767..cf275ef4b5 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1715,10 +1715,10 @@ if (SDL_FOUND) ) endif (SDL_FOUND) -if (BUGSPLAT) +if (DEFINED ENV{BUGSPLAT_DB}) set_property(TARGET ${VIEWER_BINARY_NAME} PROPERTY COMPILE_DEFINITIONS "LL_BUGSPLAT") -endif (BUGSPLAT) +endif (DEFINED ENV{BUGSPLAT_DB}) # add package files file(GLOB EVENT_HOST_SCRIPT_GLOB_LIST diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm index e8b4272e51..8e1ad169c9 100644 --- a/indra/newview/llappdelegate-objc.mm +++ b/indra/newview/llappdelegate-objc.mm @@ -70,6 +70,8 @@ #if defined(LL_BUGSPLAT) // https://www.bugsplat.com/docs/platforms/os-x#initialization +// [BugsplatStartupManager sharedManager].autoSubmitCrashReport = YES; +// [BugsplatStartupManager sharedManager].askUserDetails = NO; [[BugsplatStartupManager sharedManager] start]; #endif } @@ -187,4 +189,21 @@ return true; } +#if 0 // defined(LL_BUGSPLAT) + +@implementation BugsplatStartupManagerDelegate + +- (BugsplatAttachment *)attachmentForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager { + NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"example" withExtension:@"json"]; + NSData *data = [NSData dataWithContentsOfURL:fileURL]; + + BugsplatAttachment *attachment = + [[BugsplatAttachment alloc] initWithFilename:@"example.json" + attachmentData:data + contentType:@"application/json"]; + return attachment; +} + +#endif // LL_BUGSPLAT + @end diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 5f3bf14bc2..f9df2b88ed 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -68,29 +68,30 @@ #include "stringize.h" #include "lldir.h" +#include <fstream> #include <exception> // Bugsplat (http://bugsplat.com) crash reporting tool #ifdef LL_BUGSPLAT #include "BugSplat.h" +#include "reader.h" // JsonCpp namespace { - // FIXME: need a production BugSplat database name - static const wchar_t *bugdb_name = L"second_life_callum_test"; - // MiniDmpSender's constructor is defined to accept __wchar_t* instead of - // plain wchar_t*. + // plain wchar_t*. It would be nice if, when wchar_t is the same as + // __wchar_t, this whole function would optimize away. However, we use it + // only for the arguments to make exactly one call to initialize BugSplat. inline std::basic_string<__wchar_t> wunder(const std::wstring& str) { return { str.begin(), str.end() }; } // Irritatingly, MiniDmpSender::setCallback() is defined to accept a - // classic-C function pointer instead of an arbitrary C++ callable. In the - // latter case, we could pass a lambda that binds our MiniDmpSender - // pointer. As things stand, we must define an actual function and store - // the pointer statically. + // classic-C function pointer instead of an arbitrary C++ callable. If it + // did accept a modern callable, we could pass a lambda that binds our + // MiniDmpSender pointer. As things stand, though, we must define an + // actual function and store the pointer statically. static MiniDmpSender *sBugSplatSender = nullptr; bool bugsplatSendLog(UINT nCode, LPVOID lpVal1, LPVOID lpVal2) @@ -549,22 +550,60 @@ bool LLAppViewerWin32::init() #else // LL_BUGSPLAT - std::wstring version_string(WSTRINGIZE(LL_VIEWER_VERSION_MAJOR << '.' << - LL_VIEWER_VERSION_MINOR << '.' << - LL_VIEWER_VERSION_PATCH << '.' << - LL_VIEWER_VERSION_BUILD)); - - // have to convert normal wide strings to strings of __wchar_t - sBugSplatSender = new MiniDmpSender( - wunder(bugdb_name).c_str(), - wunder(LL_TO_WSTRING(LL_VIEWER_CHANNEL)).c_str(), - wunder(version_string).c_str(), - nullptr); - sBugSplatSender->setCallback(bugsplatSendLog); - - // engage stringize() overload that converts from wstring - LL_INFOS() << "Engaged BugSplat(" << LL_TO_STRING(LL_VIEWER_CHANNEL) - << stringize(version_string) << ')' << LL_ENDL; + if (gDirUtilp) + { + LL_WARNS() << "Can't initialize BugSplat, gDirUtilp not yet set" << LL_ENDL; + } + else + { + std::string build_data_fname( + gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "build_data.json")); + std::ifstream inf(build_data_fname.c_str()); + if (! inf.open()) + { + LL_WARNS() << "Can't initialize BugSplat, can't read '" << build_data_fname + << "'" << LL_ENDL; + } + else + { + Json::Reader reader; + Json::Value build_data; + if (! reader.parse(inf, build_data, false)) // don't collect comments + { + LL_WARNS() << "Can't initialize BugSplat, can't parse '" << build_data_fname + << "': " << reader.getFormattedErrorMessages() << LL_ENDL; + } + else + { + Json::Value BugSplat_DB = build_data["BugSplat DB"]; + if (! BugSplat_DB) + { + LL_WARNS() << "Can't initialize BugSplat, no 'BugSplat DB' entry in '" + << build_data_fname "'" << LL_ENDL; + } + else + { + // Got BugSplat_DB, onward! + std::wstring version_string(WSTRINGIZE(LL_VIEWER_VERSION_MAJOR << '.' << + LL_VIEWER_VERSION_MINOR << '.' << + LL_VIEWER_VERSION_PATCH << '.' << + LL_VIEWER_VERSION_BUILD)); + + // have to convert normal wide strings to strings of __wchar_t + sBugSplatSender = new MiniDmpSender( + wunder(BugSplat_DB).c_str(), + wunder(LL_TO_WSTRING(LL_VIEWER_CHANNEL)).c_str(), + wunder(version_string).c_str(), + nullptr); + sBugSplatSender->setCallback(bugsplatSendLog); + + // engage stringize() overload that converts from wstring + LL_INFOS() << "Engaged BugSplat(" << LL_TO_STRING(LL_VIEWER_CHANNEL) + << stringize(version_string) << ')' << LL_ENDL; + } // got BugSplat_DB + } // parsed build_data.json + } // opened build_data.json + } // gDirUtilp set #endif // LL_BUGSPLAT #endif // LL_SEND_CRASH_REPORTS diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 1fa948f89e..68ad1db14d 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -186,6 +186,11 @@ class ViewerManifest(LLManifest): "Address Size":self.address_size, "Update Service":"https://update.secondlife.com/update", } + try: + build_data_dict["BugSplat DB"] = os.environ["BUGSPLAT_DB"] + except KeyError: + # skip the assignment if there's no BUGSPLAT_DB variable + pass build_data_dict = self.finish_build_data_dict(build_data_dict) with open(os.path.join(os.pardir,'build_data.json'), 'w') as build_data_handle: json.dump(build_data_dict,build_data_handle) @@ -1001,6 +1006,13 @@ open "%s" --args "$@" # runs the executable, instead of launching the app) Info["CFBundleExecutable"] = "Second Life" Info["CFBundleIconFile"] = viewer_icon + try: + # https://www.bugsplat.com/docs/platforms/os-x#configuration + Info["BugsplatServerURL"] = \ + "https://{BUGSPLAT_DB}.bugsplatsoftware.com/".format(**os.environ) + except KeyError: + # skip the assignment if there's no BUGSPLAT_DB variable + pass self.put_in_file( plistlib.writePlistToString(Info), os.path.basename(Info_plist), |