-
Notifications
You must be signed in to change notification settings - Fork 676
Closed
Description
The motivating use case for this change is to allow publishing of crates whose tests rely on code not published in tests, or where the dependency can't otherwise be represented. The current workaround today is to comment out the dev-dependency line for publishing, Two concrete use cases are:
- Test code that must be a separate crate, but doesn't have any reason to be published:
cargohas some proc-macros that it uses for its test suite. This crate has no reason to otherwise be published.
- dev-dependencies that can't otherwise be represented:
dieselis split into multiple crates, one of which provides proc-macros. Prior to 1.0, the cratediesel_codegen(since renamed todiesel_derives) had a dependency ondiesel.dieseluseddiesel_codegenin its doctests. Since this would present a dependency cycle using published versions, this could not be represented without path dependencies.
The following is required for this feature to land:
- Determine if we ever use the
dependenciestable other than for UI purposes or determining reverse dependencies- If no, we do not need to store these path dependencies at all, as we do not want to use them for reverse dependencies or display them in the UI
If yes, we will need to determine how best to store these. We may want to store them in a separate table -- otherwise we'll need to change the dependencies table to support crates that don't actually exist. No checklist item for this yet, since the exact steps will depend on what we use it for, and my guess is we don't need to store them.
- When a dev-dependency has a
pathfield andrequest.env() != Env::Productiondo not reject it. Do not store it in the database. - Validate that the paths for dev-dependencies does not refer to a path outside the
.cratefile.- Example impls might be "is relative and no segment is
.." or "path == path.canoncialize()" - This doesn't need to be particularly clever, as long as it's simple and has clear intent. The common use case is
path = "foo"orpath = "src/foo". - We should not do any checks beyond the path, looking at
.gitignoreor theexcludefield ofCargo.tomlis out of scope for crates.io
- Example impls might be "is relative and no segment is
- Allow
*version ranges if the dependency has apathfield - Document this at https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#development-dependencies or somewhere else
- Remove the feature flag, begin allowing this in production
Metadata
Metadata
Assignees
Labels
No labels