Skip to content

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.

[rust]: config build flowy-macos build scripts

appflowyf700f69ac2d4
diff --git a/Makefile.toml b/Makefile.toml
index 989df192b3..0acc516255 100644
--- a/Makefile.toml
+++ b/Makefile.toml
@@ -3,6 +3,7 @@ extend = [
{ path = "scripts/makefile/protobuf.toml" },
{ path = "scripts/makefile/tests.toml" },
{ path = "scripts/makefile/docker.toml" },
+ { path = "scripts/makefile/flutter.toml" },
]
[env]
@@ -17,8 +18,9 @@ PROD = false
TARGET_OS = "macos"
DESKTOP_TARGET = "x86_64-apple-darwin"
crate_type = "cdylib"
-LIB_OUT_DIR = "debug"
-FLUTTER_OUTPUT = "macos"
+BUILD_FLAG = "debug"
+CROSS_PLATFORM = "macos"
+FLUTTER_OUTPUT_DIR = "Debug"
[env.production-mac]
DEV = false
@@ -26,32 +28,36 @@ PROD = true
TARGET_OS = "macos"
DESKTOP_TARGET = "x86_64-apple-darwin"
crate_type = "cdylib"
-LIB_OUT_DIR = "release"
-FLUTTER_OUTPUT = "macos"
+BUILD_FLAG = "release"
+CROSS_PLATFORM = "macos"
+FLUTTER_OUTPUT_DIR = "Release"
[env.production-ios]
DEV = false
PROD = true
TARGET_OS = "ios"
crate_type = "staticlib"
-LIB_OUT_DIR = "release"
-FLUTTER_OUTPUT = "ios"
+BUILD_FLAG = "release"
+CROSS_PLATFORM = "ios"
+FLUTTER_OUTPUT_DIR = "Release"
[env.production-android]
DEV = false
PROD = true
TARGET_OS = "android"
crate_type = "cdylib"
-LIB_OUT_DIR = "release"
-FLUTTER_OUTPUT = "apk"
+BUILD_FLAG = "release"
+CROSS_PLATFORM = "apk"
+FLUTTER_OUTPUT_DIR = "Release"
[env.production-win]
DEV = false
PROD = true
TARGET_OS = "windows"
crate_type = "cdylib"
-LIB_OUT_DIR = "release"
-FLUTTER_OUTPUT = "apk"
+BUILD_FLAG = "release"
+CROSS_PLATFORM = "apk"
+FLUTTER_OUTPUT_DIR = "Release"
[tasks.setup-crate-type]
private = true
diff --git a/app_flowy/.gitignore b/app_flowy/.gitignore
index 5e1f60bed8..efabc96754 100644
--- a/app_flowy/.gitignore
+++ b/app_flowy/.gitignore
@@ -46,4 +46,7 @@ app.*.map.json
/android/app/release
/packages/flowy_protobuf
-/packages/flutter-quill
\ No newline at end of file
+/packages/flutter-quill
+
+product/Release
+product/Debug
\ No newline at end of file
diff --git a/app_flowy/product/README.md b/app_flowy/product/README.md
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/scripts/build_sdk.sh b/scripts/build_sdk.sh
index 6591eed8d2..d2862b3a58 100755
--- a/scripts/build_sdk.sh
+++ b/scripts/build_sdk.sh
@@ -12,5 +12,5 @@ rustup show
# 2. ~/.bashrc
# 3. ~/.profile
# 4. ~/.zshrc
-cargo make desktop
+cargo make --profile development-mac flowy-sdk
#cargo make gen_dart_event
\ No newline at end of file
diff --git a/scripts/makefile/desktop.toml b/scripts/makefile/desktop.toml
index d60807518e..ce46d8f5bf 100644
--- a/scripts/makefile/desktop.toml
+++ b/scripts/makefile/desktop.toml
@@ -3,40 +3,49 @@
[tasks.flowy-sdk]
category = "Build"
condition = { profiles = [ "development-mac" ], channels = ["nightly"] }
-run_task = { name = ["setup-crate-type","sdk_build", "post-desktop", "restore-crate-type"] }
+dependencies = ["flowy-sdk-build"]
+run_task = { name = ["copy-to-sys-tmpdir"] }
-[tasks.flowy-sdk-release]
+[tasks.flowy-sdk-build]
condition = { channels = ["nightly"] }
-run_task = "sdk_build"
+run_task = { name = ["setup-crate-type","sdk_build", "post-desktop", "restore-crate-type"] }
[tasks.sdk_build]
-condition = { platforms = ["mac"], env_true = ["DEV"] }
+condition = { platforms = ["mac"] }
description = "Build desktop targets."
script = [
"""
cd rust-lib/
- cargo build --package=dart-ffi --target ${DESKTOP_TARGET} --features="observable","http_server"
+ cargo build --${BUILD_FLAG} --package=dart-ffi --target ${DESKTOP_TARGET} --features="observable","http_server"
cd ../
""",
]
[tasks.post-desktop]
+private = true
condition = { platforms = ["mac"] }
script = [
"""
echo "πŸš€ πŸš€ πŸš€ Flowy-SDK build success"
- cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/x86_64-apple-darwin/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib \
+ cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/x86_64-apple-darwin/${BUILD_FLAG}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib \
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages/flowy_sdk/macos/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib
""",
"""
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/binding.h \
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages/flowy_sdk/macos/Classes/binding.h
""",
+]
+script_runner = "@duckscript"
+
+[tasks.copy-to-sys-tmpdir]
+private = true
+condition = { platforms = ["mac"] }
+script = [
"""
# post the dylib target_path that use for flutter unit test
target_path = set ${TMPDIR}/appflowy_client/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib
rm ${target_path}
- cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/x86_64-apple-darwin/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib ${target_path}
+ cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/x86_64-apple-darwin/${BUILD_FLAG}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib ${target_path}
""",
]
script_runner = "@duckscript"
diff --git a/scripts/makefile/flutter.toml b/scripts/makefile/flutter.toml
index bea7f047f0..5396e31bf9 100644
--- a/scripts/makefile/flutter.toml
+++ b/scripts/makefile/flutter.toml
@@ -1,15 +1,40 @@
-[tasks.flowy-macos-ui]
+[tasks.flowy-macos]
+dependencies = ["flowy-sdk-build"]
+run_task = { name = ["flutter-build", "copy-to-product"] }
+script_runner = "@shell"
+
+[tasks.flutter-build]
script = [
"""
- flutter clean
- flutter pub get
- flutter build macos --release
- flowy-sdk-release
+ cd app_flowy/
+# flutter clean
+# flutter pub get
+# flutter build ${CROSS_PLATFORM} --${BUILD_FLAG}
+ """,
+]
+script_runner = "@shell"
+
+
+[tasks.copy-to-product]
+script = [
+ """
+ product_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product
+ output_path=${product_path}/${FLUTTER_OUTPUT_DIR}
+ if [ -d "${output_path}" ]; then
+ rm -rf ${output_path}/
+ fi
+
+ cd ${product_path}
+ mkdir ${FLUTTER_OUTPUT_DIR}
+
+ cp -R ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/build/${CROSS_PLATFORM}/Build/Products/${FLUTTER_OUTPUT_DIR}/app_flowy.app \
+ ${output_path}/app_flowy.app
""",
]
script_runner = "@shell"
+
[tasks.freeze_setup]
script = [
"""