
[tasks.pb]
dependencies = ["gen_pb_file"]

[tasks.gen_pb_file]
script = [
    """
    flowy_tool=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
    rust_source=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
    rust_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib
    flutter_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages

    derive_meta=${rust_lib}/flowy-derive/src/derive_cache/derive_cache.rs
    flutter_package_lib=${flutter_lib}/flowy_sdk/lib

    cargo run \
     --manifest-path ${flowy_tool} pb-gen \
     --rust_source=${rust_source} \
     --derive_meta=${derive_meta} \
     --flutter_package_lib=${flutter_package_lib}
    """,
]
script_runner = "@shell"


[tasks.gen_dart_event]
script = [
    """
    flowy_tool=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
    flutter_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages

    rust_source=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
    output=${flutter_lib}/flowy_sdk/lib/dispatch/code_gen.dart

    cargo run \
     --manifest-path ${flowy_tool} dart-event \
     --rust_source=${rust_source} \
     --output=${output}
    """,
]
script_runner = "@shell"
