Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/secondlife/viewer
Browse files Browse the repository at this point in the history
# Conflicts:
#	indra/llimage/llimagebmp.cpp
#	indra/llimage/llimagetga.cpp
#	indra/llrender/llrender.cpp
#	indra/llui/lltransutil.cpp
#	indra/newview/llappviewer.cpp
#	indra/newview/llviewerwindow.cpp
  • Loading branch information
Ansariel committed Mar 26, 2024
2 parents c111665 + 9567393 commit 1f75fbd
Show file tree
Hide file tree
Showing 29 changed files with 242 additions and 60 deletions.
82 changes: 59 additions & 23 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
outputs:
viewer_channel: ${{ steps.build.outputs.viewer_channel }}
viewer_version: ${{ steps.build.outputs.viewer_version }}
viewer_branch: ${{ steps.which-branch.outputs.branch }}
relnotes: ${{ steps.which-branch.outputs.relnotes }}
imagename: ${{ steps.build.outputs.imagename }}
env:
AUTOBUILD_ADDRSIZE: 64
Expand All @@ -40,8 +42,6 @@ jobs:
DEVELOPER_DIR: ${{ matrix.developer_dir }}
# Ensure that Linden viewer builds engage Bugsplat.
BUGSPLAT_DB: ${{ matrix.configuration != 'ReleaseOS' && 'SecondLife_Viewer_2018' || '' }}
BUGSPLAT_PASS: ${{ secrets.BUGSPLAT_PASS }}
BUGSPLAT_USER: ${{ secrets.BUGSPLAT_USER }}
build_coverity: false
build_log_dir: ${{ github.workspace }}/.logs
build_viewer: true
Expand All @@ -65,7 +65,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -86,7 +86,7 @@ jobs:
run: pip3 install autobuild llsd

- name: Cache autobuild packages
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-installables
with:
path: .autobuild-installables
Expand Down Expand Up @@ -260,31 +260,44 @@ jobs:
${{ steps.build.outputs.physicstpv }}
sign-and-package-windows:
env:
AZURE_KEY_VAULT_URI: ${{ secrets.AZURE_KEY_VAULT_URI }}
AZURE_CERT_NAME: ${{ secrets.AZURE_CERT_NAME }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
needs: build
runs-on: windows
steps:
- name: Sign and package Windows viewer
if: env.AZURE_KEY_VAULT_URI && env.AZURE_CERT_NAME && env.AZURE_CLIENT_ID && env.AZURE_CLIENT_SECRET && env.AZURE_TENANT_ID
uses: secondlife/viewer-build-util/sign-pkg-windows@v1
with:
vault_uri: "${{ secrets.AZURE_KEY_VAULT_URI }}"
cert_name: "${{ secrets.AZURE_CERT_NAME }}"
client_id: "${{ secrets.AZURE_CLIENT_ID }}"
client_secret: "${{ secrets.AZURE_CLIENT_SECRET }}"
tenant_id: "${{ secrets.AZURE_TENANT_ID }}"
vault_uri: "${{ env.AZURE_KEY_VAULT_URI }}"
cert_name: "${{ env.AZURE_CERT_NAME }}"
client_id: "${{ env.AZURE_CLIENT_ID }}"
client_secret: "${{ env.AZURE_CLIENT_SECRET }}"
tenant_id: "${{ env.AZURE_TENANT_ID }}"

sign-and-package-mac:
env:
NOTARIZE_CREDS_MACOS: ${{ secrets.NOTARIZE_CREDS_MACOS }}
SIGNING_CERT_MACOS: ${{ secrets.SIGNING_CERT_MACOS }}
SIGNING_CERT_MACOS_IDENTITY: ${{ secrets.SIGNING_CERT_MACOS_IDENTITY }}
SIGNING_CERT_MACOS_PASSWORD: ${{ secrets.SIGNING_CERT_MACOS_PASSWORD }}
needs: build
runs-on: macos-latest
steps:
- name: Unpack Mac notarization credentials
if: env.NOTARIZE_CREDS_MACOS
id: note-creds
shell: bash
run: |
# In NOTARIZE_CREDS_MACOS we expect to find:
# USERNAME="..."
# PASSWORD="..."
# TEAM_ID="..."
eval "${{ secrets.NOTARIZE_CREDS_MACOS }}"
eval "${{ env.NOTARIZE_CREDS_MACOS }}"
echo "::add-mask::$USERNAME"
echo "::add-mask::$PASSWORD"
echo "::add-mask::$TEAM_ID"
Expand All @@ -296,45 +309,54 @@ jobs:
[[ -n "$USERNAME" && -n "$PASSWORD" && -n "$TEAM_ID" ]]
- name: Sign and package Mac viewer
if: env.SIGNING_CERT_MACOS && env.SIGNING_CERT_MACOS_IDENTITY && env.SIGNING_CERT_MACOS_PASSWORD && steps.note-creds.outputs.note_user && steps.note-creds.outputs.note_pass && steps.note-creds.outputs.note_team
uses: secondlife/viewer-build-util/sign-pkg-mac@v1
with:
channel: ${{ needs.build.outputs.viewer_channel }}
imagename: ${{ needs.build.outputs.imagename }}
cert_base64: ${{ secrets.SIGNING_CERT_MACOS }}
cert_name: ${{ secrets.SIGNING_CERT_MACOS_IDENTITY }}
cert_pass: ${{ secrets.SIGNING_CERT_MACOS_PASSWORD }}
cert_base64: ${{ env.SIGNING_CERT_MACOS }}
cert_name: ${{ env.SIGNING_CERT_MACOS_IDENTITY }}
cert_pass: ${{ env.SIGNING_CERT_MACOS_PASSWORD }}
note_user: ${{ steps.note-creds.outputs.note_user }}
note_pass: ${{ steps.note-creds.outputs.note_pass }}
note_team: ${{ steps.note-creds.outputs.note_team }}

post-windows-symbols:
env:
BUGSPLAT_USER: ${{ secrets.BUGSPLAT_USER }}
BUGSPLAT_PASS: ${{ secrets.BUGSPLAT_PASS }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Post Windows symbols
if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS
uses: secondlife/viewer-build-util/post-bugsplat-windows@v1
with:
username: ${{ secrets.BUGSPLAT_USER }}
password: ${{ secrets.BUGSPLAT_PASS }}
username: ${{ env.BUGSPLAT_USER }}
password: ${{ env.BUGSPLAT_PASS }}
database: "SecondLife_Viewer_2018"
channel: ${{ needs.build.outputs.viewer_channel }}
version: ${{ needs.build.outputs.viewer_version }}

post-mac-symbols:
env:
BUGSPLAT_USER: ${{ secrets.BUGSPLAT_USER }}
BUGSPLAT_PASS: ${{ secrets.BUGSPLAT_PASS }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Post Mac symbols
if: env.BUGSPLAT_USER && env.BUGSPLAT_PASS
uses: secondlife/viewer-build-util/post-bugsplat-mac@v1
with:
username: ${{ secrets.BUGSPLAT_USER }}
password: ${{ secrets.BUGSPLAT_PASS }}
username: ${{ env.BUGSPLAT_USER }}
password: ${{ env.BUGSPLAT_PASS }}
database: "SecondLife_Viewer_2018"
channel: ${{ needs.build.outputs.viewer_channel }}
version: ${{ needs.build.outputs.viewer_version }}

release:
needs: [sign-and-package-windows, sign-and-package-mac]
needs: [build, sign-and-package-windows, sign-and-package-mac]
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'Second_Life_')
steps:
Expand Down Expand Up @@ -365,17 +387,31 @@ jobs:
mv newview/viewer_version.txt macOS-viewer_version.txt
# forked from softprops/action-gh-release
- uses: secondlife-3p/action-gh-release@v1
- name: Create GitHub release
id: release
uses: secondlife-3p/action-gh-release@v1
with:
# name the release page for the build number so we can find it
# easily (analogous to looking up a codeticket build page)
name: "v${{ github.run_id }}"
# name the release page for the branch
name: "${{ needs.build.outputs.viewer_branch }}"
# SL-20546: want the channel and version to be visible on the
# release page
body: |
Build ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
${{ needs.build.outputs.viewer_channel }}
${{ needs.build.outputs.viewer_version }}
${{ needs.build.outputs.relnotes }}
prerelease: true
generate_release_notes: true
# the only reason we generate a GH release is to post build products
target_commitish: ${{ github.sha }}
previous_tag: release
append_body: true
fail_on_unmatched_files: true
files: |
*.dmg
*.exe
*-autobuild-package.xml
*-viewer_version.txt
- name: post release URL
run: |
echo "::notice::Release ${{ steps.release.outputs.url }}"
3 changes: 2 additions & 1 deletion .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
with:
stale-pr-message: This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or it will be closed in 7 days
days-before-stale: 30
days-before-close: 7
days-before-close: 7
days-before-issue-close: -1
exempt-pr-labels: blocked,must,should,keep
stale-pr-label: stale
- name: Print outputs
Expand Down
22 changes: 0 additions & 22 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,28 +175,6 @@ pre_build()
VIEWER_SYMBOL_FILE="$(native_path "$abs_build_dir/newview/$variant/secondlife-symbols-$symplat-${AUTOBUILD_ADDRSIZE}.tar.bz2")"
fi

# expect these variables to be set in the environment from GitHub secrets
if [[ -n "$BUGSPLAT_DB" ]]
then
# don't spew credentials into build log
set +x
if [[ -z "$BUGSPLAT_USER" || -z "$BUGSPLAT_PASS" ]]
then
# older mechanism involving build-secrets repo -
# if build_secrets_checkout isn't set, report its name
bugsplat_sh="${build_secrets_checkout:-\$build_secrets_checkout}/bugsplat/bugsplat.sh"
if [ -r "$bugsplat_sh" ]
then # show that we're doing this, just not the contents
echo source "$bugsplat_sh"
source "$bugsplat_sh"
else
fatal "BUGSPLAT_USER or BUGSPLAT_PASS missing, and no $bugsplat_sh"
fi
fi
set -x
export BUGSPLAT_USER BUGSPLAT_PASS
fi

# honor autobuild_configure_parameters same as sling-buildscripts
eval_autobuild_configure_parameters=$(eval $(echo echo $autobuild_configure_parameters))

Expand Down
1 change: 1 addition & 0 deletions indra/llcommon/llcoros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl
catch (std::bad_alloc&)
{
// Out of memory on stack allocation?
LLError::LLUserWarningMsg::showOutOfMemory();
printActiveCoroutines();
LL_ERRS("LLCoros") << "Bad memory allocation in LLCoros::launch(" << prefix << ")!" << LL_ENDL;
}
Expand Down
42 changes: 42 additions & 0 deletions indra/llcommon/llerror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,48 @@ namespace LLError
{
return out << boost::stacktrace::stacktrace();
}

// LLOutOfMemoryWarning
std::string LLUserWarningMsg::sLocalizedOutOfMemoryTitle;
std::string LLUserWarningMsg::sLocalizedOutOfMemoryWarning;
LLUserWarningMsg::Handler LLUserWarningMsg::sHandler;

void LLUserWarningMsg::show(const std::string& message)
{
if (sHandler)
{
sHandler(std::string(), message);
}
}

void LLUserWarningMsg::showOutOfMemory()
{
if (sHandler && !sLocalizedOutOfMemoryTitle.empty())
{
sHandler(sLocalizedOutOfMemoryTitle, sLocalizedOutOfMemoryWarning);
}
}

void LLUserWarningMsg::showMissingFiles()
{
// Files Are missing, likely can't localize.
const std::string error_string =
"Firestorm viewer couldn't access some of the files it needs and will be closed."
"\n\nPlease reinstall viewer from https://firestormviewer.org/download and "
"contact https://www.firestormviewer.org/support if issue persists after reinstall.";
sHandler("Missing Files", error_string);
}

void LLUserWarningMsg::setHandler(const LLUserWarningMsg::Handler &handler)
{
sHandler = handler;
}

void LLUserWarningMsg::setOutOfMemoryStrings(const std::string& title, const std::string& message)
{
sLocalizedOutOfMemoryTitle = title;
sLocalizedOutOfMemoryWarning = message;
}
}

void crashdriver(void (*callback)(int*))
Expand Down
23 changes: 23 additions & 0 deletions indra/llcommon/llerror.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "llpreprocessor.h"

#include <boost/static_assert.hpp>
#include <functional> // std::function

// <FS:Ansariel> Disable C6011 code analyses warning for now popping up everywhere because of the LL_ENDL / LLERROR_CRASH macro
#if LL_WINDOWS
Expand Down Expand Up @@ -313,6 +314,28 @@ namespace LLError
{
friend std::ostream& operator<<(std::ostream& out, const LLStacktrace&);
};

// Provides access to OS notification popup on error, since
// not everything has access to OS's messages
class LLUserWarningMsg
{
public:
typedef std::function<void(const std::string&, const std::string&)> Handler;
static void setHandler(const Handler&);
static void setOutOfMemoryStrings(const std::string& title, const std::string& message);

// When viewer encounters bad alloc or can't access files try warning user about reasons
static void showOutOfMemory();
static void showMissingFiles();
// Genering error
static void show(const std::string&);

private:
// needs to be preallocated before viewer runs out of memory
static std::string sLocalizedOutOfMemoryTitle;
static std::string sLocalizedOutOfMemoryWarning;
static Handler sHandler;
};
}

//this is cheaper than llcallstacks if no need to output other variables to call stacks.
Expand Down
1 change: 1 addition & 0 deletions indra/llcommon/llexception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "llerror.h"
#include "llerrorcontrol.h"


// used to attach and extract stacktrace information to/from boost::exception,
// see https://www.boost.org/doc/libs/release/doc/html/stacktrace/getting_started.html#stacktrace.getting_started.exceptions_with_stacktrace
// apparently the struct passed as the first template param needs no definition?
Expand Down
1 change: 1 addition & 0 deletions indra/llcorehttp/_httpservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ void HttpService::threadRun(LLCoreInt::HttpThread * thread)
LLMemory::logMemoryInfo(TRUE);

//output possible call stacks to log file.
LLError::LLUserWarningMsg::showOutOfMemory();
LLError::LLCallStacks::print();

LL_ERRS() << "Bad memory allocation in HttpService::threadRun()!" << LL_ENDL;
Expand Down
1 change: 1 addition & 0 deletions indra/llimage/llimagebmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ bool LLImageBMP::updateData()
mColorPalette = new(std::nothrow) U8[color_palette_size];
if (!mColorPalette)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_WARNS() << "Out of memory in LLImageBMP::updateData(), size: " << color_palette_size << LL_ENDL;
return false;
}
Expand Down
1 change: 1 addition & 0 deletions indra/llimage/llimagedxt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ bool LLImageDXT::convertToDXR()
U8* newdata = (U8*)ll_aligned_malloc_16(total_bytes);
if (!newdata)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Out of memory in LLImageDXT::convertToDXR()" << LL_ENDL;
return false;
}
Expand Down
1 change: 1 addition & 0 deletions indra/llimage/llimagetga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ bool LLImageTGA::updateData()
mColorMap = new(std::nothrow) U8[ color_map_bytes ];
if (!mColorMap)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_WARNS() << "Out of Memory in bool LLImageTGA::updateData(), size: " << color_map_bytes << LL_ENDL;
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions indra/llrender/llimagegl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
scratch = new(std::nothrow) U32[width * height];
if (!scratch)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
}
Expand All @@ -1378,6 +1379,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
scratch = new(std::nothrow) U32[width * height];
if (!scratch)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
}
Expand Down Expand Up @@ -1406,6 +1408,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
scratch = new(std::nothrow) U32[width * height];
if (!scratch)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32))
<< " bytes for a manual image W" << width << " H" << height << LL_ENDL;
}
Expand Down
Loading

0 comments on commit 1f75fbd

Please sign in to comment.