From 69a9faeb2cae6e5cd25b826a1aadffa1caff65f5 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 13 Nov 2020 16:27:24 +0000 Subject: [PATCH] Use package name instead of lib name for metadata dependency (#107) * Use package name instead of lib name for metadata dependency * Fix ink_metadata error messages --- src/workspace/manifest.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/workspace/manifest.rs b/src/workspace/manifest.rs index 3cc851b9f..7a6e4f1bd 100644 --- a/src/workspace/manifest.rs +++ b/src/workspace/manifest.rs @@ -369,25 +369,25 @@ impl Manifest { fs::create_dir_all(&dir).context(format!("Creating directory '{}'", dir.display()))?; - let name = self + let contract_package_name = self .toml - .get("lib") - .ok_or(anyhow::anyhow!("lib section not found"))? + .get("package") + .ok_or(anyhow::anyhow!("package section not found"))? .get("name") - .ok_or(anyhow::anyhow!("[lib] name field not found"))? + .ok_or(anyhow::anyhow!("[package] name field not found"))? .as_str() - .ok_or(anyhow::anyhow!("[lib] name should be a string"))?; + .ok_or(anyhow::anyhow!("[package] name should be a string"))?; let ink_metadata = self .toml .get("dependencies") .ok_or(anyhow::anyhow!("[dependencies] section not found"))? .get("ink_metadata") - .ok_or(anyhow::anyhow!("{} dependency not found", name))? + .ok_or(anyhow::anyhow!("ink_metadata dependency not found"))? .as_table() - .ok_or(anyhow::anyhow!("{} dependency should be a table", name))?; + .ok_or(anyhow::anyhow!("ink_metadata dependency should be a table"))?; - metadata::generate_package(dir, name, ink_metadata.clone())?; + metadata::generate_package(dir, contract_package_name, ink_metadata.clone())?; } let updated_toml = toml::to_string(&self.toml)?;