inkdevhub / swanky-cli

The all-in-one developer environment for Parity pallet-contracts based smart contracts!
https://docs.astar.network/docs/build/wasm/swanky-suite/cli/
MIT License
70 stars 29 forks source link

[BUG] swanky contract compile leaves mess if compilation fails #90

Closed kziemianek closed 1 year ago

kziemianek commented 1 year ago

Description

Hi, as it is another issue from me I want to say that you've created great tool and i'm using it extensively recently, thank you for all your incredible work.

In case of smart contract compilation error swanky contract compile command leaves empty directory in artifacts/<smart_contract> and changes in swanky.config.json.

Command's output also says that contract was compiled successfully: Contract compiled successfully

Steps to Reproduce

kziemianek@Kaspers-MBP foobar % git status
On branch master
nothing to commit, working tree clean
kziemianek@Kaspers-MBP foobar % ls -ltr artifacts/flipper 
total 0
kziemianek@Kaspers-MBP foobar % swanky contract compile flipper -v
======== Found contracts ========
    flipper
======== Compiling flipper ========
warning: nothing to print.

To find dependencies that require specific target platforms, try to use option `--target all` first, and then narrow your search scope accordingly.
Checking with toolchain `nightly-2022-06-30-x86_64-apple-darwin`
    Checking flipper v0.1.0 (/Users/kziemianek/projects/astar/foobar/contracts/flipper)
error[E0425]: cannot find value `init_value` in this scope
  --> src/lib.rs:21:27
   |
21 |             Self { value: init_value }
   |                           ^^^^^^^^^^ help: a local variable with a similar name exists: `init_valu2`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `flipper` due to previous error
Error: Compilation failed with toolchain `nightly-2022-06-30-x86_64-apple-darwin`
<lines skipped>
✔ Contract compiled successfully
⠋ Copying artifacts[Error: ENOENT: no such file or directory, copyfile '/Users/kziemianek/projects/astar/foobar/artifacts/flipper.contract' -> '/Users/kziemianek/projects/astar/foobar/artifacts/flipper/1675423435711/flipper.wasm'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'copyfile',
  path: '/Users/kziemianek/projects/astar/foobar/artifacts/flipper.contract',
  dest: '/Users/kziemianek/projects/astar/foobar/artifacts/flipper/1675423435711/flipper.wasm'
}
✔ Copying artifacts OK
✔ Writing config OK
kziemianek@Kaspers-MBP foobar % ls -ltr artifacts/flipper 
total 0
drwxr-xr-x  2 kziemianek  staff  64 Feb  3 12:23 1675423435711
kziemianek@Kaspers-MBP foobar % git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   swanky.config.json

no changes added to commit (use "git add" and/or "git commit -a")

Expected vs. Actual Behavior No changes if command fails, output says that contract was not compiled successfully.

Environment

kziemianek commented 1 year ago

I see this is resolved in #84