Skip to content

Commit

Permalink
Lift all dependencies (the big one) (paritytech#4716)
Browse files Browse the repository at this point in the history
After preparing in paritytech#4633,
we can lift also all internal dependencies up to the workspace.

This does not actually change anything, but uses `workspace = true` for
all dependencies. You can check it with:
```bash
git checkout -q $(git merge-base oty-lift-all-deps origin/master)
cargo tree -e features > master.out

git checkout -q oty-lift-all-deps
cargo tree -e features > new.out
diff master.out new.out
```

It did not yet lift 100% of dependencies, some inside of `target.*` or
some that had conflicting aliases introduced recently. But i will do
these together in a follow-up with CI checks.

Can be reproduced with [zepter](https://github.com/ggwpez/zepter/):
`zepter transpose d lift-to-workspace "regex:.*" --version-resolver
highest --skip-package "polkadot-sdk" --ignore-errors --fix`.

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez authored and TarekkMA committed Aug 2, 2024
1 parent e621d6d commit 863fc17
Show file tree
Hide file tree
Showing 527 changed files with 9,320 additions and 8,556 deletions.
7 changes: 7 additions & 0 deletions .config/taplo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ keys = ["build"]

[rule.formatting]
reorder_arrays = false

[[rule]]
include = ["Cargo.toml"]
keys = ["workspace.dependencies"]

[rule.formatting]
reorder_keys = true
10 changes: 6 additions & 4 deletions .github/scripts/check-workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@ def check_deps(deps):
if dep_name in all_crates:
links.append((name, dep_name))

if not 'path' in deps[dep]:
broken.append((name, dep_name, "crate must be linked via `path`"))
if name == 'polkadot-sdk':
if not 'path' in deps[dep]:
broken.append((name, dep_name, "crate must use path"))
return
elif not 'workspace' in deps[dep] or not deps[dep]['workspace']:
broken.append((name, dep_name, "crate must use workspace inheritance"))
return

def check_crate(deps):
Expand All @@ -154,8 +158,6 @@ def check_crate(deps):

check_crate(manifest)



links.sort()
broken.sort()

Expand Down
14 changes: 12 additions & 2 deletions .github/scripts/deny-git-deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

root = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()
workspace = Workspace.from_path(root)
errors = []

def check_dep(dep, used_by):
if dep.location != DependencyLocation.GIT:
Expand All @@ -27,14 +28,23 @@ def check_dep(dep, used_by):
if used_by in KNOWN_BAD_GIT_DEPS.get(dep.name, []):
print(f'🤨 Ignoring git dependency {dep.name} in {used_by}')
else:
print(f'🚫 Found git dependency {dep.name} in {used_by}')
sys.exit(1)
errors.append(f'🚫 Found git dependency {dep.name} in {used_by}')

# Check the workspace dependencies that can be inherited:
for dep in workspace.dependencies:
check_dep(dep, "workspace")

if workspace.crates.find_by_name(dep.name):
if dep.location != DependencyLocation.PATH:
errors.append(f'🚫 Workspace must use path to link local dependency {dep.name}')

# And the dependencies of each crate:
for crate in workspace.crates:
for dep in crate.dependencies:
check_dep(dep, crate.name)

if errors:
print('❌ Found errors:')
for error in errors:
print(error)
sys.exit(1)
17 changes: 2 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

767 changes: 765 additions & 2 deletions Cargo.toml

Large diffs are not rendered by default.

62 changes: 31 additions & 31 deletions bridges/bin/runtime-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,48 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
workspace = true

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false, features = ["derive"] }
hash-db = { version = "0.16.0", default-features = false }
codec = { features = ["derive"], workspace = true }
hash-db = { workspace = true }
log = { workspace = true }
scale-info = { version = "2.11.1", default-features = false, features = ["derive"] }
static_assertions = { version = "1.1", optional = true }
tuplex = { version = "0.1", default-features = false }
scale-info = { features = ["derive"], workspace = true }
static_assertions = { optional = true, workspace = true, default-features = true }
tuplex = { workspace = true }

# Bridge dependencies

bp-header-chain = { path = "../../primitives/header-chain", default-features = false }
bp-messages = { path = "../../primitives/messages", default-features = false }
bp-parachains = { path = "../../primitives/parachains", default-features = false }
bp-polkadot-core = { path = "../../primitives/polkadot-core", default-features = false }
bp-relayers = { path = "../../primitives/relayers", default-features = false }
bp-runtime = { path = "../../primitives/runtime", default-features = false }
bp-xcm-bridge-hub = { path = "../../primitives/xcm-bridge-hub", default-features = false }
bp-xcm-bridge-hub-router = { path = "../../primitives/xcm-bridge-hub-router", default-features = false }
pallet-bridge-grandpa = { path = "../../modules/grandpa", default-features = false }
pallet-bridge-messages = { path = "../../modules/messages", default-features = false }
pallet-bridge-parachains = { path = "../../modules/parachains", default-features = false }
pallet-bridge-relayers = { path = "../../modules/relayers", default-features = false }
bp-header-chain = { workspace = true }
bp-messages = { workspace = true }
bp-parachains = { workspace = true }
bp-polkadot-core = { workspace = true }
bp-relayers = { workspace = true }
bp-runtime = { workspace = true }
bp-xcm-bridge-hub = { workspace = true }
bp-xcm-bridge-hub-router = { workspace = true }
pallet-bridge-grandpa = { workspace = true }
pallet-bridge-messages = { workspace = true }
pallet-bridge-parachains = { workspace = true }
pallet-bridge-relayers = { workspace = true }

# Substrate dependencies

frame-support = { path = "../../../substrate/frame/support", default-features = false }
frame-system = { path = "../../../substrate/frame/system", default-features = false }
pallet-transaction-payment = { path = "../../../substrate/frame/transaction-payment", default-features = false }
pallet-utility = { path = "../../../substrate/frame/utility", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-core = { path = "../../../substrate/primitives/core", default-features = false }
sp-io = { path = "../../../substrate/primitives/io", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }
sp-trie = { path = "../../../substrate/primitives/trie", default-features = false }
frame-support = { workspace = true }
frame-system = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-utility = { workspace = true }
sp-api = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
sp-trie = { workspace = true }

# Polkadot dependencies
xcm = { package = "staging-xcm", path = "../../../polkadot/xcm", default-features = false }
xcm-builder = { package = "staging-xcm-builder", path = "../../../polkadot/xcm/xcm-builder", default-features = false }
xcm = { workspace = true }
xcm-builder = { workspace = true }

[dev-dependencies]
bp-test-utils = { path = "../../primitives/test-utils" }
pallet-balances = { path = "../../../substrate/frame/balances" }
bp-test-utils = { workspace = true, default-features = true }
pallet-balances = { workspace = true, default-features = true }

[features]
default = ["std"]
Expand Down
8 changes: 4 additions & 4 deletions bridges/chains/chain-asset-hub-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ repository.workspace = true
workspace = true

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false }
scale-info = { version = "2.11.1", default-features = false, features = ["derive"] }
codec = { workspace = true }
scale-info = { features = ["derive"], workspace = true }

# Substrate Dependencies
frame-support = { path = "../../../substrate/frame/support", default-features = false }
frame-support = { workspace = true }

# Bridge Dependencies
bp-xcm-bridge-hub-router = { path = "../../primitives/xcm-bridge-hub-router", default-features = false }
bp-xcm-bridge-hub-router = { workspace = true }

[features]
default = ["std"]
Expand Down
8 changes: 4 additions & 4 deletions bridges/chains/chain-asset-hub-westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ repository.workspace = true
workspace = true

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false }
scale-info = { version = "2.11.1", default-features = false, features = ["derive"] }
codec = { workspace = true }
scale-info = { features = ["derive"], workspace = true }

# Substrate Dependencies
frame-support = { path = "../../../substrate/frame/support", default-features = false }
frame-support = { workspace = true }

# Bridge Dependencies
bp-xcm-bridge-hub-router = { path = "../../primitives/xcm-bridge-hub-router", default-features = false }
bp-xcm-bridge-hub-router = { workspace = true }

[features]
default = ["std"]
Expand Down
16 changes: 8 additions & 8 deletions bridges/chains/chain-bridge-hub-cumulus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ workspace = true
[dependencies]
# Bridge Dependencies

bp-polkadot-core = { path = "../../primitives/polkadot-core", default-features = false }
bp-messages = { path = "../../primitives/messages", default-features = false }
bp-runtime = { path = "../../primitives/runtime", default-features = false }
bp-polkadot-core = { workspace = true }
bp-messages = { workspace = true }
bp-runtime = { workspace = true }

# Substrate Based Dependencies

frame-system = { path = "../../../substrate/frame/system", default-features = false }
frame-support = { path = "../../../substrate/frame/support", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }
frame-system = { workspace = true }
frame-support = { workspace = true }
sp-api = { workspace = true }
sp-std = { workspace = true }

# Polkadot Dependencies
polkadot-primitives = { path = "../../../polkadot/primitives", default-features = false }
polkadot-primitives = { workspace = true }

[features]
default = ["std"]
Expand Down
14 changes: 7 additions & 7 deletions bridges/chains/chain-bridge-hub-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ workspace = true
[dependencies]
# Bridge Dependencies

bp-bridge-hub-cumulus = { path = "../chain-bridge-hub-cumulus", default-features = false }
bp-runtime = { path = "../../primitives/runtime", default-features = false }
bp-messages = { path = "../../primitives/messages", default-features = false }
bp-bridge-hub-cumulus = { workspace = true }
bp-runtime = { workspace = true }
bp-messages = { workspace = true }

# Substrate Based Dependencies

frame-support = { path = "../../../substrate/frame/support", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }
frame-support = { workspace = true }
sp-api = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

[features]
default = ["std"]
Expand Down
14 changes: 7 additions & 7 deletions bridges/chains/chain-bridge-hub-polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ workspace = true

# Bridge Dependencies

bp-bridge-hub-cumulus = { path = "../chain-bridge-hub-cumulus", default-features = false }
bp-runtime = { path = "../../primitives/runtime", default-features = false }
bp-messages = { path = "../../primitives/messages", default-features = false }
bp-bridge-hub-cumulus = { workspace = true }
bp-runtime = { workspace = true }
bp-messages = { workspace = true }

# Substrate Based Dependencies

frame-support = { path = "../../../substrate/frame/support", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }
frame-support = { workspace = true }
sp-api = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

[features]
default = ["std"]
Expand Down
14 changes: 7 additions & 7 deletions bridges/chains/chain-bridge-hub-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ workspace = true
[dependencies]
# Bridge Dependencies

bp-bridge-hub-cumulus = { path = "../chain-bridge-hub-cumulus", default-features = false }
bp-runtime = { path = "../../primitives/runtime", default-features = false }
bp-messages = { path = "../../primitives/messages", default-features = false }
bp-bridge-hub-cumulus = { workspace = true }
bp-runtime = { workspace = true }
bp-messages = { workspace = true }

# Substrate Based Dependencies

frame-support = { path = "../../../substrate/frame/support", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }
frame-support = { workspace = true }
sp-api = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

[features]
default = ["std"]
Expand Down
14 changes: 7 additions & 7 deletions bridges/chains/chain-bridge-hub-westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ workspace = true

# Bridge Dependencies

bp-bridge-hub-cumulus = { path = "../chain-bridge-hub-cumulus", default-features = false }
bp-runtime = { path = "../../primitives/runtime", default-features = false }
bp-messages = { path = "../../primitives/messages", default-features = false }
bp-bridge-hub-cumulus = { workspace = true }
bp-runtime = { workspace = true }
bp-messages = { workspace = true }

# Substrate Based Dependencies

frame-support = { path = "../../../substrate/frame/support", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }
frame-support = { workspace = true }
sp-api = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

[features]
default = ["std"]
Expand Down
12 changes: 6 additions & 6 deletions bridges/chains/chain-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ workspace = true

# Bridge Dependencies

bp-header-chain = { path = "../../primitives/header-chain", default-features = false }
bp-polkadot-core = { path = "../../primitives/polkadot-core", default-features = false }
bp-runtime = { path = "../../primitives/runtime", default-features = false }
bp-header-chain = { workspace = true }
bp-polkadot-core = { workspace = true }
bp-runtime = { workspace = true }

# Substrate Based Dependencies

frame-support = { path = "../../../substrate/frame/support", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }
frame-support = { workspace = true }
sp-api = { workspace = true }
sp-std = { workspace = true }

[features]
default = ["std"]
Expand Down
Loading

0 comments on commit 863fc17

Please sign in to comment.