Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work-in-progress extension #3

Merged
merged 75 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
7e6e048
Minimal Godot C++ extension code using SCons build tool
limbonaut Sep 20, 2024
9a2fc4f
Add sentry submodule & include header in the build process
limbonaut Sep 27, 2024
d21f179
Add libsentry.so and libsentry.dll as a dependency for extension
limbonaut Sep 27, 2024
48c308a
Update .gitignore
limbonaut Sep 27, 2024
bd10e3a
Add Settings class
limbonaut Sep 27, 2024
9b0f451
Add Sentry singleton interface, capture message events
limbonaut Sep 27, 2024
83d41c5
Simple demo scene: capture message events
limbonaut Sep 27, 2024
6a6bf17
Expose sentry level enum for events and breadcrumbs
limbonaut Sep 27, 2024
04c9db9
Use sentry levels in the demo project
limbonaut Sep 27, 2024
ba88ded
Godot demo project config
limbonaut Sep 27, 2024
380abaa
Add `Sentry.add_breadcrumb(...)`
limbonaut Sep 27, 2024
0e6af69
Update demo: add breadcrumbs
limbonaut Sep 27, 2024
a01741f
Include user `data` dictionary in add_breadcrumb
limbonaut Sep 27, 2024
423c9f7
Keep sentry cache in user data dir
limbonaut Sep 30, 2024
3c833c8
Initialize crashpad on Linux and Windows
limbonaut Sep 30, 2024
72b016f
Add crashpad handler as a dependency for exported projects
limbonaut Sep 30, 2024
64227f1
Fix manifest syntax error
limbonaut Sep 30, 2024
5358cf9
Rename: `capture_message_event()` => `capture_message()`
limbonaut Sep 30, 2024
61fe00e
Define sentry-specific project settings, add `debug_printing` setting
limbonaut Sep 30, 2024
f926752
Clean up settings class
limbonaut Sep 30, 2024
14197e8
Define sentry settings using PropertyInfo
limbonaut Sep 30, 2024
4c70b00
Setting for sample rate
limbonaut Sep 30, 2024
5eccba1
Refactor code and project structure
limbonaut Sep 30, 2024
4fc1bca
Enable/disable plugin via project settings
limbonaut Sep 30, 2024
bb663aa
Customize release string via project settings
limbonaut Sep 30, 2024
7ea1f26
Add and remove tags + project example
limbonaut Sep 30, 2024
7b4369c
Update gitignore
limbonaut Sep 30, 2024
5be6e83
Set SDK name
limbonaut Sep 30, 2024
30e420e
Add get_last_event_id()
limbonaut Sep 30, 2024
aa748a1
New `attach_log` setting, fix setting defaults
limbonaut Sep 30, 2024
cfbce15
Fix incorrect `release` info
limbonaut Sep 30, 2024
258684b
Make project settings basic by default and preserve their order
limbonaut Sep 30, 2024
bb4ccd1
More useful environments (automatic)
limbonaut Sep 30, 2024
0b0cbc5
Improve marshalling between godot and sentry-native types
limbonaut Oct 1, 2024
5741c09
Invariants
limbonaut Oct 1, 2024
16124c5
Add `max_breadcrumbs` option
limbonaut Oct 1, 2024
ce47af4
Provide GPU context
limbonaut Oct 1, 2024
1008d9c
Link sentry-native libs statically
limbonaut Oct 1, 2024
610ec7d
Provide context containing info about displays
limbonaut Oct 1, 2024
b175ab9
Provide engine context
limbonaut Oct 2, 2024
dda74c9
Provide environment context
limbonaut Oct 2, 2024
f532e9e
Device context function
limbonaut Oct 2, 2024
1db81ef
API for user contexts, and demo update to showcase it
limbonaut Oct 2, 2024
7f3eb6f
Tweak demo window size and stretch mode
limbonaut Oct 2, 2024
e772cea
Take the log file location from the project settings and handle its a…
limbonaut Oct 2, 2024
e570712
Update REAMDE with build steps
limbonaut Oct 2, 2024
c4d375e
Tweak README
limbonaut Oct 2, 2024
70f1663
Update README: add prerequisites and demo project instructions
limbonaut Oct 2, 2024
ec3b439
README: adjusting SDK settings
limbonaut Oct 2, 2024
40cf43b
Add "headless" environment
limbonaut Oct 2, 2024
26ebd04
Refactor
limbonaut Oct 2, 2024
6166482
Fix invariants and crash related to "headless" detection, corrections
limbonaut Oct 2, 2024
9a057bd
Implement `before_send` callback with basic performance metrics
limbonaut Oct 2, 2024
b1a7fde
Improve demo project
limbonaut Oct 3, 2024
d6f7a3c
Better device context
limbonaut Oct 3, 2024
449aaab
Enrich performance context
limbonaut Oct 3, 2024
3ae6409
Add on_crash hook and fix performance context not added properly on c…
limbonaut Oct 3, 2024
31143a4
Compile libsentry and crashpad handler on SCons build
limbonaut Oct 3, 2024
6edfd92
Fix Device context memory values
limbonaut Oct 4, 2024
1055b08
Refine Device context and more
limbonaut Oct 4, 2024
dfabb74
Add app context
limbonaut Oct 4, 2024
8dd9fc2
Add Culture context
limbonaut Oct 4, 2024
281297a
Refine custom contexts
limbonaut Oct 4, 2024
f97ac76
Fix build issue with msvc
limbonaut Oct 10, 2024
46875c9
Build process for Windows and MSVC
limbonaut Oct 10, 2024
18c3607
Improve build process
limbonaut Oct 11, 2024
0616c8a
Update README
limbonaut Oct 11, 2024
08db81d
Refactor build script and fix Linux dependency
limbonaut Oct 11, 2024
a161c37
Clean up
limbonaut Oct 11, 2024
321018a
Rename SentrySettings => SentryOptions
limbonaut Oct 15, 2024
24cc1ad
API renames and clarify the commented out line in SConstruct
limbonaut Oct 15, 2024
e7354d1
Fix `SentryUtil::sentry_event_set_context`
limbonaut Oct 16, 2024
b7f671f
Same `add_breadcrumb` argument defaults as exposed
limbonaut Oct 16, 2024
c6ac925
chore: config update
limbonaut Oct 16, 2024
5c0de96
Update README.md
bruno-garcia Oct 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 189 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# Commented out parameters are those with the same value as base LLVM style.
# We can uncomment them if we want to change their value, or enforce the
# chosen value in case the base style changes (last sync: Clang 13.0).
---
### General config, applies to all languages ###
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
# AlignArrayOfStructures: None
# AlignConsecutiveMacros: None
# AlignConsecutiveAssignments: None
# AlignConsecutiveBitFields: None
# AlignConsecutiveDeclarations: None
# AlignEscapedNewlines: Right
AlignOperands: DontAlign
AlignTrailingComments: false
# AllowAllArgumentsOnNextLine: true
# AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
# AllowShortEnumsOnASingleLine: true
# AllowShortBlocksOnASingleLine: Never
# AllowShortCaseLabelsOnASingleLine: false
# AllowShortFunctionsOnASingleLine: All
# AllowShortLambdasOnASingleLine: All
# AllowShortIfStatementsOnASingleLine: Never
# AllowShortLoopsOnASingleLine: false
# AlwaysBreakAfterDefinitionReturnType: None
# AlwaysBreakAfterReturnType: None
# AlwaysBreakBeforeMultilineStrings: false
# AlwaysBreakTemplateDeclarations: MultiLine
# AttributeMacros:
# - __capability
# BinPackArguments: true
# BinPackParameters: true
# BraceWrapping:
# AfterCaseLabel: false
# AfterClass: false
# AfterControlStatement: Never
# AfterEnum: false
# AfterFunction: false
# AfterNamespace: false
# AfterObjCDeclaration: false
# AfterStruct: false
# AfterUnion: false
# AfterExternBlock: false
# BeforeCatch: false
# BeforeElse: false
# BeforeLambdaBody: false
# BeforeWhile: false
# IndentBraces: false
# SplitEmptyFunction: true
# SplitEmptyRecord: true
# SplitEmptyNamespace: true
# BreakBeforeBinaryOperators: None
# BreakBeforeConceptDeclarations: true
# BreakBeforeBraces: Attach
# BreakBeforeInheritanceComma: false
# BreakInheritanceList: BeforeColon
# BreakBeforeTernaryOperators: true
# BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon
# BreakStringLiterals: true
ColumnLimit: 0
# CommentPragmas: '^ IWYU pragma:'
# CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
# DeriveLineEnding: true
# DerivePointerAlignment: false
# DisableFormat: false
# EmptyLineAfterAccessModifier: Never
# EmptyLineBeforeAccessModifier: LogicalBlock
# ExperimentalAutoDetectBinPacking: false
# FixNamespaceComments: true
# ForEachMacros:
# - foreach
# - Q_FOREACH
# - BOOST_FOREACH
# IfMacros:
# - KJ_IF_MAYBE
# IncludeBlocks: Preserve
IncludeCategories:
- Regex: '".*"'
Priority: 1
- Regex: '^<.*\.h>'
Priority: 2
- Regex: '^<.*'
Priority: 3
# IncludeIsMainRegex: '(Test)?$'
# IncludeIsMainSourceRegex: ''
# IndentAccessModifiers: false
IndentCaseLabels: true
# IndentCaseBlocks: false
# IndentGotoLabels: true
# IndentPPDirectives: None
# IndentExternBlock: AfterExternBlock
# IndentRequires: false
IndentWidth: 4
# IndentWrappedFunctionNames: false
# InsertTrailingCommas: None
# JavaScriptQuotes: Leave
# JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
# LambdaBodyIndentation: Signature
# MacroBlockBegin: ''
# MacroBlockEnd: ''
# MaxEmptyLinesToKeep: 1
# NamespaceIndentation: None
# PenaltyBreakAssignment: 2
# PenaltyBreakBeforeFirstCallParameter: 19
# PenaltyBreakComment: 300
# PenaltyBreakFirstLessLess: 120
# PenaltyBreakString: 1000
# PenaltyBreakTemplateDeclaration: 10
# PenaltyExcessCharacter: 1000000
# PenaltyReturnTypeOnItsOwnLine: 60
# PenaltyIndentedWhitespace: 0
# PointerAlignment: Right
# PPIndentWidth: -1
# ReferenceAlignment: Pointer
# ReflowComments: true
# ShortNamespaceLines: 1
# SortIncludes: CaseSensitive
# SortJavaStaticImport: Before
# SortUsingDeclarations: true
# SpaceAfterCStyleCast: false
# SpaceAfterLogicalNot: false
# SpaceAfterTemplateKeyword: true
# SpaceBeforeAssignmentOperators: true
# SpaceBeforeCaseColon: false
# SpaceBeforeCpp11BracedList: false
# SpaceBeforeCtorInitializerColon: true
# SpaceBeforeInheritanceColon: true
# SpaceBeforeParens: ControlStatements
# SpaceAroundPointerQualifiers: Default
# SpaceBeforeRangeBasedForLoopColon: true
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1
# SpaceInEmptyBlock: false
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1
# SpacesInAngles: Never
# SpacesInContainerLiterals: true
# SpacesInConditionalStatement: false
# SpacesInContainerLiterals: true
# SpacesInCStyleCastParentheses: false
## Godot TODO: We'll want to use a min of 1, but we need to see how to fix
## our comment capitalization at the same time.
SpacesInLineCommentPrefix:
Minimum: 0
Maximum: -1
# SpacesInParentheses: false
# SpacesInSquareBrackets: false
# SpaceBeforeSquareBrackets: false
# BitFieldColonSpacing: Both
# StatementAttributeLikeMacros:
# - Q_EMIT
# StatementMacros:
# - Q_UNUSED
# - QT_REQUIRE_VERSION
TabWidth: 4
# UseCRLF: false
UseTab: Always
# WhitespaceSensitiveMacros:
# - STRINGIZE
# - PP_STRINGIZE
# - BOOST_PP_STRINGIZE
# - NS_SWIFT_NAME
# - CF_SWIFT_NAME
---
### C++ specific config ###
Language: Cpp
Standard: c++14
---
### ObjC specific config ###
Language: ObjC
# ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
# ObjCBreakBeforeNestedBlockParam: true
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: true
---
### Java specific config ###
Language: Java
# BreakAfterJavaFieldAnnotations: false
JavaImportGroups: ['org.godotengine', 'android', 'androidx', 'com.android', 'com.google', 'java', 'javax']
...
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Project-related
project/addons
project/export_presets.cfg
project/.vscode

.sentry-native

# godot-cpp directory if not using submodules
godot-cpp/

# Godot auto generated files
project/.godot/

# Objects
*.o
*.os
*.so
*.obj
*.bc
*.pyc
*.dblite
*.pdb
*.lib
*.config
*.creator
*.creator.user
*.files
*.includes
*.idb

# Vim temp files
*.swo
*.swp

# Scons
.sconf_temp
.sconsign.dblite
.scons_node_count

# Misc
.DS_Store
~$*
*~

# Windows image file caches
Thumbs.db
ehthumbs.db

# Windows folder config file
Desktop.ini

# Visual Studio and Visual Studio Code workspace folders
/.vs
/.vscode
*.code-workspace

# compile commands (https://clang.llvm.org/docs/JSONCompilationDatabase.html)
compile_commands.json

# clang cache
.cache
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "sentry-native"]
path = sentry-native
url = https://github.com/getsentry/sentry-native.git
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
# Sentry for Godot Engine

An eventual Godot SDK for Sentry
This SDK is a work in progress

## Building Sentry Godot SDK

Godot Sentry SDK can currently be built for Windows and Linux platforms.

### Setting up SCons

Prerequisites: SCons, CMake, C/C++ compiler, python, clang-format.

On Windows, if you have `scoop` installed, you can easily install most of the required packages with the following command:
```
scoop install python scons cmake clang
bitsandfoxes marked this conversation as resolved.
Show resolved Hide resolved
```

You can also use an existing Python installation to install SCons build tool:
```bash
# install scons
python -m pip install scons

# upgrade scons
python -m pip install --upgrade scons
```

### Compiling

1. Clone repository and its submodules.
2. Build GDExtension libraries:
```bash
# build *editor* library for the current platform
# run from the repository root dir
scons target=editor debug_symbols=yes
```
The build process should produce a GDExtension library file for the ***editor target*** at `project/addons/sentrysdk/bin/libsentrysdk.*.editor.*`.

To export a project in Godot that uses this extension, you'll also need the libraries for the export templates:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, so you need two sets of libraries: Editor and Release. The Release ones actually make it into the exported game. Makes sense.
I wonder if there is something that we can do with that. This way we have a guaranteed way of knowing whether the SDK is in use in the editor or in production. I'm thinking of debug logging, verbosity levels, error capture. We probably should not mess with default options tho.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are preprocessor defines for build options, and you can add your own, of course. Useful for conditional code inclusion for different builds, platforms, etc.

```bash
# build *export* library for the current platform
scons target=template_release debug_symbols=yes
```
3. Open demo project in Godot Engine:
```bash
# open demo project in Godot 4.3
godot project/project.godot
```

In the Godot editor, you can adjust the Sentry SDK settings by going to `Project Settings -> Sentry -> Config`.
Loading