ignore the absence of a Pkg-Config file

This commit is contained in:
Folkert 2020-11-08 00:12:15 +01:00
parent 2abdbaae7d
commit e516a0aebb

View file

@ -43,6 +43,9 @@ use std::time::{Duration, SystemTime};
/// Filename extension for normal Roc modules /// Filename extension for normal Roc modules
const ROC_FILE_EXTENSION: &str = "roc"; const ROC_FILE_EXTENSION: &str = "roc";
/// Roc-Config file name
const ROC_CONFIG_FILE_NAME: &str = "Pkg-Config";
/// The . in between module names like Foo.Bar.Baz /// The . in between module names like Foo.Bar.Baz
const MODULE_SEPARATOR: char = '.'; const MODULE_SEPARATOR: char = '.';
@ -1736,7 +1739,7 @@ fn load_pkg_config<'a>(
let mut filename = PathBuf::from(src_dir); let mut filename = PathBuf::from(src_dir);
filename.push("platform"); filename.push("platform");
filename.push("Pkg-Config"); filename.push(ROC_CONFIG_FILE_NAME);
// End with .roc // End with .roc
filename.set_extension(ROC_FILE_EXTENSION); filename.set_extension(ROC_FILE_EXTENSION);
@ -1897,18 +1900,27 @@ fn parse_header<'a>(
module_timing, module_timing,
); );
let load_pkg_config_msg = load_pkg_config( let mut pkg_config_roc = pkg_config_dir.clone();
arena, pkg_config_roc.push("platform");
&pkg_config_dir, pkg_config_roc.push(ROC_CONFIG_FILE_NAME);
module_ids, pkg_config_roc.set_extension(ROC_FILE_EXTENSION);
ident_ids_by_module,
mode,
)?;
Ok(( if pkg_config_roc.as_path().exists() {
module_id, let load_pkg_config_msg = load_pkg_config(
Msg::Many(vec![app_module_header_msg, load_pkg_config_msg]), arena,
)) &pkg_config_dir,
module_ids,
ident_ids_by_module,
mode,
)?;
Ok((
module_id,
Msg::Many(vec![app_module_header_msg, load_pkg_config_msg]),
))
} else {
Ok((module_id, app_module_header_msg))
}
} }
Ok((ast::Module::Platform { header }, _parse_state)) => fabricate_effects_module( Ok((ast::Module::Platform { header }, _parse_state)) => fabricate_effects_module(
arena, arena,