This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
The crate rename #4223
Merged
Merged
The crate rename #4223
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
aaddf5e
Adding script for rename, could be applicable for nodes on top of it,…
gnunicorn dadd23c
add stderr and gitlab ci features
gnunicorn dac6dd6
apply script
gnunicorn 6f77e0a
fix now minor details in expected stderr
gnunicorn 7c05bd9
Update the Cargo.lock
gnunicorn 7e36881
fix name: sc-transaction -> sc-tracing
gnunicorn fb99cf9
fix rename in script, too
gnunicorn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| #!/bin/bash | ||
|
|
||
| function rust_rename() { | ||
| sed -i "s/$1/$2/g" `grep -Rl --include="*.rs" --include="*.stderr" "$1" *` > /dev/null | ||
| } | ||
|
|
||
| function cargo_rename() { | ||
| find . -name "Cargo.toml" -exec sed -i "s/\(^\|[^\/]\)$1/\1$2/g" {} \; | ||
| } | ||
|
|
||
| function rename_gitlabci() { | ||
| sed -i "s/$1/$2/g" .gitlab-ci.yml | ||
| } | ||
|
|
||
| function rename() { | ||
| old=$(echo $1 | cut -f1 -d\ ); | ||
| new=$(echo $1 | cut -f2 -d\ ); | ||
|
|
||
| echo "Renaming $old to $new" | ||
| # rename in Cargo.tomls | ||
| cargo_rename $old $new | ||
| rename_gitlabci $old $new | ||
| # and it appears, we have the same syntax in rust files | ||
| rust_rename $old $new | ||
|
|
||
| # but generally we have the snail case syntax in rust files | ||
| old=$(echo $old | sed s/-/_/g ); | ||
| new=$(echo $new | sed s/-/_/g ); | ||
|
|
||
| echo " > $old to $new" | ||
| rust_rename $old $new | ||
| } | ||
|
|
||
| TO_RENAME=( | ||
| # OLD-CRATE-NAME NEW-CRATE-NAME | ||
|
|
||
| # PRIMITIVES | ||
| "substrate-application-crypto sc-application-crypto" | ||
| "substrate-authority-discovery-primitives sp-authority-discovery" | ||
| "substrate-block-builder-runtime-api sp-block-builder" | ||
| "substrate-consensus-aura-primitives sp-consensus-aura" | ||
| "substrate-consensus-babe-primitives sp-consensus-babe" | ||
| "substrate-consensus-common sp-consensus" | ||
| "substrate-consensus-pow-primitives sp-consensus-pow" | ||
| "substrate-primitives sp-core" | ||
| "substrate-debug-derive sp-debug-derive" | ||
| "substrate-primitives-storage sp-storage" | ||
| "substrate-externalities sp-externalities" | ||
| "substrate-finality-grandpa-primitives sp-finality-granpda" | ||
| "substrate-inherents sp-inherents" | ||
| "substrate-keyring sp-keyring" | ||
| "substrate-offchain-primitives sp-offchain" | ||
| "substrate-panic-handler sp-panic-handler" | ||
| "substrate-phragmen sp-phragmen" | ||
| "substrate-rpc-primitives sp-rpc" | ||
| "substrate-runtime-interface sp-runtime-interface" | ||
| "substrate-runtime-interface-proc-macro sp-runtime-interface-proc-macro" | ||
| "substrate-runtime-interface-test-wasm sp-runtime-interface-test-wasm" | ||
| "substrate-serializer sp-serializer" | ||
| "substrate-session sp-sesssion" | ||
| "sr-api sp-api" | ||
| "sr-api-proc-macro sp-api-proc-macro" | ||
| "sr-api-test sp-api-test" | ||
| "sr-arithmetic sp-arithmetic" | ||
| "sr-arithmetic-fuzzer sp-arithmetic-fuzzer" | ||
| "sr-io sp-io" | ||
| "sr-primitives sp-runtime" | ||
| "sr-sandbox sp-sandbox" | ||
| "sr-staking-primitives sp-staking" | ||
| "sr-std sp-std" | ||
| "sr-version sp-version" | ||
| "substrate-state-machine sp-state-machine" | ||
| "substrate-transaction-pool-runtime-api sp-transaction-pool" | ||
| "substrate-trie sp-trie" | ||
| "substrate-wasm-interface sp-wasm-interface" | ||
|
|
||
| # # CLIENT | ||
| "substrate-client sc-client" | ||
| "substrate-client-api sc-api" | ||
| "substrate-authority-discovery sc-authority-discovery" | ||
| "substrate-basic-authorship sc-basic-authority" | ||
| "substrate-block-builder sc-block-builder" | ||
| "substrate-chain-spec sc-chain-spec" | ||
| "substrate-chain-spec-derive sc-chain-spec-derive" | ||
| "substrate-cli sc-cli" | ||
| "substrate-consensus-aura sc-consensus-aura" | ||
| "substrate-consensus-babe sc-consensus-babe" | ||
| "substrate-consensus-pow sc-consensus-pow" | ||
| "substrate-consensus-slots sc-consensus-slots" | ||
| "substrate-consensus-uncles sc-consensus-uncles" | ||
| "substrate-client-db sc-database" | ||
| "substrate-executor sc-executor" | ||
| "substrate-runtime-test sc-runtime-test" | ||
| "substrate-finality-grandpa sc-finality-grandpa" | ||
| "substrate-keystore sc-keystore" | ||
| "substrate-network sc-network" | ||
| "substrate-offchain sc-offchain" | ||
| "substrate-peerset sc-peerset" | ||
| "substrate-rpc-servers sc-rpc-server" | ||
| "substrate-rpc sc-rpc" | ||
| "substrate-service sc-service" | ||
| "substrate-service-test sc-service-test" | ||
| "substrate-state-db sc-state-db" | ||
| "substrate-telemetry sc-telemetry" | ||
| "substrate-tracing sc-tracing" | ||
|
|
||
| ); | ||
|
|
||
| for rule in "${TO_RENAME[@]}" | ||
| do | ||
| rename "$rule"; | ||
| done | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.