fn main() -> Result<(), Box> { let serde = "#[derive(serde::Serialize, serde::Deserialize)]"; tonic_prost_build::configure() .build_server(true) .file_descriptor_set_path("src/proto/descriptor.bin") .out_dir("src/proto") // These packages cross the native-client boundary. Keeping the derives // here makes the root common crate usable by TUI and Tauri alike. .type_attribute(".komp_ac.accounting", serde) .type_attribute(".komp_ac.analytics", serde) .type_attribute(".komp_ac.auth", serde) .type_attribute(".komp_ac.document_data", serde) .type_attribute( ".komp_ac.document_data.TypstTemplateVersion", "#[derive(Eq)]", ) .type_attribute(".komp_ac.ecb", serde) .type_attribute(".komp_ac.exchange_rates", serde) .type_attribute(".komp_ac.search", serde) .type_attribute(".komp_ac.search2", serde) .type_attribute(".komp_ac.table_definition", serde) .type_attribute(".komp_ac.table_script", serde) .type_attribute(".komp_ac.table_structure", serde) .type_attribute(".komp_ac.table_validation", serde) // tables_data requests contain prost_types::Value, which does not // implement Serde. Only response-side types cross into the GUI. .type_attribute(".komp_ac.tables_data.PostTableDataResponse", serde) .type_attribute(".komp_ac.tables_data.PutTableDataResponse", serde) .type_attribute(".komp_ac.tables_data.TableUpdateImpactResponse", serde) .type_attribute(".komp_ac.tables_data.ArchiveTableDataResponse", serde) .type_attribute(".komp_ac.tables_data.DeleteTableDataResponse", serde) .type_attribute(".komp_ac.tables_data.ResolvedTableLinkVersion", serde) .type_attribute(".komp_ac.tables_data.ResolvedTableLinkUpdate", serde) .type_attribute(".komp_ac.tables_data.ResolvedTableLink", serde) .type_attribute(".komp_ac.tables_data.GetTableDataResponse", serde) .type_attribute(".komp_ac.tables_data.RowNavigation", serde) .type_attribute(".komp_ac.tables_data.GetLastTableDataResponse", serde) .type_attribute(".komp_ac.tables_data.GetAdjacentTableDataResponse", serde) .type_attribute(".komp_ac.tables_data.ResolvedTableLinkStatus", serde) .type_attribute(".komp_ac.tables_data.RowNavigationMode", serde) .field_attribute( ".komp_ac.table_validation.FieldValidation.locked", "#[serde(default)]", ) .field_attribute( ".komp_ac.table_validation.UpdateFieldValidationRequest.update_mask", "#[serde(skip)]", ) .field_attribute( ".komp_ac.table_definition.ColumnDefinition.boolean_ledger", "#[serde(default, alias = \"boolean_ledger_operator\")]", ) .type_attribute( ".komp_ac.table_validation.CountMode", "#[serde(rename_all = \"SCREAMING_SNAKE_CASE\")]", ) .type_attribute( ".komp_ac.table_validation.PatternPositionKind", "#[serde(rename_all = \"SCREAMING_SNAKE_CASE\")]", ) .type_attribute( ".komp_ac.table_validation.CharacterConstraintKind", "#[serde(rename_all = \"SCREAMING_SNAKE_CASE\")]", ) .compile_protos( &[ "proto/accounting.proto", "proto/common.proto", "proto/document_data.proto", "proto/ecb.proto", "proto/exchange_rates.proto", "proto/analytics.proto", "proto/auth.proto", "proto/backup.proto", "proto/search.proto", "proto/search2.proto", "proto/table_definition.proto", "proto/table_script.proto", "proto/table_structure.proto", "proto/table_validation.proto", "proto/tables_data.proto", ], &["proto"], )?; println!("cargo:rerun-if-changed=build.rs"); for proto in [ "proto/accounting.proto", "proto/common.proto", "proto/document_data.proto", "proto/ecb.proto", "proto/exchange_rates.proto", "proto/analytics.proto", "proto/auth.proto", "proto/backup.proto", "proto/search.proto", "proto/search2.proto", "proto/table_definition.proto", "proto/table_script.proto", "proto/table_structure.proto", "proto/table_validation.proto", "proto/tables_data.proto", ] { println!("cargo:rerun-if-changed={proto}"); } Ok(()) }