Skip to content

Commit

Permalink
Fix cyclic crate dependency #2
Browse files Browse the repository at this point in the history
Relocate a tests file to avoid a cyclic dependency:

    spk_schema -> spk_schema_validators -> spk_schema (dev)

Signed-off-by: J Robert Ray <jrray@jrray.org>
  • Loading branch information
jrray committed Jul 19, 2023
1 parent f1ae853 commit db541a3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions crates/spk-schema/crates/validators/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,3 @@ sys-info = "0.9.0"
tempdir = "0.3.7"
thiserror = { workspace = true }
tracing = { workspace = true }

[dev-dependencies]
spk-schema = { path = "../.." }
5 changes: 2 additions & 3 deletions crates/spk-schema/crates/validators/src/validators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ use spk_schema_ident::BuildIdent;

use crate::{Error, Result};

#[cfg(test)]
#[path = "./validators_test.rs"]
mod validators_test;
// Tests for this module are in spk-schema/src/v0/validators_test.rs to avoid
// a cyclic crate dependency (the tests need spk_schema::v0).

/// Validates that all remaining build files are collected into at least one component
pub fn must_collect_all_files<'a, Files>(
Expand Down
4 changes: 4 additions & 0 deletions crates/spk-schema/src/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ mod variant;
pub use spec::Spec;
pub use test_spec::TestSpec;
pub use variant::Variant;

#[cfg(test)]
#[path = "./validators_test.rs"]
mod validators_test;
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
// https://github.com/imageworks/spk

use spk_schema::v0;
use spk_schema_validators::{must_install_something, must_not_alter_existing_files};

use super::{must_install_something, must_not_alter_existing_files};
use crate::v0;
use crate::validators::must_collect_all_files;

#[test]
Expand Down

0 comments on commit db541a3

Please sign in to comment.