Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 44e6513

Browse files
committed
Avoid early-abort and report all collected errors
1 parent 15cf9c4 commit 44e6513

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

ci/order-crates-for-publishing.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,43 +47,44 @@ def load_metadata():
4747
# This script follows the same safe discarding logic to exclude these
4848
# special-cased dev dependencies from its `dependency_graph` and further
4949
# processing.
50-
def is_self_dev_dep_with_dev_context_only_utils(package, dependency):
50+
def is_self_dev_dep_with_dev_context_only_utils(package, dependency, wrong_self_dev_dependencies):
5151
no_explicit_version = '*'
5252

5353
is_special_cased = False
5454
if (dependency['kind'] == 'dev' and
5555
dependency['name'] == package['name'] and
5656
'dev-context-only-utils' in dependency['features'] and
5757
'path' in dependency):
58-
if dependency['req'] == no_explicit_version:
59-
is_special_cased = True
60-
else:
58+
is_special_cased = True
59+
if dependency['req'] != no_explicit_version:
6160
# it's likely `{ workspace = true, ... }` is used, which implicitly pulls the
6261
# version in...
63-
sys.exit(
64-
'Error: wrong dev-context-only-utils circular dependency. try: ' +
65-
'{} = {{ path = ".", features = {} }}\n'
66-
.format(dependency['name'], json.dumps(dependency['features']))
67-
)
62+
wrong_self_dev_dependencies.append(dependency)
6863

6964
return is_special_cased
7065

71-
def should_add(package, dependency):
72-
is_related_to_solana = dependency['name'].startswith('solana')
73-
return (
74-
is_related_to_solana and not is_self_dev_dep_with_dev_context_only_utils(package, dependency)
66+
def should_add(package, dependency, wrong_self_dev_dependencies):
67+
related_to_solana = dependency['name'].startswith('solana')
68+
self_dev_dep_with_dev_context_only_utils = is_self_dev_dep_with_dev_context_only_utils(
69+
package, dependency, wrong_self_dev_dependencies
7570
)
7671

72+
return related_to_solana and not self_dev_dep_with_dev_context_only_utils
73+
7774
def get_packages():
7875
metadata = load_metadata()
7976

8077
manifest_path = dict()
8178

8279
# Build dictionary of packages and their immediate solana-only dependencies
8380
dependency_graph = dict()
81+
wrong_self_dev_dependencies = list()
82+
8483
for pkg in metadata['packages']:
8584
manifest_path[pkg['name']] = pkg['manifest_path'];
86-
dependency_graph[pkg['name']] = [x['name'] for x in pkg['dependencies'] if should_add(pkg, x)];
85+
dependency_graph[pkg['name']] = [
86+
x['name'] for x in pkg['dependencies'] if should_add(pkg, x, wrong_self_dev_dependencies)
87+
];
8788

8889
# Check for direct circular dependencies
8990
circular_dependencies = set()
@@ -94,8 +95,13 @@ def get_packages():
9495

9596
for dependency in circular_dependencies:
9697
sys.stderr.write('Error: Circular dependency: {}\n'.format(dependency))
98+
for dependency in wrong_self_dev_dependencies:
99+
sys.stderr.write('Error: wrong dev-context-only-utils circular dependency. try: ' +
100+
'{} = {{ path = ".", features = {} }}\n'
101+
.format(dependency['name'], json.dumps(dependency['features']))
102+
)
97103

98-
if len(circular_dependencies) != 0:
104+
if len(circular_dependencies) != 0 or len(wrong_self_dev_dependencies) != 0:
99105
sys.exit(1)
100106

101107
# Order dependencies

0 commit comments

Comments
 (0)