Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub fn main() -> Result<()> {
.collect();

if suppressed_warnings.contains("all") || suppressed_warnings.contains("Wall") {
suppressed_warnings.extend((1..23).map(|i| format!("W{:02}", i)));
suppressed_warnings.extend((1..24).map(|i| format!("W{:02}", i)));
}

// Enable debug outputs if needed.
Expand Down
3 changes: 1 addition & 2 deletions src/cmd/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ pub fn run(sess: &Session, matches: &ArgMatches) -> Result<()> {
});
}

// Flatten and validate the sources.
let mut srcs = srcs.validate("", false, &sess.suppress_warnings)?;
srcs = srcs.validate("", false, &sess.suppress_warnings)?;

let mut target_defines: IndexMap<String, Option<String>> = IndexMap::new();
target_defines.extend(
Expand Down
13 changes: 12 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,18 @@ 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 !(suppress_warnings.contains("W24")
|| pre_output
|| parsed_path.exists() && parsed_path.is_dir())
{
warnln!(
"[W24] Include directory {} doesn't exist.",
&parsed_path.display()
);
}
Some(Ok(parsed_path))
}
Err(cause) => {
if suppress_warnings.contains("E30") {
if !suppress_warnings.contains("W30") {
Expand Down
40 changes: 33 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_ng::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,26 @@ impl<'io, 'sess: 'io, 'ctx: 'sess> SessionIo<'sess, 'ctx> {
Err(e) => Err(e),
}
} else {
if !(self.sess.suppress_warnings.contains("E32")
&& self.sess.suppress_warnings.contains("W32"))
{
if let DepSrc::Path(ref path) = dep.source {
if !path.exists() {
if self.sess.suppress_warnings.contains("E32") {
warnln!(
"[W32] Path {:?} for dependency {:?} does not exist.",
path,
dep.name
);
} else {
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
10 changes: 10 additions & 0 deletions src/src.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ impl<'ctx> Validate for SourceGroup<'ctx> {
.into_iter()
.map(|f| f.validate(package_name, pre_output, suppress_warnings))
.collect::<Result<Vec<_>, Error>>()?,
include_dirs: self
.include_dirs
.into_iter()
.map(|p| {
if !(suppress_warnings.contains("W24") || p.exists() && p.is_dir()) {
warnln!("[W24] Include directory {} doesn't exist.", p.display());
}
Ok(p)
})
.collect::<Result<IndexSet<_>, Error>>()?,
..self
})
}
Expand Down