Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore path dev deps in circular deps check (attempt 2) #2578

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions ci/order-crates-for-publishing.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,34 @@ def is_self_dev_dep_with_dev_context_only_utils(package, dependency, wrong_self_

return is_special_cased


# `cargo publish` is fine with circular dev-dependencies if
# they are path deps.
# However, cargo still fails if deps are path deps with versions
# (this when you use `workspace = true`): https://github.com/rust-lang/cargo/issues/4242
# Unlike in is_self_dev_dep_with_dev_context_only_utils(),
# we don't have a clean way of checking if someone used a workspace dev
# dep when they probably meant to use a path dev dep,
# so this function just checks if a dev dep is a path dep
# and provides no special warnings.
def is_path_dev_dep(dependency):
no_explicit_version = '*'
return (
dependency['kind'] == 'dev'
and 'path' in dependency
and dependency['req'] == no_explicit_version
)

def should_add(package, dependency, wrong_self_dev_dependencies):
related_to_solana = dependency['name'].startswith('solana')
self_dev_dep_with_dev_context_only_utils = is_self_dev_dep_with_dev_context_only_utils(
package, dependency, wrong_self_dev_dependencies
)

return related_to_solana and not self_dev_dep_with_dev_context_only_utils
return (
related_to_solana
and not self_dev_dep_with_dev_context_only_utils
and not is_path_dev_dep(dependency)
)

def get_packages():
metadata = load_metadata()
Expand Down