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

fix substrate-node-template generation #2050

Merged
merged 5 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions substrate/scripts/ci/node-template-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
set -e

export TERM=xterm
PROJECT_ROOT=`git rev-parse --show-toplevel`
SUBSTRATE_FOLDER="/substrate"
GIT_ROOT=`git rev-parse --show-toplevel`
PROJECT_ROOT=${GIT_ROOT}${SUBSTRATE_FOLDER}

if [ "$#" -ne 1 ]; then
echo "node-template-release.sh path_to_target_archive"
exit 1
fi

PATH_TO_ARCHIVE=$1
cd $PROJECT_ROOT/scripts/ci/node-template-release

cd $PROJECT_ROOT/scripts/ci/node-template-release
cargo run $PROJECT_ROOT/bin/node-template $PROJECT_ROOT/$PATH_TO_ARCHIVE
16 changes: 11 additions & 5 deletions substrate/scripts/ci/node-template-release/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use tar;
use tempfile;
use toml_edit::{self, value, Array, Item, Table};

const SUBSTRATE_GIT_URL: &str = "https://github.com/paritytech/substrate.git";
const SUBSTRATE_GIT_URL: &str = "https://github.com/paritytech/polkadot-sdk.git";

type CargoToml = toml_edit::Document;

Expand Down Expand Up @@ -63,7 +63,7 @@ fn copy_node_template(node_template: &Path, dest_path: &Path) {

/// Find all `Cargo.toml` files in the given path.
fn find_cargo_tomls(path: &PathBuf) -> Vec<PathBuf> {
let path = format!("{}/**/*.toml", path.display());
let path = format!("{}/**/Cargo.toml", path.display());

let glob = glob::glob(&path).expect("Generates globbing pattern");

Expand Down Expand Up @@ -196,7 +196,6 @@ fn update_root_cargo_toml(
) {
let mut workspace = Table::new();
workspace.insert("members", value(Array::from_iter(members.iter())));

let mut workspace_dependencies = Table::new();
deps.values()
.flatten()
Expand All @@ -212,6 +211,10 @@ fn update_root_cargo_toml(
workspace_dependencies[name]["rev"] = value(commit_id);
});

let mut package = Table::new();
package.insert("edition", value("2021"));
workspace.insert("package", Item::Table(package));

workspace.insert("dependencies", Item::Table(workspace_dependencies));
cargo_toml.insert("workspace", Item::Table(workspace));

Expand Down Expand Up @@ -428,9 +431,12 @@ frame-system = { workspace = true }
let expected_toml = r#"[workspace]
members = ["node", "pallets/template", "runtime"]

[workspace.package]
edition = "2021"

[workspace.dependencies]
frame-system = { version = "4.0.0-dev", default-features = true, git = "https://github.com/paritytech/substrate.git", rev = "commit_id" }
sp-io = { version = "7.0.0", git = "https://github.com/paritytech/substrate.git", rev = "commit_id" }
frame-system = { version = "4.0.0-dev", default-features = true, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "commit_id" }
sp-io = { version = "7.0.0", git = "https://github.com/paritytech/polkadot-sdk.git", rev = "commit_id" }

[profile]

Expand Down
Loading