Lyricdev
GitHub

LYR-PKG0010

packages that depend on each other in a cycle

error ยท spec 15-project

Reported when a package of the graph depends on itself, directly or through others. The message gives the cycle's path, app -> geo -> app, and points at the dependency that closes it.

Explanation

A package's dependencies are built before it, and a cycle has no first package. Two packages that need each other are one package, or need a third that holds what they share.

Remove the dependency that closes the cycle: move what both need into one of them, or into a package of its own.

Wrong

//- lyric.toml
[package]
name = "app"
version = "0.1.0"

[dependencies]
geo = { path = "libs/geo" }
//- libs/geo/lyric.toml
[package]
name = "geo"
version = "1.0.0"

[dependencies]
app = { path = "../.." }
//- libs/geo/src/lib.lyr
pub fn area(r: int): int {
    return 3 * r * r;
}
//- src/main.lyr
import geo { area };

fn main(): void {
    let _ = area(2);
}
//- lyric.toml
[package]
name = "app"
version = "0.1.0"

[dependencies]
geo = { path = "libs/geo" }
//- libs/geo/lyric.toml
[package]
name = "geo"
version = "1.0.0"
//- libs/geo/src/lib.lyr
pub fn area(r: int): int {
    return 3 * r * r;
}
//- src/main.lyr
import geo { area };

fn main(): void {
    let _ = area(2);
}