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.

ci: add logs

appflowy832db7341071
diff --git a/frontend/scripts/makefile/protobuf.toml b/frontend/scripts/makefile/protobuf.toml
index e60b67b99d..6c4334bd66 100644
--- a/frontend/scripts/makefile/protobuf.toml
+++ b/frontend/scripts/makefile/protobuf.toml
@@ -25,6 +25,7 @@ brew install protobuf
echo "Install protoc_plugin (Dart)"
dart pub global activate protoc_plugin
+export PATH="$PATH":"$HOME/.pub-cache/bin"
"""
script_runner = "@shell"
@@ -34,6 +35,7 @@ sudo apt-get install protobuf-compiler
echo "Install protoc_plugin (Dart)"
dart pub global activate protoc_plugin
+export PATH="$PATH":"$HOME/.pub-cache/bin"
"""
script_runner = "@shell"
diff --git a/shared-lib/lib-infra/src/pb_gen.rs b/shared-lib/lib-infra/src/pb_gen.rs
index 4ca1a88c20..33e2179b0a 100644
--- a/shared-lib/lib-infra/src/pb_gen.rs
+++ b/shared-lib/lib-infra/src/pb_gen.rs
@@ -1,7 +1,10 @@
+#![allow(clippy::all)]
#![allow(unused_imports)]
#![allow(unused_attributes)]
+#![allow(dead_code)]
use std::fs::File;
use std::io::Write;
+use std::process::Command;
use walkdir::WalkDir;
pub fn gen(name: &str, root: &str) {
@@ -19,6 +22,7 @@ pub fn gen(name: &str, root: &str) {
file_names.push(file_name);
}
}
+ println!("cargo:rerun-if-changed=build.rs");
#[cfg(feature = "dart")]
gen_pb_for_dart(name, root, &paths, &file_names);
@@ -32,7 +36,6 @@ pub fn gen(name: &str, root: &str) {
}
#[cfg(feature = "dart")]
-#[allow(dead_code)]
fn gen_pb_for_dart(name: &str, root: &str, paths: &Vec<String>, file_names: &Vec<String>) {
let output = format!(
"{}/{}/{}",
@@ -43,6 +46,10 @@ fn gen_pb_for_dart(name: &str, root: &str, paths: &Vec<String>, file_names: &Vec
if !std::path::Path::new(&output).exists() {
std::fs::create_dir_all(&output).unwrap();
}
+ check_pb_compiler();
+
+ check_pb_dart_plugin();
+
paths.iter().for_each(|path| {
if cmd_lib::run_cmd! {
protoc --dart_out=${output} --proto_path=${root} ${path}
@@ -77,3 +84,31 @@ fn gen_pb_for_dart(name: &str, root: &str, paths: &Vec<String>, file_names: &Vec
}
}
}
+
+fn check_pb_compiler() {
+ assert!(run_command("command -v protoc"), "protoc was not installed correctly");
+}
+
+fn check_pb_dart_plugin() {
+ assert!(
+ run_command("command -v protoc-gen-dart"),
+ "protoc-gen-dart was not installed correctly"
+ );
+}
+
+fn run_command(cmd: &str) -> bool {
+ let output = if cfg!(target_os = "windows") {
+ Command::new("cmd")
+ .arg("/C")
+ .arg(cmd)
+ .status()
+ .expect("failed to execute process")
+ } else {
+ Command::new("sh")
+ .arg("-c")
+ .arg(cmd)
+ .status()
+ .expect("failed to execute process")
+ };
+ output.success()
+}