Skip to content

fix references from Cargo.lock to Cargo.toml#18

Closed
joseluis wants to merge 1 commit into
neilwashere:mainfrom
joseluis:patch-1
Closed

fix references from Cargo.lock to Cargo.toml#18
joseluis wants to merge 1 commit into
neilwashere:mainfrom
joseluis:patch-1

Conversation

@joseluis

Copy link
Copy Markdown

it should look for Cargo.toml since Cargo.lock is not always present

@jayvdb jayvdb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will radically change what "project root" means ; c.f. https://stackoverflow.com/questions/75052086/how-to-locate-the-cargo-lock-from-build-rs

@joseluis

Copy link
Copy Markdown
Author

@jayvdb Ok I think I get what you mean. I was assumming the word project meant crate or package, but the term seems to be overloaded to also mean workspace. Both Cargo.toml and Cargo.lock will be present in the package's root, but there's going to be only one shared Cargo.lock at the workspace's root.

So searching the Cargo.toml would give the closest package's root. And searching for a Cargo.lock will give the closest project's root (which will be either the closest crate or its parent's workspace).

I'm going to close this PR. I also made a different version for finding the current's crate root, supporting path suffixes: devela::crate_root.

@joseluis joseluis closed this Jan 10, 2023
@jayvdb

jayvdb commented Jan 25, 2023

Copy link
Copy Markdown

Note there is a similar crate which finds the Cargo.toml https://github.com/spazm/find-cargo-toml but it isnt on crates.io

@jayvdb

jayvdb commented Jan 25, 2023

Copy link
Copy Markdown

https://docs.rs/devela/latest/devela/fn.crate_root.html says its repo is https://github.com/andamira/devela , but that repo isnt public.

@jayvdb

jayvdb commented Jan 25, 2023

Copy link
Copy Markdown

https://github.com/andamira/libera/blob/main/src/project.rs has a similar 'find Cargo.toml' routine.

@joseluis

Copy link
Copy Markdown
Author

repo isnt public.

ops! fixed! thank you

@jayvdb jayvdb mentioned this pull request Jan 27, 2023
@jayvdb

jayvdb commented Jan 27, 2023

Copy link
Copy Markdown

note #20 allows using this crate to achieve the same as this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants