Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
[flutter]: support dev build window
annie58078c26dbef
diff --git a/app_flowy/.gitignore b/app_flowy/.gitignoreindex 2434bfe9a6..9555d0a6f7 100644--- a/app_flowy/.gitignore+++ b/app_flowy/.gitignore@@ -48,5 +48,5 @@ app.*.map.json/packages/flowy_protobuf/packages/flutter-quill-product/**/Release-product/**/Debug\ No newline at end of file+product/**+windows/flutter/dart_ffi/\ No newline at end of filediff --git a/app_flowy/packages/flowy_sdk/windows/dart_ffi/README.md b/app_flowy/packages/flowy_sdk/windows/dart_ffi/README.mddeleted file mode 100644index d3afcbe3ca..0000000000--- a/app_flowy/packages/flowy_sdk/windows/dart_ffi/README.md+++ /dev/null@@ -1,5 +0,0 @@-# Debug Mode---# Release Mode-These DLLS need to be copied into the /Release folder each time we export a build.diff --git a/app_flowy/packages/flowy_sdk/windows/dart_ffi/binding.h b/app_flowy/packages/flowy_sdk/windows/dart_ffi/binding.hdeleted file mode 100644index 036d56aa2a..0000000000--- a/app_flowy/packages/flowy_sdk/windows/dart_ffi/binding.h+++ /dev/null@@ -1,15 +0,0 @@-#include <stdarg.h>-#include <stdbool.h>-#include <stdint.h>-#include <stdlib.h>---int64_t init_sdk(char *path);--void async_command(int64_t port, const uint8_t *input, uintptr_t len);--const uint8_t *sync_command(const uint8_t *input, uintptr_t len);--int32_t set_stream_port(int64_t port);--void link_me_please(void);\ No newline at end of filediff --git a/app_flowy/windows/CMakeLists.txt b/app_flowy/windows/CMakeLists.txtindex 85f6f57e19..8cd643ca40 100644--- a/app_flowy/windows/CMakeLists.txt+++ b/app_flowy/windows/CMakeLists.txt@@ -62,6 +62,7 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)endif()+set(DART_FFI_DIR "${CMAKE_INSTALL_PREFIX}")set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")@@ -71,6 +72,9 @@ install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"COMPONENT Runtime)+install(FILES "${DART_FFI_DLL}" DESTINATION "${DART_FFI_DIR}"+ COMPONENT Runtime)+install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"COMPONENT Runtime)diff --git a/app_flowy/windows/flutter/CMakeLists.txt b/app_flowy/windows/flutter/CMakeLists.txtindex b2e4bd8d65..8ec917b8c3 100644--- a/app_flowy/windows/flutter/CMakeLists.txt+++ b/app_flowy/windows/flutter/CMakeLists.txt@@ -15,6 +15,7 @@ set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")# Published to parent scope for install step.set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)+set(DART_FFI_DLL "${CMAKE_CURRENT_SOURCE_DIR}/dart_ffi/dart_ffi.dll" PARENT_SCOPE)set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)diff --git a/app_flowy/windows/runner/CMakeLists.txt b/app_flowy/windows/runner/CMakeLists.txtindex de2d8916b7..df6e8b99b5 100644--- a/app_flowy/windows/runner/CMakeLists.txt+++ b/app_flowy/windows/runner/CMakeLists.txt@@ -15,3 +15,8 @@ target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")add_dependencies(${BINARY_NAME} flutter_assemble)+++# === Flutter Library ===+#set(DART_FFI "${CMAKE_CURRENT_SOURCE_DIR}/dart_ffi/dart_ffi.dll")+#set(DART_FFI ${DART_FFI} PARENT_SCOPE)\ No newline at end of filediff --git a/rust-lib/dart-ffi/Cargo.toml b/rust-lib/dart-ffi/Cargo.tomlindex 773ae957ef..0bcc31f605 100644--- a/rust-lib/dart-ffi/Cargo.toml+++ b/rust-lib/dart-ffi/Cargo.toml@@ -7,8 +7,8 @@ edition = "2018"[lib]name = "dart_ffi"# this value will change depending on the target os-# default cdylib-crate-type = ["cdylib"]+# default staticlib+crate-type = ["staticlib"][dependencies]diff --git a/scripts/build_sdk.sh b/scripts/build_sdk.shindex 8b8db4d873..5768ea74b4 100755--- a/scripts/build_sdk.sh+++ b/scripts/build_sdk.sh@@ -13,6 +13,9 @@ rustup show# 3. ~/.profile# 4. ~/.zshrc++# TODO: Automatically exec the script base on the current system+# for macoscargo make --profile development-mac flowy-sdk-devdiff --git a/scripts/makefile/desktop.toml b/scripts/makefile/desktop.tomlindex b284771a74..c4edb421e3 100644--- a/scripts/makefile/desktop.toml+++ b/scripts/makefile/desktop.toml@@ -77,11 +77,15 @@ private = truescript = ["""echo "π π π Flowy-SDK(windows) build success"+ dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/windows/flutter/dart_ffi++ # copy dllcp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${RUST_COMPILE_TARGET}/${BUILD_FLAG}/${CARGO_MAKE_CRATE_FS_NAME}.${SDK_EXT} \- ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages/flowy_sdk/${TARGET_OS}/dart_ffi/${CARGO_MAKE_CRATE_FS_NAME}.${SDK_EXT}+ ${dart_ffi_dir}/${CARGO_MAKE_CRATE_FS_NAME}.${SDK_EXT}+ # copy binding.hcp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/binding.h \- ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages/flowy_sdk/${TARGET_OS}/dart_ffi/binding.h+ ${dart_ffi_dir}/binding.h""",]script_runner = "@duckscript"diff --git a/scripts/makefile/flutter.toml b/scripts/makefile/flutter.tomlindex 5e7a4303bc..5cb094de48 100644--- a/scripts/makefile/flutter.toml+++ b/scripts/makefile/flutter.toml@@ -9,7 +9,7 @@ script_runner = "@shell"[tasks.appflowy-windows]dependencies = ["flowy-sdk-release"]-run_task = { name = ["flutter-build", "copy-dll-to-build-folder", "copy-to-product"] }+run_task = { name = ["flutter-build", "copy-to-product"] }[tasks.copy-to-product]mac_alias = "copy-to-product-macos"@@ -32,20 +32,20 @@ script = []script_runner = "@shell"-[tasks.copy-dll-to-build-folder]-script = [- """- cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${RUST_COMPILE_TARGET}/${BUILD_FLAG}/${CARGO_MAKE_CRATE_FS_NAME}.${SDK_EXT} \- ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/build/${TARGET_OS}/runner/${BUILD_FLAG}/${CARGO_MAKE_CRATE_FS_NAME}.${SDK_EXT}- """,-]-script_runner = "@duckscript"[tasks.copy-to-product-windows]script = ["""- # TODO:- echo TBD...+ product_path= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product/${VERSION}+ output_path= set ${product_path}/${TARGET_OS}+ if is_path_exists ${output_path}+ rm -r ${output_path}/+ fi+ mkdir ${output_path}++ product= set ${PRODUCT_NAME}+ glob_cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/build/${TARGET_OS}/runner/${FLUTTER_OUTPUT_DIR}/**/* \+ ${output_path}/${product}""",]script_runner = "@duckscript"