-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathregister_types.cpp
More file actions
192 lines (171 loc) · 6.71 KB
/
Copy pathregister_types.cpp
File metadata and controls
192 lines (171 loc) · 6.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#include "editor/sentry_editor_plugin.h"
#include "sentry/disabled/disabled_event.h"
#include "sentry/dotnet/dotnet_before_send_processor.h"
#include "sentry/dotnet/dotnet_scope_observer.h"
#include "sentry/logging/sentry_godot_logger.h"
#include "sentry/processing/screenshot_processor.h"
#include "sentry/processing/sentry_event_processor.h"
#include "sentry/processing/view_hierarchy_processor.h"
#include "sentry/runtime_config.h"
#include "sentry/sentry_attachment.h"
#include "sentry/sentry_bad_code.h"
#include "sentry/sentry_breadcrumb.h"
#include "sentry/sentry_event.h"
#include "sentry/sentry_feedback.h"
#include "sentry/sentry_log.h"
#include "sentry/sentry_logger.h"
#include "sentry/sentry_metric.h"
#include "sentry/sentry_metrics.h"
#include "sentry/sentry_options.h"
#include "sentry/sentry_scope_observer.h"
#include "sentry/sentry_sdk.h"
#include "sentry/sentry_unit.h"
#include "sentry/sentry_user.h"
#include <godot_cpp/classes/engine.hpp>
#include <godot_cpp/classes/scene_tree.hpp>
#include <godot_cpp/classes/window.hpp>
#ifdef SDK_NATIVE
#include "sentry/native/native_breadcrumb.h"
#include "sentry/native/native_event.h"
#include "sentry/native/native_log.h"
#include "sentry/native/native_metric.h"
#endif // SDK_NATIVE
#ifdef SDK_ANDROID
#include "sentry/android/android_breadcrumb.h"
#include "sentry/android/android_event.h"
#include "sentry/android/android_log.h"
#include "sentry/android/android_metric.h"
#include "sentry/android/android_sdk.h"
#endif // SDK_ANDROID
#ifdef SDK_COCOA
#include "sentry/cocoa/cocoa_breadcrumb.h"
#include "sentry/cocoa/cocoa_event.h"
#include "sentry/cocoa/cocoa_log.h"
#include "sentry/cocoa/cocoa_metric.h"
#endif // SDK_COCOA
#ifdef SDK_JAVASCRIPT
#include "sentry/javascript/javascript_breadcrumb.h"
#include "sentry/javascript/javascript_event.h"
#include "sentry/javascript/javascript_log.h"
#include "sentry/javascript/javascript_metric.h"
#include "sentry/javascript/javascript_sdk.h"
#endif
#ifdef TESTS_ENABLED
#include "cpp_test_runner.h"
#include <godot_cpp/variant/callable_method_pointer.hpp>
#endif
#ifdef TOOLS_ENABLED
#include "editor/sentry_editor_export_plugin_android.h"
#include "editor/sentry_editor_export_plugin_ios.h"
#include "editor/sentry_editor_export_plugin_unix.h"
#include "editor/sentry_editor_export_plugin_web.h"
#include "editor/sentry_editor_plugin.h"
#include <godot_cpp/classes/editor_plugin_registration.hpp>
#endif // TOOLS_ENABLED
using namespace godot;
using namespace sentry;
void register_runtime_classes() {
GDREGISTER_CLASS(SentryLoggerLimits);
GDREGISTER_CLASS(SentryExperimental);
GDREGISTER_CLASS(SentryAndroidOptions);
GDREGISTER_CLASS(SentryGodotLoggerOptions);
GDREGISTER_CLASS(SentryOptions);
GDREGISTER_INTERNAL_CLASS(RuntimeConfig);
GDREGISTER_CLASS(SentryUser);
GDREGISTER_CLASS(SentryTimestamp);
GDREGISTER_CLASS(SentryLogger);
GDREGISTER_CLASS(SentryMetrics);
GDREGISTER_CLASS(SentryBadCode);
GDREGISTER_CLASS(SentryUnit);
GDREGISTER_CLASS(SentryFeedback);
GDREGISTER_CLASS(SentrySDK);
GDREGISTER_ABSTRACT_CLASS(SentryAttachment);
GDREGISTER_ABSTRACT_CLASS(SentryEvent);
GDREGISTER_ABSTRACT_CLASS(SentryBreadcrumb);
GDREGISTER_ABSTRACT_CLASS(SentryLog);
GDREGISTER_ABSTRACT_CLASS(SentryMetric);
GDREGISTER_INTERNAL_CLASS(DisabledEvent);
GDREGISTER_INTERNAL_CLASS(SentryEventProcessor);
GDREGISTER_INTERNAL_CLASS(ScreenshotProcessor);
GDREGISTER_INTERNAL_CLASS(ViewHierarchyProcessor);
GDREGISTER_INTERNAL_CLASS(logging::SentryGodotLogger);
GDREGISTER_INTERNAL_CLASS(SentryScopeObserver);
GDREGISTER_INTERNAL_CLASS(sentry::dotnet::DotnetScopeObserver);
GDREGISTER_INTERNAL_CLASS(sentry::dotnet::DotnetBeforeSendProcessor);
#ifdef SDK_NATIVE
GDREGISTER_INTERNAL_CLASS(native::NativeEvent);
GDREGISTER_INTERNAL_CLASS(native::NativeBreadcrumb);
GDREGISTER_INTERNAL_CLASS(native::NativeLog);
GDREGISTER_INTERNAL_CLASS(native::NativeMetric);
#endif
#ifdef SDK_ANDROID
GDREGISTER_INTERNAL_CLASS(android::AndroidEvent);
GDREGISTER_INTERNAL_CLASS(android::AndroidBreadcrumb);
GDREGISTER_INTERNAL_CLASS(android::AndroidLog);
GDREGISTER_INTERNAL_CLASS(android::AndroidMetric);
GDREGISTER_INTERNAL_CLASS(android::SentryAndroidBeforeSendHandler);
GDREGISTER_INTERNAL_CLASS(android::SentryAndroidBeforeSendLogHandler);
GDREGISTER_INTERNAL_CLASS(android::SentryAndroidBeforeSendMetricHandler);
#endif
#ifdef SDK_COCOA
GDREGISTER_INTERNAL_CLASS(cocoa::CocoaEvent);
GDREGISTER_INTERNAL_CLASS(cocoa::CocoaBreadcrumb);
GDREGISTER_INTERNAL_CLASS(cocoa::CocoaLog);
GDREGISTER_INTERNAL_CLASS(cocoa::CocoaMetric);
#endif
#ifdef SDK_JAVASCRIPT
GDREGISTER_INTERNAL_CLASS(javascript::JavaScriptEvent);
GDREGISTER_INTERNAL_CLASS(javascript::JavaScriptBreadcrumb);
GDREGISTER_INTERNAL_CLASS(javascript::JavaScriptLog);
GDREGISTER_INTERNAL_CLASS(javascript::JavaScriptMetric);
#endif
}
void register_editor_classes() {
#ifdef TOOLS_ENABLED
GDREGISTER_INTERNAL_CLASS(SentryEditorExportPluginAndroid);
GDREGISTER_INTERNAL_CLASS(SentryEditorExportPluginWeb);
GDREGISTER_INTERNAL_CLASS(SentryEditorExportPluginIOS);
GDREGISTER_INTERNAL_CLASS(SentryEditorPlugin);
#ifndef WINDOWS_ENABLED
GDREGISTER_INTERNAL_CLASS(SentryEditorExportPluginUnix);
#endif // !WINDOWS_ENABLED
#endif // TOOLS_ENABLED
}
void initialize_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_CORE) {
} else if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
} else if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
register_runtime_classes();
SentryUnit::create_singleton();
SentrySDK::create_singleton();
#ifdef TESTS_ENABLED
// If --test-sentry was passed, run the test session and exit.
if (sentry::tests::should_run_cpp_tests()) {
// Defer until GodotSharp loads - .NET tests need the managed runtime.
callable_mp_static(sentry::tests::run_cpp_tests_and_exit).call_deferred();
}
#endif
SentrySDK::get_singleton()->prepare_and_auto_initialize();
} else if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
#ifdef TOOLS_ENABLED
register_editor_classes();
EditorPlugins::add_by_type<SentryEditorPlugin>();
#endif // TOOLS_ENABLED
}
}
void uninitialize_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
SentrySDK::destroy_singleton();
SentryUnit::destroy_singleton();
}
}
extern "C" {
// Initialization.
GDExtensionBool GDE_EXPORT sentry_gdextension_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
init_obj.register_initializer(initialize_module);
init_obj.register_terminator(uninitialize_module);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
return init_obj.init();
}
}