Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,28 @@ impl Validate for PartialManifest {
export_include_dirs: exp_inc_dirs
.iter()
.filter_map(|path| match env_path_from_string(path.to_string()) {
Ok(parsed_path) => Some(Ok(parsed_path)),
Ok(parsed_path) => {
if (parsed_path.exists() && parsed_path.is_dir())
|| suppress_warnings.contains("E31")
|| pre_output
{
if !(parsed_path.exists() && parsed_path.is_dir())
&& !suppress_warnings.contains("W31")
&& !pre_output
{
warnln!(
"[W31] Include directory {} doesn't exist.",
&parsed_path.display()
);
}
Some(Ok(parsed_path))
} else {
Some(Err(Error::new(format!(
"[E31] Include directory {} doesn't exist",
&parsed_path.display()
))))
}
}
Err(cause) => {
if suppress_warnings.contains("E30") {
if !suppress_warnings.contains("W30") {
Expand Down Expand Up @@ -865,7 +886,19 @@ impl Validate for PartialSources {
.unwrap_or_default()
.iter()
.filter_map(|path| match env_path_from_string(path.to_string()) {
Ok(p) => Some(Ok(p)),
Ok(p) => {
if (p.exists() && p.is_dir()) || suppress_warnings.contains("E31") {
if !(p.exists() && p.is_dir()) && !suppress_warnings.contains("W31") {
warnln!("[W31] Include directory {} doesn't exist.", &p.display());
}
Some(Ok(p))
} else {
Some(Err(Error::new(format!(
"[E31] Include directory {} doesn't exist",
&p.display()
))))
}
}
Err(cause) => {
if suppress_warnings.contains("E30") {
if !suppress_warnings.contains("W30") {
Expand Down
30 changes: 23 additions & 7 deletions src/sess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ use tokio::sync::Semaphore;
use typed_arena::Arena;

use crate::cli::read_manifest;
//use crate::config::Validate;
use crate::config::{self, Config, Manifest};
use crate::config::{self, Config, Manifest, PartialManifest};
use crate::error::*;
use crate::git::Git;
use crate::src::SourceGroup;
Expand Down Expand Up @@ -1160,15 +1159,22 @@ impl<'io, 'sess: 'io, 'ctx: 'sess> SessionIo<'sess, 'ctx> {
.join(format!("{}_manifest.yml", dep.name))
.exists()
{
match read_manifest(
&self
.sess
let file = std::fs::File::open(
self.sess
.root
.join(".bender")
.join("tmp")
.join(format!("{}_manifest.yml", dep.name)),
&self.sess.suppress_warnings,
) {
)
.map_err(|cause| {
Error::chain(format!("Cannot open manifest {:?}.", path), cause)
})?;
let partial: PartialManifest =
serde_yaml::from_reader(file).map_err(|cause| {
Error::chain(format!("Syntax error in manifest {:?}.", path), cause)
})?;

match partial.validate_ignore_sources("", true, &self.sess.suppress_warnings) {
Ok(m) => {
if dep.name != m.package.name
&& !self.sess.suppress_warnings.contains("W11")
Expand All @@ -1181,6 +1187,16 @@ impl<'io, 'sess: 'io, 'ctx: 'sess> SessionIo<'sess, 'ctx> {
Err(e) => Err(e),
}
} else {
if !self.sess.suppress_warnings.contains("E32") {
if let DepSrc::Path(ref path) = dep.source {
if !path.exists() {
return Err(Error::new(format!(
"[E32] Path {:?} for dependency {:?} does not exist.",
path, dep.name
)));
}
}
}
if !self.sess.suppress_warnings.contains("W12") {
warnln!(
"[W12] Manifest not found for {:?} at {:?}",
Expand Down