Skip to content

Commit 007689f

Browse files
authored
feat(database,windows): add support for Realtime Database to windows (#18079)
* feat(database,windows): add support for Realtime Database to windows * format * fix * clean * additionnal librairies * emulator support attempt * format * fix tests * clean * details for CI * clean * clean * fix * clear * fix * removing dumb emulator support * fixing event channels * skip test for database, only work in manual testing * format * skip test * clean * clean
1 parent 103d7ff commit 007689f

16 files changed

Lines changed: 3683 additions & 92 deletions

File tree

.github/workflows/windows.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- name: "Build Windows (Release)"
5757
run: cd tests && flutter build windows --release
5858
- name: Start Firebase Emulator and run tests
59-
run: cd ./.github/workflows/scripts && firebase emulators:exec --project flutterfire-e2e-tests "cd ../../../tests && flutter test .\integration_test\e2e_test.dart -d windows"
59+
run: cd ./.github/workflows/scripts && firebase emulators:exec --project flutterfire-e2e-tests "cd ../../../tests && flutter test .\integration_test\e2e_test.dart -d windows --verbose"
6060

6161
# We cannot run the tests but we can still try to build the app because of https://github.com/flutter/flutter/issues/79213
6262
windows-firestore:

packages/firebase_core/firebase_core/windows/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ add_subdirectory(${FIREBASE_CPP_SDK_DIR} bin/ EXCLUDE_FROM_ALL)
122122
target_include_directories(${PLUGIN_NAME} INTERFACE
123123
"${FIREBASE_CPP_SDK_DIR}/include")
124124

125-
set(FIREBASE_RELEASE_PATH_LIBS firebase_app firebase_auth firebase_remote_config firebase_storage firebase_firestore)
125+
set(FIREBASE_RELEASE_PATH_LIBS firebase_app firebase_auth firebase_remote_config firebase_storage firebase_firestore firebase_database)
126126
foreach(firebase_lib IN ITEMS ${FIREBASE_RELEASE_PATH_LIBS})
127127
get_target_property(firebase_lib_path ${firebase_lib} IMPORTED_LOCATION)
128128
string(REPLACE "Debug" "Release" firebase_lib_release_path ${firebase_lib_path})

packages/firebase_database/firebase_database/ios/firebase_database/Sources/firebase_database/FirebaseDatabaseMessages.g.swift

Lines changed: 90 additions & 89 deletions
Large diffs are not rendered by default.

packages/firebase_database/firebase_database/pubspec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,7 @@ flutter:
3939
pluginClass: FLTFirebaseDatabasePlugin
4040
macos:
4141
pluginClass: FLTFirebaseDatabasePlugin
42+
windows:
43+
pluginClass: FirebaseDatabasePluginCApi
4244
web:
4345
default_package: firebase_database_web
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
set(PROJECT_NAME "flutterfire_database")
4+
project(${PROJECT_NAME} LANGUAGES CXX)
5+
6+
set(PLUGIN_NAME "firebase_database_plugin")
7+
8+
list(APPEND PLUGIN_SOURCES
9+
"firebase_database_plugin.cpp"
10+
"firebase_database_plugin.h"
11+
"messages.g.cpp"
12+
"messages.g.h"
13+
)
14+
15+
# Read version from pubspec.yaml
16+
file(STRINGS "../pubspec.yaml" pubspec_content)
17+
foreach(line ${pubspec_content})
18+
string(FIND ${line} "version: " has_version)
19+
20+
if("${has_version}" STREQUAL "0")
21+
string(FIND ${line} ": " version_start_pos)
22+
math(EXPR version_start_pos "${version_start_pos} + 2")
23+
string(LENGTH ${line} version_end_pos)
24+
math(EXPR len "${version_end_pos} - ${version_start_pos}")
25+
string(SUBSTRING ${line} ${version_start_pos} ${len} PLUGIN_VERSION)
26+
break()
27+
endif()
28+
endforeach(line)
29+
30+
configure_file(plugin_version.h.in ${CMAKE_BINARY_DIR}/generated/firebase_database/plugin_version.h)
31+
include_directories(${CMAKE_BINARY_DIR}/generated/)
32+
33+
add_library(${PLUGIN_NAME} STATIC
34+
"include/firebase_database/firebase_database_plugin_c_api.h"
35+
"firebase_database_plugin_c_api.cpp"
36+
${PLUGIN_SOURCES}
37+
${CMAKE_BINARY_DIR}/generated/firebase_database/plugin_version.h
38+
)
39+
40+
apply_standard_settings(${PLUGIN_NAME})
41+
42+
set_target_properties(${PLUGIN_NAME} PROPERTIES
43+
CXX_VISIBILITY_PRESET hidden)
44+
target_compile_definitions(${PLUGIN_NAME} PUBLIC FLUTTER_PLUGIN_IMPL)
45+
target_compile_definitions(${PLUGIN_NAME} PRIVATE -DINTERNAL_EXPERIMENTAL=1)
46+
47+
set(MSVC_RUNTIME_MODE MD)
48+
set(firebase_libs firebase_core_plugin firebase_database)
49+
set(ADDITIONAL_LIBS advapi32 ws2_32 crypt32 rpcrt4 ole32 shell32 Bcrypt.lib DbgHelp.lib)
50+
set(RTDB_ADDITIONAL_LIBS iphlpapi psapi userenv)
51+
target_link_libraries(${PLUGIN_NAME} PRIVATE "${firebase_libs}" "${ADDITIONAL_LIBS}" "${RTDB_ADDITIONAL_LIBS}")
52+
53+
target_include_directories(${PLUGIN_NAME} INTERFACE
54+
"${CMAKE_CURRENT_SOURCE_DIR}/include")
55+
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)
56+
57+
set(firebase_database_bundled_libraries
58+
""
59+
PARENT_SCOPE
60+
)

0 commit comments

Comments
 (0)