Skip to content

Commit

Permalink
Test and fix extraneous crate types
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed May 21, 2024
1 parent e445cb6 commit 35cf14e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,19 @@ fn build_dependencies_inner(config: &Config, info: &DependencyBuilder) -> Result
let mut import_paths: HashSet<PathBuf> = HashSet::new();
let mut import_libs: HashSet<PathBuf> = HashSet::new();
let mut artifacts = HashMap::new();
'artifact: for line in artifact_output.lines() {
for line in artifact_output.lines() {
let Ok(message) = serde_json::from_str::<cargo_metadata::Message>(line) else {
continue;
};
match message {
cargo_metadata::Message::CompilerArtifact(artifact) => {
for ctype in &artifact.target.crate_types {
match ctype.as_str() {
"proc-macro" | "lib" => {}
_ => continue 'artifact,
}
if artifact
.target
.crate_types
.iter()
.all(|ctype| !matches!(ctype.as_str(), "proc-macro" | "lib"))
{
continue;
}
for filename in &artifact.filenames {
import_paths.insert(filename.parent().unwrap().into());
Expand Down
4 changes: 4 additions & 0 deletions tests/integrations/basic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ harness = false
[[test]]
name = "run_file"
harness = true

# Regression check for #225
[lib]
crate-type = ["staticlib", "lib"]

0 comments on commit 35cf14e

Please sign in to comment.