Skip to content

Commit 6b184d6

Browse files
authored
Add a warning that provides more context when a bundled build from source fails (#22)
* Added a warning/error message that provides more context when a build fails when building from source with the bundled feature flag. * Moved message to the point where the directory is copied, and made it a hard error * Switch panic! to bail!
1 parent 8c0db0b commit 6b184d6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

webrtc-audio-processing-sys/build.rs

+8
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ mod webrtc {
5555
#[cfg(feature = "bundled")]
5656
mod webrtc {
5757
use super::*;
58+
5859
const BUNDLED_SOURCE_PATH: &str = "./webrtc-audio-processing";
5960

6061
pub(super) fn get_build_paths() -> Result<(PathBuf, PathBuf), Error> {
@@ -66,6 +67,13 @@ mod webrtc {
6667
fn copy_source_to_out_dir() -> Result<PathBuf, Error> {
6768
use fs_extra::dir::CopyOptions;
6869

70+
if Path::new(BUNDLED_SOURCE_PATH).read_dir()?.next().is_none() {
71+
eprintln!("The webrtc-audio-processing source directory is empty.");
72+
eprintln!("See the crate README for installation instructions.");
73+
eprintln!("Remember to clone the repo recursively if building from source.");
74+
bail!("Aborting compilation because bundled source directory is empty.");
75+
}
76+
6977
let out_dir = out_dir();
7078
let mut options = CopyOptions::new();
7179
options.overwrite = true;

0 commit comments

Comments
 (0)