Browse Source

chore: cache dart_event.dart file

appflowy 3 years ago
parent
commit
afd8335e95

+ 1 - 1
.run/dart-event.run.xml

@@ -1,6 +1,6 @@
 <component name="ProjectRunConfigurationManager">
   <configuration default="false" name="dart-event" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
-    <option name="command" value="run --manifest-path $PROJECT_DIR$/scripts/flowy-tool/Cargo.toml -- dart-event --rust_source=$PROJECT_DIR$/rust-lib/  --output=$PROJECT_DIR$/app_flowy/packages/flowy_sdk/lib/dispatch/code_gen.dart" />
+    <option name="command" value="run --manifest-path $PROJECT_DIR$/scripts/flowy-tool/Cargo.toml -- dart-event --rust_source=$PROJECT_DIR$/rust-lib/  --output=$PROJECT_DIR$/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event.dart" />
     <option name="workingDirectory" value="file://$PROJECT_DIR$" />
     <option name="channel" value="DEFAULT" />
     <option name="allFeatures" value="false" />

+ 0 - 0
frontend/app_flowy/packages/flowy_sdk/lib/dispatch/code_gen.dart → frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event.dart


+ 1 - 1
frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dispatch.dart

@@ -27,7 +27,7 @@ import 'package:protobuf/protobuf.dart';
 import 'dart:convert' show utf8;
 import 'error.dart';
 
-part 'code_gen.dart';
+part 'dart_event.dart';
 
 enum FFIException {
   RequestIsEmpty,

+ 2 - 1
frontend/rust-lib/dart-ffi/build.rs

@@ -11,6 +11,7 @@ fn main() {
 fn copy_dart_event_files() {
     let workspace_dir = std::env::var("CARGO_MAKE_WORKING_DIRECTORY").unwrap();
     let flutter_sdk_path = std::env::var("FLUTTER_FLOWY_SDK_PATH").unwrap();
-    let output_file = format!("{}/{}/lib/dispatch/code_gen.dart", workspace_dir, flutter_sdk_path);
+    let output_file = format!("{}/{}/lib/dispatch/dart_event.dart", workspace_dir, flutter_sdk_path);
+    println!("cargo:rerun-if-changed={}", output_file);
     dart_event::write_dart_event_file(&output_file);
 }

+ 2 - 2
frontend/scripts/makefile/protobuf.toml

@@ -107,7 +107,7 @@ script = [
     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
+    output=${flutter_lib}/flowy_sdk/lib/dispatch/dart_event.dart
 
     cargo run \
      --manifest-path ${flowy_tool} dart-event \
@@ -124,7 +124,7 @@ script = [
     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
+    output=set ${flutter_lib}/flowy_sdk/lib/dispatch/dart_event.dart
 
     exec cmd.exe /c cargo run \
      --manifest-path ${flowy_tool} dart-event \