Skip to content

Commit db541a3

Browse files
committed
Fix cyclic crate dependency #2
Relocate a tests file to avoid a cyclic dependency: spk_schema -> spk_schema_validators -> spk_schema (dev) Signed-off-by: J Robert Ray <[email protected]>
1 parent f1ae853 commit db541a3

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/spk-schema/crates/validators/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,3 @@ sys-info = "0.9.0"
2929
tempdir = "0.3.7"
3030
thiserror = { workspace = true }
3131
tracing = { workspace = true }
32-
33-
[dev-dependencies]
34-
spk-schema = { path = "../.." }

crates/spk-schema/crates/validators/src/validators.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ use spk_schema_ident::BuildIdent;
1111

1212
use crate::{Error, Result};
1313

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

1817
/// Validates that all remaining build files are collected into at least one component
1918
pub fn must_collect_all_files<'a, Files>(

crates/spk-schema/src/v0/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ mod variant;
99
pub use spec::Spec;
1010
pub use test_spec::TestSpec;
1111
pub use variant::Variant;
12+
13+
#[cfg(test)]
14+
#[path = "./validators_test.rs"]
15+
mod validators_test;

crates/spk-schema/crates/validators/src/validators_test.rs renamed to crates/spk-schema/src/v0/validators_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// SPDX-License-Identifier: Apache-2.0
33
// https://github.com/imageworks/spk
44

5-
use spk_schema::v0;
5+
use spk_schema_validators::{must_install_something, must_not_alter_existing_files};
66

7-
use super::{must_install_something, must_not_alter_existing_files};
7+
use crate::v0;
88
use crate::validators::must_collect_all_files;
99

1010
#[test]

0 commit comments

Comments
 (0)