AppFlowy/scripts/makefile/desktop.toml
2021-11-15 22:14:47 +08:00

59 lines
1.9 KiB
TOML

# cargo make --profile production task
[tasks.flowy-sdk]
category = "Build"
condition = { channels = ["nightly"] }
dependencies = ["flowy-sdk-build"]
run_task = { name = ["copy-to-sys-tmpdir"] }
[tasks.flowy-sdk-build]
dependencies = ["echo_env"]
condition = { env_set = [ "BUILD_FLAG", "RUST_COMPILE_TARGET", "CRATE_TYPE", "TARGET_OS"] }
run_task = { name = ["setup-crate-type","sdk-build", "post-desktop", "restore-crate-type"] }
[tasks.sdk-build]
description = "Build desktop targets."
script = [
"""
cd rust-lib/
if [ ${BUILD_FLAG} == release ]
then
cargo build --${BUILD_FLAG} --package=dart-ffi --target ${RUST_COMPILE_TARGET} --features=${FEATURES}
else
cargo build --package=dart-ffi --target ${RUST_COMPILE_TARGET} --features=${FEATURES}
fi
cd ../
""",
]
script_runner = "@shell"
[tasks.post-desktop]
private = true
script = [
"""
echo "🚀 🚀 🚀 Flowy-SDK build success"
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${RUST_COMPILE_TARGET}/${BUILD_FLAG}/lib${CARGO_MAKE_CRATE_FS_NAME}.${SDK_EXT} \
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages/flowy_sdk/macos/lib${CARGO_MAKE_CRATE_FS_NAME}.${SDK_EXT}
""",
"""
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 = { profiles = [ "development-mac" ], 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/${RUST_COMPILE_TARGET}/${BUILD_FLAG}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib ${target_path}
""",
]
script_runner = "@duckscript"