AppFlowy/frontend/scripts/makefile/protobuf.toml
Alex to 172e1ab1de [Instruction] Slightly update steps of BUILD_ON_WINDOWS.md
1. doc\BUILD_ON_WINDOWS.md
  - rustup.exe with parameter to install rust without prompt
2. frontend/scripts/makefile/protobuf.toml
  - add a sub task to check if protoc is presented in PATH
2021-11-28 20:34:03 +08:00

95 lines
2.9 KiB
TOML

[tasks.pb]
dependencies = ["check_protoc_cmd", "gen_pb_file"]
[tasks.check_protoc_cmd]
script = [
"""
ret = which protoc
if is_empty ${ret}
echo Please make sure <protoc_installation_folder>/bin/ is in PATH env var
echo See BUILD_ON_{LINUX|WINDOWS}.md for how to get protoc
exit -1
end
""",
]
script_runner = "@duckscript"
[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
shared_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/../shared-lib
flutter_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
derive_meta=${shared_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_pb_file.windows]
script = [
"""
flowy_tool=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
rust_source=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
# rust_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib
shared_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/../shared-lib
flutter_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
derive_meta=set ${shared_lib}/flowy-derive/src/derive_cache/derive_cache.rs
flutter_package_lib=set ${flutter_lib}/flowy_sdk/lib
exec cmd /c cargo run \
--manifest-path ${flowy_tool} pb-gen \
--rust_source=${rust_source} \
--derive_meta=${derive_meta} \
--flutter_package_lib=${flutter_package_lib}
""",
]
script_runner = "@duckscript"
[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"
[tasks.gen_dart_event.windows]
script = [
"""
flowy_tool=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
flutter_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
rust_source=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
output=set ${flutter_lib}/flowy_sdk/lib/dispatch/code_gen.dart
exec cmd.exe /c cargo run \
--manifest-path ${flowy_tool} dart-event \
--rust_source=${rust_source} \
--output=${output}
""",
]
script_runner = "@duckscript"