From eec7c007740f8d1b8ff61ca0abc14f4a876a20a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 14 Mar 2022 18:17:56 +0100 Subject: [PATCH] Fix issues with publishing (#462) * Include `.scale` files At the moment it's only `src/cmd/extrinsics/runtime_api/contracts_runtime.scale`. * Fix `cargo publish` * Add CI stage for `cargo package` * Remove unused import * Revert "Add CI stage for `cargo package`" This reverts commit f1f5cb2b4cefac202343dd240e25e560aea50dbd. --- Cargo.toml | 2 +- build.rs | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e8911979b..52a82c700 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ homepage = "https://www.parity.io/" description = "Setup and deployment tool for developing Wasm based smart contracts via ink!" keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] categories = ["command-line-utilities", "development-tools::build-utils", "development-tools::cargo-plugins"] -include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE", "build.rs", "templates"] +include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE", "build.rs", "templates", "src/**/*.scale"] [dependencies] env_logger = "0.9.0" diff --git a/build.rs b/build.rs index 513df6cca..f7085a3bc 100644 --- a/build.rs +++ b/build.rs @@ -122,7 +122,24 @@ fn build_and_zip_dylint_driver( out_dir: PathBuf, dylint_driver_dst_file: PathBuf, ) -> Result<()> { - let ink_dylint_driver_dir = manifest_dir.join("ink_linting"); + let mut ink_dylint_driver_dir = manifest_dir.join("ink_linting"); + + // The following condition acocunts for the case when `cargo package` or + // `cargo publish` is used. In that case the `CARGO_MANIFEST_DIR` is actually + // of the form `cargo-contract/target/package/cargo-contract-0.18.0/`. + // But since the `ink_linting/` folder is not part of the `cargo-contract` + // project it would not be found in this `CARGO_MANIFEST_DIR`. + if !ink_dylint_driver_dir.exists() { + println!( + "Folder `ink_linting` not found at {:?}", + ink_dylint_driver_dir + ); + ink_dylint_driver_dir = manifest_dir.join("../../../ink_linting/"); + println!( + "Added a relative path to reference the `ink_linting` folder at: {:?}", + ink_dylint_driver_dir + ); + } let mut cmd = Command::new("cargo");