From dee1580707b693af6a0351205775c51d92dba208 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Mon, 14 Mar 2022 17:17:55 +0100 Subject: [PATCH 1/5] Include `.scale` files At the moment it's only `src/cmd/extrinsics/runtime_api/contracts_runtime.scale`. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e8911979..52a82c70 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" -- GitLab From 7e449d1154711b91686e57230491721c4a04aefa Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Mon, 14 Mar 2022 17:21:34 +0100 Subject: [PATCH 2/5] Fix `cargo publish` --- build.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 513df6cc..2597a92f 100644 --- a/build.rs +++ b/build.rs @@ -23,6 +23,7 @@ use std::{ iter::Iterator, path::{Path, PathBuf}, process::Command, + str::FromStr, }; use anyhow::Result; @@ -122,7 +123,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"); -- GitLab From f1f5cb2b4cefac202343dd240e25e560aea50dbd Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Mon, 14 Mar 2022 17:25:24 +0100 Subject: [PATCH 3/5] Add CI stage for `cargo package` --- .gitlab-ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0129a27b..79778ab6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -131,6 +131,16 @@ test-new-project-template: - cargo fmt --verbose --all -- --check - cargo clippy --verbose --manifest-path Cargo.toml -- -D warnings; +# `cargo package` is executed when doing `cargo publish`. So by testing +# it here we test that at least the `cargo package` step in the publishing +# process will work. +test-cargo-package: + stage: test + <<: *docker-env + script: + - cargo package + + #### stage: build (default features) build: -- GitLab From b20e9a99818527fe0fb4fd6246402132fee646b1 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Mon, 14 Mar 2022 17:28:18 +0100 Subject: [PATCH 4/5] Remove unused import --- build.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/build.rs b/build.rs index 2597a92f..f7085a3b 100644 --- a/build.rs +++ b/build.rs @@ -23,7 +23,6 @@ use std::{ iter::Iterator, path::{Path, PathBuf}, process::Command, - str::FromStr, }; use anyhow::Result; -- GitLab From f64c934a6072b9e4316d7e27b19d64f9fce94fe3 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Mon, 14 Mar 2022 17:37:32 +0100 Subject: [PATCH 5/5] Revert "Add CI stage for `cargo package`" This reverts commit f1f5cb2b4cefac202343dd240e25e560aea50dbd. --- .gitlab-ci.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79778ab6..0129a27b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -131,16 +131,6 @@ test-new-project-template: - cargo fmt --verbose --all -- --check - cargo clippy --verbose --manifest-path Cargo.toml -- -D warnings; -# `cargo package` is executed when doing `cargo publish`. So by testing -# it here we test that at least the `cargo package` step in the publishing -# process will work. -test-cargo-package: - stage: test - <<: *docker-env - script: - - cargo package - - #### stage: build (default features) build: -- GitLab