[flutter]: support dev build window

This commit is contained in:
annie 2021-11-18 16:18:20 +08:00
parent 93ce7d3b7d
commit 58078c26db
10 changed files with 35 additions and 38 deletions

View File

@ -48,5 +48,5 @@ app.*.map.json
/packages/flowy_protobuf
/packages/flutter-quill
product/**/Release
product/**/Debug
product/**
windows/flutter/dart_ffi/

View File

@ -1,5 +0,0 @@
# Debug Mode
# Release Mode
These DLLS need to be copied into the /Release folder each time we export a build.

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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]

View File

@ -13,6 +13,9 @@ rustup show
# 3. ~/.profile
# 4. ~/.zshrc
# TODO: Automatically exec the script base on the current system
# for macos
cargo make --profile development-mac flowy-sdk-dev

View File

@ -77,11 +77,15 @@ private = true
script = [
"""
echo "🚀 🚀 🚀 Flowy-SDK(windows) build success"
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/packages/flowy_sdk/${TARGET_OS}/dart_ffi/${CARGO_MAKE_CRATE_FS_NAME}.${SDK_EXT}
dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/windows/flutter/dart_ffi
# copy dll
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${RUST_COMPILE_TARGET}/${BUILD_FLAG}/${CARGO_MAKE_CRATE_FS_NAME}.${SDK_EXT} \
${dart_ffi_dir}/${CARGO_MAKE_CRATE_FS_NAME}.${SDK_EXT}
# copy binding.h
cp ${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"

View File

@ -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"