Skip to content

Commit

Permalink
fix(build): split path types in compile (#721)
Browse files Browse the repository at this point in the history
BREAKING: Build paths now accept two different types
  • Loading branch information
aquarhead committed Oct 20, 2021
1 parent 7d024e2 commit 53ecc1f
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tonic-build/src/prost.rs
Expand Up @@ -381,24 +381,22 @@ impl Builder {
}

/// Compile the .proto files and execute code generation.
pub fn compile<P>(self, protos: &[P], includes: &[P]) -> io::Result<()>
where
P: AsRef<Path>,
{
pub fn compile(
self,
protos: &[impl AsRef<Path>],
includes: &[impl AsRef<Path>],
) -> io::Result<()> {
self.compile_with_config(Config::new(), protos, includes)
}

/// Compile the .proto files and execute code generation using a
/// custom `prost_build::Config`.
pub fn compile_with_config<P>(
pub fn compile_with_config(
self,
mut config: Config,
protos: &[P],
includes: &[P],
) -> io::Result<()>
where
P: AsRef<Path>,
{
protos: &[impl AsRef<Path>],
includes: &[impl AsRef<Path>],
) -> io::Result<()> {
let out_dir = if let Some(out_dir) = self.out_dir.as_ref() {
out_dir.clone()
} else {
Expand Down

0 comments on commit 53ecc1f

Please sign in to comment.