Skip to content

Commit

Permalink
Symlink chain-specs json files to crate where they are used (#1171)
Browse files Browse the repository at this point in the history
When publishing crates, each crate becomes it's own tarball that can't
access files from other crates. So symlink the files to be crate local
and cargo will replace the symlinks with real files at publish time.

We can't just move all of them as it makes the package larger than the
max crates.io package size.

Co-authored-by: Javier Viola <[email protected]>
  • Loading branch information
Morganamilo and pepoviola authored Aug 30, 2023
1 parent b46f07f commit 43c0c09
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 14 deletions.
1 change: 1 addition & 0 deletions cumulus/polkadot-parachain/chain-specs/tick.json
1 change: 1 addition & 0 deletions cumulus/polkadot-parachain/chain-specs/track.json
1 change: 1 addition & 0 deletions cumulus/polkadot-parachain/chain-specs/trick.json
10 changes: 5 additions & 5 deletions cumulus/polkadot-parachain/src/chain_spec/bridge_hubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl BridgeHubRuntimeType {
match self {
BridgeHubRuntimeType::Polkadot =>
Ok(Box::new(polkadot::BridgeHubChainSpec::from_json_bytes(
&include_bytes!("../../../parachains/chain-specs/bridge-hub-polkadot.json")[..],
&include_bytes!("../../chain-specs/bridge-hub-polkadot.json")[..],
)?)),
BridgeHubRuntimeType::PolkadotLocal => Ok(Box::new(polkadot::local_config(
polkadot::BRIDGE_HUB_POLKADOT_LOCAL,
Expand All @@ -113,7 +113,7 @@ impl BridgeHubRuntimeType {
))),
BridgeHubRuntimeType::Kusama =>
Ok(Box::new(kusama::BridgeHubChainSpec::from_json_bytes(
&include_bytes!("../../../parachains/chain-specs/bridge-hub-kusama.json")[..],
&include_bytes!("../../chain-specs/bridge-hub-kusama.json")[..],
)?)),
BridgeHubRuntimeType::KusamaLocal => Ok(Box::new(kusama::local_config(
kusama::BRIDGE_HUB_KUSAMA_LOCAL,
Expand All @@ -129,11 +129,11 @@ impl BridgeHubRuntimeType {
))),
BridgeHubRuntimeType::Westend =>
Ok(Box::new(westend::BridgeHubChainSpec::from_json_bytes(
&include_bytes!("../../../parachains/chain-specs/bridge-hub-westend.json")[..],
&include_bytes!("../../chain-specs/bridge-hub-westend.json")[..],
)?)),
BridgeHubRuntimeType::Rococo =>
Ok(Box::new(rococo::BridgeHubChainSpec::from_json_bytes(
&include_bytes!("../../../parachains/chain-specs/bridge-hub-rococo.json")[..],
&include_bytes!("../../chain-specs/bridge-hub-rococo.json")[..],
)?)),
BridgeHubRuntimeType::RococoLocal => Ok(Box::new(rococo::local_config(
rococo::BRIDGE_HUB_ROCOCO_LOCAL,
Expand All @@ -153,7 +153,7 @@ impl BridgeHubRuntimeType {
))),
BridgeHubRuntimeType::Wococo =>
Ok(Box::new(wococo::BridgeHubChainSpec::from_json_bytes(
&include_bytes!("../../../parachains/chain-specs/bridge-hub-wococo.json")[..],
&include_bytes!("../../chain-specs/bridge-hub-wococo.json")[..],
)?)),
BridgeHubRuntimeType::WococoLocal => Ok(Box::new(wococo::local_config(
wococo::BRIDGE_HUB_WOCOCO_LOCAL,
Expand Down
18 changes: 9 additions & 9 deletions cumulus/polkadot-parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
Box::new(chain_spec::rococo_parachain::staging_rococo_parachain_local_config()),
"tick" =>
Box::new(chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_bytes(
&include_bytes!("../../parachains/chain-specs/tick.json")[..],
&include_bytes!("../chain-specs/tick.json")[..],
)?),
"trick" =>
Box::new(chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_bytes(
&include_bytes!("../../parachains/chain-specs/trick.json")[..],
&include_bytes!("../chain-specs/trick.json")[..],
)?),
"track" =>
Box::new(chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_bytes(
&include_bytes!("../../parachains/chain-specs/track.json")[..],
&include_bytes!("../chain-specs/track.json")[..],
)?),

// -- Starters
Expand All @@ -147,7 +147,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
// the shell-based chain spec as used for syncing
"asset-hub-polkadot" | "statemint" =>
Box::new(chain_spec::asset_hubs::AssetHubPolkadotChainSpec::from_json_bytes(
&include_bytes!("../../parachains/chain-specs/asset-hub-polkadot.json")[..],
&include_bytes!("../chain-specs/asset-hub-polkadot.json")[..],
)?),

// -- Asset Hub Kusama
Expand All @@ -161,7 +161,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
// the shell-based chain spec as used for syncing
"asset-hub-kusama" | "statemine" =>
Box::new(chain_spec::asset_hubs::AssetHubKusamaChainSpec::from_json_bytes(
&include_bytes!("../../parachains/chain-specs/asset-hub-kusama.json")[..],
&include_bytes!("../chain-specs/asset-hub-kusama.json")[..],
)?),

// -- Asset Hub Westend
Expand All @@ -175,7 +175,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
// the shell-based chain spec as used for syncing
"asset-hub-westend" | "westmint" =>
Box::new(chain_spec::asset_hubs::AssetHubWestendChainSpec::from_json_bytes(
&include_bytes!("../../parachains/chain-specs/asset-hub-westend.json")[..],
&include_bytes!("../chain-specs/asset-hub-westend.json")[..],
)?),

// -- Polkadot Collectives
Expand All @@ -185,11 +185,11 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
Box::new(chain_spec::collectives::collectives_polkadot_local_config()),
"collectives-polkadot" =>
Box::new(chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_bytes(
&include_bytes!("../../parachains/chain-specs/collectives-polkadot.json")[..],
&include_bytes!("../chain-specs/collectives-polkadot.json")[..],
)?),
"collectives-westend" =>
Box::new(chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_bytes(
&include_bytes!("../../parachains/chain-specs/collectives-westend.json")[..],
&include_bytes!("../chain-specs/collectives-westend.json")[..],
)?),

// -- Contracts on Rococo
Expand All @@ -200,7 +200,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
"contracts-rococo-genesis" => Box::new(chain_spec::contracts::contracts_rococo_config()),
"contracts-rococo" =>
Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_bytes(
&include_bytes!("../../parachains/chain-specs/contracts-rococo.json")[..],
&include_bytes!("../chain-specs/contracts-rococo.json")[..],
)?),

// -- BridgeHub
Expand Down

0 comments on commit 43c0c09

Please sign in to comment.