From 9506860a9f80f7f73f3a1408d72401da235f7ad5 Mon Sep 17 00:00:00 2001 From: "evgeny.bovykin" Date: Thu, 10 Oct 2024 12:09:04 +0200 Subject: [PATCH] Fix tests --- pilota-build/src/codegen/mod.rs | 18 +++++++++++++++--- .../output/Cargo.toml | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pilota-build/src/codegen/mod.rs b/pilota-build/src/codegen/mod.rs index 741767dd..09b73899 100644 --- a/pilota-build/src/codegen/mod.rs +++ b/pilota-build/src/codegen/mod.rs @@ -507,9 +507,21 @@ where file.flush().unwrap(); fmt_file(full_path); - stream.push_str( - format!("include!(\"{}\");\n", file_name).as_str(), - ); + match &*this.mode { + Mode::Workspace(_) => { + stream.push_str( + format!("include!(\"{}\");\n", file_name).as_str(), + ); + }, + + Mode::SingleFile { .. } => { + let base_dir_local_path = base_dir.iter().last().unwrap().to_str().unwrap(); + + stream.push_str( + format!("include!(\"{}/{}\");\n", base_dir_local_path, file_name).as_str(), + ); + } + } } else { this.write_item(&mut stream, *def_id, &mut dup) } diff --git a/pilota-build/test_data/thrift_workspace_with_split/output/Cargo.toml b/pilota-build/test_data/thrift_workspace_with_split/output/Cargo.toml index cf98ef15..f88e4700 100644 --- a/pilota-build/test_data/thrift_workspace_with_split/output/Cargo.toml +++ b/pilota-build/test_data/thrift_workspace_with_split/output/Cargo.toml @@ -1,7 +1,7 @@ [workspace] members = [ "article", - "author", + "author", "common", "image", ]