Skip to content

Commit

Permalink
fix: do not build proto if api feature not present
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Bühler committed Jan 10, 2023
1 parent ea04fd6 commit 627ed2f
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,22 @@ const NON_CLIENT_PROTOS: &[&str; 21] = &[
];

fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("cargo:rerun-if-changed=external/zitadel/proto");
println!("cargo:rerun-if-changed=external/protoc-gen-validate");
println!("cargo:rerun-if-changed=external/googleapis");
println!("cargo:rerun-if-changed=external/grpc-gateway");
#[cfg(feature = "api")]
{
println!("cargo:rerun-if-changed=external/zitadel/proto");
println!("cargo:rerun-if-changed=external/protoc-gen-validate");
println!("cargo:rerun-if-changed=external/googleapis");
println!("cargo:rerun-if-changed=external/grpc-gateway");

tonic_build::configure()
.build_server(false)
.build_client(false)
.compile(NON_CLIENT_PROTOS, INCLUDES)?;
tonic_build::configure()
.build_server(false)
.build_client(true)
.compile(CLIENT_PROTOS, INCLUDES)?;
tonic_build::configure()
.build_server(false)
.build_client(false)
.compile(NON_CLIENT_PROTOS, INCLUDES)?;
tonic_build::configure()
.build_server(false)
.build_client(true)
.compile(CLIENT_PROTOS, INCLUDES)?;
}

Ok(())
}

0 comments on commit 627ed2f

Please sign in to comment.