From fccec236470294d61f249d05fc17d995b7fb3bd2 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 13 Nov 2020 15:59:32 +0000 Subject: [PATCH 1/2] Use package name instead of lib name for metadata dependency --- 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 3cc851b9..3cf3957a 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!("{} dependency not found", contract_package_name))? .as_table() - .ok_or(anyhow::anyhow!("{} dependency should be a table", name))?; + .ok_or(anyhow::anyhow!("{} dependency should be a table", contract_package_name))?; - 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)?; -- GitLab From da18354226e39fb6f9f0e1fd6971075ee5f14524 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 13 Nov 2020 16:04:35 +0000 Subject: [PATCH 2/2] Fix ink_metadata error messages --- src/workspace/manifest.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/workspace/manifest.rs b/src/workspace/manifest.rs index 3cf3957a..7a6e4f1b 100644 --- a/src/workspace/manifest.rs +++ b/src/workspace/manifest.rs @@ -383,9 +383,9 @@ impl Manifest { .get("dependencies") .ok_or(anyhow::anyhow!("[dependencies] section not found"))? .get("ink_metadata") - .ok_or(anyhow::anyhow!("{} dependency not found", contract_package_name))? + .ok_or(anyhow::anyhow!("ink_metadata dependency not found"))? .as_table() - .ok_or(anyhow::anyhow!("{} dependency should be a table", contract_package_name))?; + .ok_or(anyhow::anyhow!("ink_metadata dependency should be a table"))?; metadata::generate_package(dir, contract_package_name, ink_metadata.clone())?; } -- GitLab