Closed MattesWhite closed 4 years ago
I see where this comes from; a student of mine also had a dependency problem when he pulled the commit splitting sophia in two distinct crates. However, I don't think this PR is the correct way to solve it.
First: I don't know how the path
hack in sophia/Cargo.toml
will behave once published on crates.io, but I'm guessing not very well.
Second: I wish to keep the version numbers of all sophia crates aligned, (at least on the first two components). This will make maintenance much easier (even though it might seem strange for sophia-term to begin its life at version 0.4.0... :wink:)
The clean solution to your problem, I think, is to add the following section to your Cargo.toml
:
[patch.crates-io]
sophia-term = { git = 'https://github.com/pchampin/sophia_rs' }
This instuct cargo to look for sophia-term in the git repo, whoever asks for it (including sophia itself).
We found this solution here: https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html
Does this solve your problem?
Ok, PRs are much faster committed then they should :wink: .
After further research we are both right. In order to use the newest version of sophia
in metis
I'll add the patch-section to my Cargo.toml
. However, the path
should also be added to sophia/Cargo.toml
. It allows you to work with the local version of sophia_term
during development once the (sub-)crate is published.
Regarding the version of sophia_term
I thought this might be a copy'n'paste error. As this is intentional I will not argue about versioning.
Accordingly, you can either close this PR or I'll remove the changes at term/Cargo.toml
in an additional commit and you can squash the commits.
However, the
path
should also be added tosophia/Cargo.toml
. It allows you to work with the local version ofsophia_term
during development once the (sub-)crate is published.
Awesome, thanks for doing the research ;-) I'll do this right away.
FTR, from a few tests that I just made :
path = "../term"
in sophia/Cargo.toml
solves the problem for local installations only (i.e. when your Cargo.toml
specifies a path
for sophia);Cargo.toml
uses git = "..."
(even with a local git repo), you seem to need the patch.crates.io
directive.So both solve slightly different problems.
As 'sophia_term' is not yet published, the dependency in
sophia/Cargo.toml
throughs an error if a crate depends onsophia
's git. Fixed by adding a relative path.In addition, set version of 'sophia_term' to 0.1.0 as it is a new crate.