LYR-PKG0005
one package name read from two sources
Reported when the graph asks for a package of one name from two sources — two directories, two repositories, two revisions, or two versions of different lines — and the root's [override] does not pick one.
Explanation
A program holds one package of each name. Versions of one line of one repository are one package, and the build takes the greatest asked for; any other second source is a conflict the toolchain does not resolve by itself, because either choice could break the package that asked for the other.
Make the dependencies agree, or pick the one in the root manifest: [override] geo = { path = "…" } is read wherever the graph asks for geo.
Wrong
//- lyric.toml
[package]
name = "app"
version = "0.1.0"
[dependencies]
geo = { path = "libs/geo" }
map = { path = "libs/map" }
//- 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;
}
//- libs/map/lyric.toml
[package]
name = "map"
version = "1.0.0"
[dependencies]
geo = { path = "../geo2" }
//- libs/geo2/lyric.toml
[package]
name = "geo"
version = "2.0.0"
//- libs/geo2/src/lib.lyr
pub fn area(r: int): int {
return 3 * r * r;
}
//- libs/map/src/lib.lyr
import geo { area };
pub fn tiles(r: int): int {
return area(r) / 2;
}
//- src/main.lyr
import geo { area };
import map { tiles };
fn main(): void {
let _ = area(2) + tiles(2);
}
Right
//- lyric.toml
[package]
name = "app"
version = "0.1.0"
[override]
geo = { path = "libs/geo" }
[dependencies]
geo = { path = "libs/geo" }
map = { path = "libs/map" }
//- 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;
}
//- libs/map/lyric.toml
[package]
name = "map"
version = "1.0.0"
[dependencies]
geo = { path = "../geo2" }
//- libs/geo2/lyric.toml
[package]
name = "geo"
version = "2.0.0"
//- libs/geo2/src/lib.lyr
pub fn area(r: int): int {
return 3 * r * r;
}
//- libs/map/src/lib.lyr
import geo { area };
pub fn tiles(r: int): int {
return area(r) / 2;
}
//- src/main.lyr
import geo { area };
import map { tiles };
fn main(): void {
let _ = area(2) + tiles(2);
}