mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 05:17:58 +00:00
Repot all templates into a single directory (#3460)
The first step towards https://github.com/paritytech/polkadot-sdk/issues/3155 Brings all templates under the following structure ``` templates | parachain | | polkadot-launch | | runtime --> parachain-template-runtime | | pallets --> pallet-parachain-template | | node --> parachain-template-node | minimal | | runtime --> minimal-template-runtime | | pallets --> pallet-minimal-template | | node --> minimal-template-node | solochain | | runtime --> solochain-template-runtime | | pallets --> pallet-template (the naming is not consistent here) | | node --> solochain-template-node ``` The only note-worthy changes in this PR are: - More `Cargo.toml` fields are forwarded to use the one from the workspace. - parachain template now has weights and benchmarks - adds a shell pallet to the minimal template - remove a few unused deps A list of possible follow-ups: - [ ] Unify READMEs, create a parent README for all - [ ] remove references to `docs.substrate.io` in templates - [ ] make all templates use `#[derive_impl]` - [ ] update and unify all licenses - [ ] Remove polkadot launch, use https://github.com/paritytech/polkadot-sdk/blob/35349df993ea2e7c4769914ef5d199e787b23d4c/cumulus/zombienet/examples/small_network.toml instead.
This commit is contained in:
@@ -18,7 +18,7 @@ def parse_args():
|
||||
|
||||
parser.add_argument('workspace_dir', help='The directory to check', metavar='workspace_dir', type=str, nargs=1)
|
||||
parser.add_argument('--exclude', help='Exclude crate paths from the check', metavar='exclude', type=str, nargs='*', default=[])
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
return (args.workspace_dir[0], args.exclude)
|
||||
|
||||
@@ -26,7 +26,7 @@ def main(root, exclude):
|
||||
workspace_crates = get_members(root, exclude)
|
||||
all_crates = get_crates(root, exclude)
|
||||
print(f'📦 Found {len(all_crates)} crates in total')
|
||||
|
||||
|
||||
check_duplicates(workspace_crates)
|
||||
check_missing(workspace_crates, all_crates)
|
||||
check_links(all_crates)
|
||||
@@ -48,14 +48,14 @@ def get_members(workspace_dir, exclude):
|
||||
|
||||
if not 'members' in root_manifest['workspace']:
|
||||
return []
|
||||
|
||||
|
||||
members = []
|
||||
for member in root_manifest['workspace']['members']:
|
||||
if member in exclude:
|
||||
print(f'❌ Excluded member should not appear in the workspace {member}')
|
||||
sys.exit(1)
|
||||
members.append(member)
|
||||
|
||||
|
||||
return members
|
||||
|
||||
# List all members of the workspace.
|
||||
@@ -74,12 +74,12 @@ def get_crates(workspace_dir, exclude_crates) -> dict:
|
||||
with open(path, "r") as f:
|
||||
content = f.read()
|
||||
manifest = toml.loads(content)
|
||||
|
||||
|
||||
if 'workspace' in manifest:
|
||||
if root != workspace_dir:
|
||||
print("⏩ Excluded recursive workspace at %s" % path)
|
||||
continue
|
||||
|
||||
|
||||
# Cut off the root path and the trailing /Cargo.toml.
|
||||
path = path[len(workspace_dir)+1:-11]
|
||||
name = manifest['package']['name']
|
||||
@@ -87,7 +87,7 @@ def get_crates(workspace_dir, exclude_crates) -> dict:
|
||||
print("⏩ Excluded crate %s at %s" % (name, path))
|
||||
continue
|
||||
crates[name] = (path, manifest)
|
||||
|
||||
|
||||
return crates
|
||||
|
||||
# Check that there are no duplicate entries in the workspace.
|
||||
@@ -138,23 +138,23 @@ def check_links(all_crates):
|
||||
if not 'path' in deps[dep]:
|
||||
broken.append((name, dep_name, "crate must be linked via `path`"))
|
||||
return
|
||||
|
||||
|
||||
def check_crate(deps):
|
||||
to_checks = ['dependencies', 'dev-dependencies', 'build-dependencies']
|
||||
|
||||
for to_check in to_checks:
|
||||
if to_check in deps:
|
||||
check_deps(deps[to_check])
|
||||
|
||||
|
||||
# There could possibly target dependant deps:
|
||||
if 'target' in manifest:
|
||||
# Target dependant deps can only have one level of nesting:
|
||||
for _, target in manifest['target'].items():
|
||||
check_crate(target)
|
||||
|
||||
|
||||
check_crate(manifest)
|
||||
|
||||
|
||||
|
||||
|
||||
links.sort()
|
||||
broken.sort()
|
||||
|
||||
Reference in New Issue
Block a user