Skip to content

Commit 28e031c

Browse files
authored
Merge branch 'main' into feat/dart-symbolication
2 parents 775279d + ec4c9da commit 28e031c

20 files changed

+170
-282
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
- Useful when using Sentry.init() instead of SentryFlutter.init() in Flutter projects for example due to size limitations.
1010
- `true` by default but automatically set to `false` when using SentryFlutter.init() because the SentryFlutter fetches debug images from the native SDK integrations.
1111

12+
### Dependencies
13+
14+
- Bump Cocoa SDK from v8.35.1 to v8.36.0 ([#2252](https://github.com/getsentry/sentry-dart/pull/2252))
15+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8360)
16+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.35.1...8.36.0)
17+
1218
## 8.8.0
1319

1420
### Features

flutter/example/windows/CMakeLists.txt

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
cmake_minimum_required(VERSION 3.15)
1+
# Project-level configuration.
2+
cmake_minimum_required(VERSION 3.14)
23
project(sentry_flutter_example LANGUAGES CXX)
34

5+
# The name of the executable created for the application. Change this to change
6+
# the on-disk name of your application.
47
set(BINARY_NAME "sentry_flutter_example")
58

6-
cmake_policy(SET CMP0063 NEW)
9+
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10+
# versions of CMake.
11+
cmake_policy(VERSION 3.14...3.25)
712

8-
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
9-
10-
# Configure build options.
13+
# Define build configuration option.
1114
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
1215
if(IS_MULTICONFIG)
1316
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
@@ -20,7 +23,7 @@ else()
2023
"Debug" "Profile" "Release")
2124
endif()
2225
endif()
23-
26+
# Define settings for the Profile build mode.
2427
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
2528
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
2629
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
@@ -30,6 +33,10 @@ set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
3033
add_definitions(-DUNICODE -D_UNICODE)
3134

3235
# Compilation settings that should be applied to most targets.
36+
#
37+
# Be cautious about adding new options here, as plugins use this function by
38+
# default. In most cases, you should add new options to specific targets instead
39+
# of modifying this function.
3340
function(APPLY_STANDARD_SETTINGS TARGET)
3441
target_compile_features(${TARGET} PUBLIC cxx_std_17)
3542
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
@@ -38,14 +45,14 @@ function(APPLY_STANDARD_SETTINGS TARGET)
3845
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
3946
endfunction()
4047

41-
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
42-
4348
# Flutter library and tool build rules.
49+
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
4450
add_subdirectory(${FLUTTER_MANAGED_DIR})
4551

46-
# Application build
52+
# Application build; see runner/CMakeLists.txt.
4753
add_subdirectory("runner")
4854

55+
4956
# Generated plugin build rules, which manage building the plugins and adding
5057
# them to the application.
5158
include(flutter/generated_plugins.cmake)
@@ -80,6 +87,12 @@ if(PLUGIN_BUNDLED_LIBRARIES)
8087
COMPONENT Runtime)
8188
endif()
8289

90+
# Copy the native assets provided by the build.dart from all packages.
91+
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/")
92+
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
93+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
94+
COMPONENT Runtime)
95+
8396
# Fully re-copy the assets directory on each build to avoid having stale files
8497
# from a previous install.
8598
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")

flutter/example/windows/flutter/CMakeLists.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
cmake_minimum_required(VERSION 3.15)
1+
# This file controls Flutter-level build steps. It should not be edited.
2+
cmake_minimum_required(VERSION 3.14)
23

34
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
45

@@ -9,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
910
# https://github.com/flutter/flutter/issues/57146.
1011
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
1112

13+
# Set fallback configurations for older versions of the flutter tool.
14+
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
15+
set(FLUTTER_TARGET_PLATFORM "windows-x64")
16+
endif()
17+
1218
# === Flutter Library ===
1319
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
1420

@@ -91,7 +97,7 @@ add_custom_command(
9197
COMMAND ${CMAKE_COMMAND} -E env
9298
${FLUTTER_TOOL_ENVIRONMENT}
9399
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
94-
windows-x64 $<CONFIG>
100+
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
95101
VERBATIM
96102
)
97103
add_custom_target(flutter_assemble DEPENDS
+24-2
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,40 @@
1-
cmake_minimum_required(VERSION 3.15)
1+
cmake_minimum_required(VERSION 3.14)
22
project(runner LANGUAGES CXX)
33

4+
# Define the application target. To change its name, change BINARY_NAME in the
5+
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6+
# work.
7+
#
8+
# Any new source files that you add to the application should be added here.
49
add_executable(${BINARY_NAME} WIN32
510
"flutter_window.cpp"
611
"main.cpp"
7-
"run_loop.cpp"
812
"utils.cpp"
913
"win32_window.cpp"
1014
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
1115
"Runner.rc"
1216
"runner.exe.manifest"
1317
)
18+
19+
# Apply the standard set of build settings. This can be removed for applications
20+
# that need different build settings.
1421
apply_standard_settings(${BINARY_NAME})
22+
23+
# Add preprocessor definitions for the build version.
24+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29+
30+
# Disable Windows macros that collide with C++ standard library functions.
1531
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32+
33+
# Add dependency libraries and include directories. Add any application-specific
34+
# dependencies here.
1635
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
36+
target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib")
1737
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
38+
39+
# Run the Flutter tool portions of the build. This must not be removed.
1840
add_dependencies(${BINARY_NAME} flutter_assemble)

flutter/example/windows/runner/Runner.rc

+7-7
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
6060
// Version
6161
//
6262

63-
#ifdef FLUTTER_BUILD_NUMBER
64-
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
63+
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64+
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
6565
#else
66-
#define VERSION_AS_NUMBER 1,0,0
66+
#define VERSION_AS_NUMBER 1,0,0,0
6767
#endif
6868

69-
#ifdef FLUTTER_BUILD_NAME
70-
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
69+
#if defined(FLUTTER_VERSION)
70+
#define VERSION_AS_STRING FLUTTER_VERSION
7171
#else
7272
#define VERSION_AS_STRING "1.0.0"
7373
#endif
@@ -90,10 +90,10 @@ BEGIN
9090
BLOCK "040904e4"
9191
BEGIN
9292
VALUE "CompanyName", "com.example" "\0"
93-
VALUE "FileDescription", "Demonstrates how to use the sentry_flutter plugin." "\0"
93+
VALUE "FileDescription", "sentry_flutter_example" "\0"
9494
VALUE "FileVersion", VERSION_AS_STRING "\0"
9595
VALUE "InternalName", "sentry_flutter_example" "\0"
96-
VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0"
96+
VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0"
9797
VALUE "OriginalFilename", "sentry_flutter_example.exe" "\0"
9898
VALUE "ProductName", "sentry_flutter_example" "\0"
9999
VALUE "ProductVersion", VERSION_AS_STRING "\0"

flutter/example/windows/runner/flutter_window.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
#include "flutter/generated_plugin_registrant.h"
66

7-
FlutterWindow::FlutterWindow(RunLoop* run_loop,
8-
const flutter::DartProject& project)
9-
: run_loop_(run_loop), project_(project) {}
7+
FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8+
: project_(project) {}
109

1110
FlutterWindow::~FlutterWindow() {}
1211

@@ -26,14 +25,22 @@ bool FlutterWindow::OnCreate() {
2625
return false;
2726
}
2827
RegisterPlugins(flutter_controller_->engine());
29-
run_loop_->RegisterFlutterInstance(flutter_controller_->engine());
3028
SetChildContent(flutter_controller_->view()->GetNativeWindow());
29+
30+
flutter_controller_->engine()->SetNextFrameCallback([&]() {
31+
this->Show();
32+
});
33+
34+
// Flutter can complete the first frame before the "show window" callback is
35+
// registered. The following call ensures a frame is pending to ensure the
36+
// window is shown. It is a no-op if the first frame hasn't completed yet.
37+
flutter_controller_->ForceRedraw();
38+
3139
return true;
3240
}
3341

3442
void FlutterWindow::OnDestroy() {
3543
if (flutter_controller_) {
36-
run_loop_->UnregisterFlutterInstance(flutter_controller_->engine());
3744
flutter_controller_ = nullptr;
3845
}
3946

@@ -44,7 +51,7 @@ LRESULT
4451
FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
4552
WPARAM const wparam,
4653
LPARAM const lparam) noexcept {
47-
// Give Flutter, including plugins, an opporutunity to handle window messages.
54+
// Give Flutter, including plugins, an opportunity to handle window messages.
4855
if (flutter_controller_) {
4956
std::optional<LRESULT> result =
5057
flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,

flutter/example/windows/runner/flutter_window.h

+2-8
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@
66

77
#include <memory>
88

9-
#include "run_loop.h"
109
#include "win32_window.h"
1110

1211
// A window that does nothing but host a Flutter view.
1312
class FlutterWindow : public Win32Window {
1413
public:
15-
// Creates a new FlutterWindow driven by the |run_loop|, hosting a
16-
// Flutter view running |project|.
17-
explicit FlutterWindow(RunLoop* run_loop,
18-
const flutter::DartProject& project);
14+
// Creates a new FlutterWindow hosting a Flutter view running |project|.
15+
explicit FlutterWindow(const flutter::DartProject& project);
1916
virtual ~FlutterWindow();
2017

2118
protected:
@@ -26,9 +23,6 @@ class FlutterWindow : public Win32Window {
2623
LPARAM const lparam) noexcept override;
2724

2825
private:
29-
// The run loop driving events for this window.
30-
RunLoop* run_loop_;
31-
3226
// The project to run.
3327
flutter::DartProject project_;
3428

flutter/example/windows/runner/main.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <windows.h>
44

55
#include "flutter_window.h"
6-
#include "run_loop.h"
76
#include "utils.h"
87

98
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
@@ -18,24 +17,26 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
1817
// plugins.
1918
::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
2019

21-
RunLoop run_loop;
22-
2320
flutter::DartProject project(L"data");
2421

2522
std::vector<std::string> command_line_arguments =
2623
GetCommandLineArguments();
2724

2825
project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
2926

30-
FlutterWindow window(&run_loop, project);
27+
FlutterWindow window(project);
3128
Win32Window::Point origin(10, 10);
3229
Win32Window::Size size(1280, 720);
33-
if (!window.CreateAndShow(L"sentry_flutter_example", origin, size)) {
30+
if (!window.Create(L"sentry_flutter_example", origin, size)) {
3431
return EXIT_FAILURE;
3532
}
3633
window.SetQuitOnClose(true);
3734

38-
run_loop.Run();
35+
::MSG msg;
36+
while (::GetMessage(&msg, nullptr, 0, 0)) {
37+
::TranslateMessage(&msg);
38+
::DispatchMessage(&msg);
39+
}
3940

4041
::CoUninitialize();
4142
return EXIT_SUCCESS;

flutter/example/windows/runner/run_loop.cpp

-66
This file was deleted.

0 commit comments

Comments
 (0)