fix(build): split path types in compile (#721)

BREAKING: Build paths now accept two different types
This commit is contained in:
LOU Xun
2021-10-20 10:46:28 -04:00
committed by GitHub
parent 7d024e292b
commit 53ecc1f85e
+9 -11
View File
@@ -381,24 +381,22 @@ impl Builder {
} }
/// Compile the .proto files and execute code generation. /// Compile the .proto files and execute code generation.
pub fn compile<P>(self, protos: &[P], includes: &[P]) -> io::Result<()> pub fn compile(
where self,
P: AsRef<Path>, protos: &[impl AsRef<Path>],
{ includes: &[impl AsRef<Path>],
) -> io::Result<()> {
self.compile_with_config(Config::new(), protos, includes) self.compile_with_config(Config::new(), protos, includes)
} }
/// Compile the .proto files and execute code generation using a /// Compile the .proto files and execute code generation using a
/// custom `prost_build::Config`. /// custom `prost_build::Config`.
pub fn compile_with_config<P>( pub fn compile_with_config(
self, self,
mut config: Config, mut config: Config,
protos: &[P], protos: &[impl AsRef<Path>],
includes: &[P], includes: &[impl AsRef<Path>],
) -> io::Result<()> ) -> io::Result<()> {
where
P: AsRef<Path>,
{
let out_dir = if let Some(out_dir) = self.out_dir.as_ref() { let out_dir = if let Some(out_dir) = self.out_dir.as_ref() {
out_dir.clone() out_dir.clone()
} else { } else {