Commit graph

209 commits

Author SHA1 Message Date
César D. Rodas
7bcac37d98
Improve cli_examples macro (#5589)
## Description

Add macro to test argument parsing rather than testing the external
command through building and spawning a separated process. This is an
improved version of #5519

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2024-02-10 14:54:51 +11:00
IGI-111
11231184a0
Bump to v0.50.0 (#5564) 2024-02-07 18:19:09 +04:00
Igor Rončević
8320c1ba12
Struct field privacy (#5508)
## Description

This PR makes struct fields private by default and introduces explicit
public struct fields:

```
pub struct Struct {
    pub public_field: u8,
    private_field: u8,    
}
```

Private fields can be accessed only withing the module in which their
struct is declared.

Error messages are properly orchestrated so that no conflicting or
duplicated messages are emitted. Since the change is a breaking change,
relevant suggestion on how to fix the particular issue are given.

To avoid an abrupt breaking change, the errors are temporarily turned
into warnings. These warnings will become errors in the upcoming
versions of Sway. The demo section below demonstrate how the errors will
look like, and how a one warning equivalent looks now.

Standard library structs like `Vec` or `String`, are adapted where
needed by adding the `pub` keyword to the fields that are accessed
outside of the struct declaration module. Some of these fields should
very likely remain public, but some, like e.g., `RawBytes::ptr` or
`Vec::buf` should be private. Adjusting the standard library to properly
utilize private fields is out of scope of this PR and will be done
separately. I expect breaking changes in the STD once we start modeling
structs keeping encapsulation in mind.

In addition, the PR:
- migrates
[annotate_snippets](https://github.com/rust-lang/annotate-snippets-rs)
crate to its latest version (breaking changes)
- removes a redundant non-existing field error and orchestrates
non-existing field error with privacy errors
- replaces an invalid and misleading error when accessing fields on
storage elements that are not structs

Closes #4692.

## Known limitations

There is an issue in displaying multi-line code snippets, which is
independent of these changes, but wasn't apparent before. The issue is
visible in the demo section below, where the struct bodies are sometimes
not fully shown, and they should be. This issue is reported in #5499 and
will be solved in a separate PR.

## Demo (an excerpt 😄)

### Private struct field is inaccessible

![Private struct field is
inaccessible](8ac07c2b-8135-470b-ad7a-820a4934f232)

![Private struct field is
inaccessible](ca944a7a-e6c4-4b6f-97f1-18000e649452)

### Struct cannot be instantiated

![Struct cannot be instantiated due to inaccessible private
fields](05993416-91d6-4f58-8fd6-8c35c23595f8)

![Struct cannot be instantiated due to inaccessible private
fields](655c17df-a520-45a0-8af4-f1e424ddf085)

### Struct pattern must ignore inaccessible private fields

![Struct pattern must ignore inaccessible private
fields](90396d14-de63-4b08-9f22-e260f406542d)

### Struct pattern has missing fields

![Struct pattern has missing
fields](0ddf44e8-7598-461a-b85b-48006670b0ca)

### Errors temporarily turned into warnings

![Error turned into
warning](ba235248-740f-4fd2-b1fa-29fc35ee8c84)

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2024-01-30 17:15:24 +04:00
Kaya Gökalp
2ac7030570
chore: bump version to 0.49.1 (#5495)
## Description
Bumps version to 0.49.1.
2024-01-19 21:29:31 +03:00
Kaya Gökalp
a17fbf3e7d
chore: bump to v0.49.0 (#5452)
## Description
Bumps repo to 0.49.0, made this a major one after some thought as we
longer support beta-4 as tooling with this release.
Also ran `cargo update` as this is a breaking change

---------

Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com>
Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2024-01-18 04:42:23 +03:00
César D. Rodas
fb06a8f038
Add examples to cli --help (#5388)
## Description

Fixes #5398, #5374

Add examples to our `--help` cli. The examples are defined through the a
macro `forc::cli_examples { }` and each of these examples is part of the
the test suite of the crate. This is done to ensure the documentation is
always up to date or updated whenever the tests are not passing.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Braqzen <103777923+Braqzen@users.noreply.github.com>
2024-01-10 16:47:40 +11:00
IGI-111
6886ef050c
Fix release Dockerfile and bump to v0.48.1 (#5370) 2023-12-06 10:37:39 +00:00
Joshua Batty
e451140ce0
Bump to v0.48.0 (#5275)
Co-authored-by: Kaya Gokalp <kayagokalp123@gmail.com>
2023-12-06 17:48:58 +11:00
IGI-111
34265301c6
Bump to v0.47.0 (#5257) 2023-11-06 11:04:34 +04:00
Joshua Batty
b69ea4f790
refactor: Move dir helpers from forc-util to sway-utils (#5224)
## Description
This PR just moves the dir helpers that were in `forc-util` to
`sway-utils`. I need access to these methods in an upcoming PR and
having them in `forc-util` introduces a mind field of circular
dependencies.
2023-10-25 02:38:50 +00:00
Kaya Gökalp
512a3386f8
Bump to v0.46.1 (#5149)
## Description
Bumps version to 0.46.1.
2023-09-28 23:42:04 +03:00
Joshua Batty
44f46a0a90
Synchronize code_lens request & provide better UX for forc-fmt <> sway-lsp interaction. (#5094)
## Description
This PR adds 3 things:

1. Adds a benchmark for the format LSP request.

2. Calls `session.wait_for_parsing();` before computing the `code_lens`
request. This fixes the original issue reported in #4893 where run
buttons where being placed incorrectly after formatting.

3. If a file open in a code editor contains unsaved changes we write a
lock file to `.forc/lsp_locks/`. This file is removed when the file is
saved and there are no pending changes. If `forc-fmt` is run in a
terminal we check if the path has a lock file associated with it. If
unsaved changes are detected we bail from formatting with an error
message instructing the user to save changes before continuing. See
video below.


75e6fddc-adbc-4796-aeb9-985574ae8dcc


closes #4893
2023-09-15 17:17:47 -04:00
IGI-111
e75f14b036
Bump to v0.46.0 (#5120) 2023-09-14 19:31:19 +02:00
Igor Rončević
c3f3a361a4
Adjust existing Diagnostic API according to the Expressive Diagnostics RFC (#5100)
## Description

This PR implements the decisions made in the [Expressive Diagnostics
RFC](https://github.com/FuelLabs/sway-rfcs/blob/master/rfcs/0011-expressive-diagnostics.md)
and adapts the existing diagnostics:
- _Issue_ is removed from the header and placed in code.
- _Help_ can also be in code.
- Wording is simplified.

Closes #5075.

## Demo (Before and After)

![Match arm is unreachable - Variant
1](968a1177-e4e3-4fdf-8663-52239a404a09)

![Match arm is unreachable - Variant
2](20fc85d9-2158-4dc8-8c96-8be5afe5fc21)

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Anton Trunov <anton.a.trunov@gmail.com>
2023-09-11 12:08:50 +02:00
Cesar
4910dbc514
Ignore patches from workspace members (#5092)
## Description

Take the cargo approach of ignoring patches of workspace members,
printing a warning, and only accepting patches defined at the workspace
root file.

Fixes #4448

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2023-09-06 22:45:49 +00:00
Igor Rončević
9dc442261d
Emit compile error if a match arm variable is declared more than once (#5085)
## Description

This PR:
- addresses the comments given in [this
PR](https://github.com/FuelLabs/sway/pull/4965#discussion_r1304890715)
- shows errors if a match arm variable is defined multiple times

The _issue_ is still shown in the header and the wording can be
simplified. This will be done in a separate PR, for all existing
diagnostics, as shown
[here](https://github.com/FuelLabs/sway/issues/5056#issuecomment-1698964837).

Closes #4963.

## Demo


![image](7e91006b-3320-4a0b-9bdb-4afeda5af5db)


![image](e8c1218c-0584-4154-b6ea-0b9edc044d77)

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Anton Trunov <anton.a.trunov@gmail.com>
Co-authored-by: João Matos <joao@tritao.eu>
2023-09-06 14:10:47 +02:00
Cesar
675d1347c2
[1645] Enhanced PackageManifest parsing (#5038)
## Description

Fixes #1645 by checking if there are any duplicate keys in sections. Any
duplication of keys will generate a parsing error that will bubble up to
the final user with some context on how to fix it.

The following `Forc.toml` file will fail:

```
[project]
authors = ["Cesar"]
entry = "main.sw"
license = "Apache-2.0"
name = "invalid"

[dependencies]
foo = "bar"
foo = "xxx"
```

The error that will be bubble up to the CLI output reads as follow:

```
Error: failed to parse manifest: duplicate 'foo' for key `dependencies` at line 7 column 1.
```
2023-08-30 15:17:58 +10:00
Kaya Gökalp
92dc9f361a
Bump to v0.45.0 (#5026)
Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2023-08-25 12:13:44 +03:00
Kaya Gökalp
04a597093e
Bump to v0.44.1 (#4969)
## Description
Bumps version to v0.44.1, to get some of tooling hot-fixes released.
2023-08-16 22:23:39 +03:00
IGI-111
241d30f7cd
Bump to v0.44.0 (#4945) 2023-08-14 15:33:58 +02:00
Green Baneling
e6f8925f98
An upgrade to fuel-core v0.20.3 (#4821)
This pull request is an upgrade to a `fuel-core 0.20.1` release.

The biggest changes coming from this new release is a rework of how
AssetId is structured to support [granular asset
minting](https://github.com/FuelLabs/fuel-specs/pull/491). This means a
contract can mint and burn multiple AssetId's, and the ContractId !=
AssetId.

---------

Co-authored-by: bitzoic <bitzoic.eth@gmail.com>
Co-authored-by: Cameron Carstens <54727135+bitzoic@users.noreply.github.com>
Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com>
Co-authored-by: Brandon Kite <brandonkite92@gmail.com>
Co-authored-by: Sophie <sophiedankel@gmail.com>
2023-08-14 11:19:40 +02:00
IGI-111
d8cf611840
Bump to v0.43.2 (#4907) 2023-08-03 18:23:32 +02:00
IGI-111
3efc60e22b
Bump to v0.43.0 (#4897) 2023-08-02 22:57:10 +02:00
Igor Rončević
6015013c8b
Support multi-span errors and warnings (#4892)
## Description

A new `Diagnostic` type is introduced for detail description of compile
errors and warnings. The change is backward compatible. The existing
`CompileWarning`s and `CompileError`s will continue render as they had
before.

The `Diagnostic` is formed out of a:
- _Level_: Error or Warning.
- _Code_: Unique error or warning code. Placeholder for future. Not used
at the moment.
- _Reason_: Short description of the diagnostic, not related to a
specific error/warning. Answers the question "Why is this an
error/warning?" E.g., Because - "Constants cannot be shadowed".
- _Issue_: Short description of the concrete case that the compiler has
found. E.g., "Variable "X" shadows imported constant with the same name"
- _Hints_: Detailed description of the diagnostic placed in the source
code.
- _Help_: Additional friendly information that helps understanding and
solving the issue, but which is not related to a place in code.

![07C Constant shadowing - Alias - After 02 -
Terminology](50c639a1-43f5-4bc2-afa2-5717652f0172)

The `Diagnostic`s are defined imperatively in code right now, pretty
much the sam way we do `CompilWarning`s at the moment. Development of a
proc-macro that should make de definitions declarative is out of scope
of #21.

## Known Limitations

The `annotate-snippets` library has a bug and a missing functionality
for which I opened issues:

- Wrong display of line numbers when using folding of lines of code.
This issue is fixed but there is no patch release provided:
https://github.com/rust-lang/annotate-snippets-rs/issues/52#issuecomment-1657829040
- No possibility to remove the "note:" prefix as shown on the image
above: https://github.com/rust-lang/annotate-snippets-rs/issues/59

These two issues are not blocking. Proposal is to wait for the official
support in the library, or contribute or in the worst case make a
workaround in our code.

## Demo (Before and After)

### Errors
![07A Constant shadowing - Alias -
Before](5d67c5e5-d456-4762-b7c7-6fcf7340d6b3)

![07C Constant shadowing - Alias - After
02](02691b39-3d08-4776-ba93-5ffeca4546ed)

### Warnings
![06A NonScreamingSnakeCaseConstName -
Before](c27279d4-0e6c-4d05-9b00-da7121bb60ad)

![06B NonScreamingSnakeCaseConstName -
After](483044f3-f190-4506-9e9e-2d03d70cb3f2)

Closes #21

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2023-08-02 10:50:52 +02:00
Kaya Gökalp
3b66f8e424
chore: bump to v0.42.1 (#4767)
## Description
release: v0.42.1 version.
2023-07-07 10:55:59 +00:00
Kaya Gökalp
c4e4ef7e4a
chore: bump to v0.42.0 (#4755)
## Description
Also runs `cargo update` in order to update deps to their latest patch
release as this is a breaking release.
2023-07-06 11:26:02 +00:00
IGI-111
e08fab1852
Bump to v0.41.0 (#4720) 2023-06-29 19:26:23 +01:00
Mitchell Mackert
00982e477e
Add flag to reverse errors (#4142)
Adds the ability to reverse errors and warnings in either the command line or via a BuildProfile.

closes #3860
2023-06-22 01:46:34 +03:00
Kaya Gökalp
26581f5937
chore: make fuel-tx optional to forc-util (#4668)
## Description
closes #4667.

To be more WASM friendly and increase reuseability of `forc-util` this
PR hides fuel-tx related utilities under `fuel-tx` flag.
2023-06-16 16:41:12 +00:00
João Matos
0e547a622f
Span optimizations (#4613)
## Description

This implements a set of optimizations around span usage. The main idea
is we stop using paths as strings, and instead replace it using an
integer-based id, which is way less expensive for hash map comparisons.

Here are some numbers, from the slowest test we have on the suite
(`should_pass/stdlib/vec`).

**Benchmarking Results** (`master`):
**Time** (mean ± σ): 6.129 s ± 0.080 s [User: 5.755 s, System: 0.359 s]
  **Range** (min … max):    6.009 s …  6.268 s    10 runs

**Benchmarking Results** (span hash optimization):
**Time** (mean ± σ): 5.345 s ± 0.161 s [User: 5.000 s, System: 0.341 s]
  **Range** (min … max):    5.082 s …  5.590 s    10 runss


**Benchmarking Results** (both span hash and SourceEngine optimization):
**Time** (mean ± σ): 4.376 s ± 0.089 s [User: 4.065 s, System: 0.309 s]
  **Range** (min … max):    4.255 s …  4.546 s    10 runs

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2023-06-08 10:34:00 +01:00
IGI-111
d026ddb8c2
Bump to v0.40.1 (#4614) 2023-05-31 15:13:02 +00:00
Kaya Gökalp
164c7c8bea
release: bump to v0.40.0 (#4601)
## Description

Waiting for:
- #4525.

@Dhaiwat10 was waiting for a release with the linked PR merged.

@IGI-111 I had the PR ready, leaving it up to you when to merge & cut
the release. Made this a major bump as we had a breaking change merged
(#4574).

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.

Co-authored-by: IGI-111 <igi-111@protonmail.com>
2023-05-31 10:21:28 +00:00
IGI-111
e3065657c9
Bump to v0.39.1 (#4585) 2023-05-24 13:22:42 +00:00
IGI-111
7a095280e7
Bump to 0.39.0 (#4568) 2023-05-17 15:48:16 +02:00
mitchmindtree
2d16d70ab9
Re-publish 0.37.2 as 0.38.0 due to breaking changes (#4494)
See here for context:
https://github.com/FuelLabs/sway/pull/4492#issuecomment-1520949069

This follows a re-release of 0.37.1 as 0.37.3:
https://github.com/FuelLabs/sway/releases/tag/v0.37.3

The outcome of all this is that ideally, users previously on 0.37.1 will
now pull 0.37.3 next time they run `cargo update` and will not encounter
any breakage. Those ready to update can point to 0.38.0 after this is
published.

Also runs `cargo update` in order to update deps to their latest patch
release.

---------

Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2023-04-25 03:53:15 +00:00
Kaya Gökalp
dc6af91393
Bump to v0.37.2 (#4492) 2023-04-24 22:19:25 +02:00
Kaya Gökalp
ebdbbfe2dd
feat: exit with 101 from forc-test if there are failing tests (#4463)
## Description
closes #4462.

With this PR we exit from `forc test` with 101 exit status, if there are
failing unit tests. If `forc test` execution itself fails we exit with
1. This is useful especially in CIs as the return status can be checked
to better understand what is happening.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com>
2023-04-19 22:48:37 +00:00
Kaya Gökalp
375d31f5c7
refactor: better error formatting for ForcResult (#4460)
## Description
closes #4461.

We introduced `ForcResult` in #4455. While implementing it I took a look
at the cargo's design and saw that they also have `CargoCliResult` which
did not make a lot of sense then but it looks like without that piece we
cannot format the error nicely because of rust's orphan rule. This PR
introduces `ForcCliResult` which enables us to return nice and clean
errors.
2023-04-19 00:34:15 +00:00
Kaya Gökalp
5e7ad6eca7
refactor: Introduce ForcResult and ForcError to propagate return code with error message (#4455)
## Description
closes #4420.

This PR introduces `ForcResult` and `ForcError` which enables us to
return with custom exit code via propagating the desired exit code
alongside the error message. Using `ForcResult` we can exit with
different return code for different cases. Cargo uses similar approach
for similar purposes.
2023-04-17 23:59:53 +00:00
Mohammad Fawaz
83e5479462
Bump to v0.37.1 (#4435) 2023-04-13 12:28:13 -04:00
Kaya Gökalp
1e63c1551a
feat: disallow nested packages (#4407)
## Description

closes #4072 

Disallows package structure such as the following:

```console
proj1
├── proj2
│   ├── Forc.lock
│   ├── Forc.toml
│   ├── out
│   └── src
├── Forc.lock
├── Forc.toml
├── out
│   └── debug
└── src
    └── main.sw
```
2023-04-13 00:03:26 +00:00
Mohammad Fawaz
607ac50176
Bump to v0.37.0 (#4401) 2023-04-05 20:01:56 -04:00
Mohammad Fawaz
92818a4d5e
Bump to v0.36.1 (#4397) 2023-04-05 10:04:12 -04:00
Mohammad Fawaz
77f575ab79
Bump to v0.36.0 (#4388)
Also ran `cargo update` because this is a breaking release.

Pending:
- [x] https://github.com/FuelLabs/sway/pull/4391
- [x] https://github.com/FuelLabs/sway/pull/4390
- [x] https://github.com/FuelLabs/sway/pull/4385
2023-04-04 22:25:46 -04:00
Kaya Gökalp
8e30dc2a5b
feat: add forc contract-id and forc predicate-id commands (#4338)
## Description
Adds `forc contract-id` and `forc predicate-id` commands for contract id and predicate root detection.

closes #3444.
2023-04-04 02:19:41 +00:00
JC
169ad0b145
Cleanup TOMLs (#4312)
Moves following `Cargo.toml` fields to workspace `Cargo.toml` so we
don't have to keep repeating ourselves:

- edition
- authors
- homepage
- license
- repository
2023-03-20 16:22:12 +00:00
Kaya Gökalp
f4cffba1c4
feat: multi contract calls in unit tests for contracts (#4156)
## Description
closes #3571.
closes #4162.

This PR adds the ability of calling multiple contracts from sway unit
tests if they are added as `[contract-dependencies]`. This is limited
with contracts currently but I will be having a follow-up which builds
upon this to introduce this support to scripts as well.

As these contracts are already declared under `[contract-dependencies]`
their contract ids are injected into their namespace by `forc-pkg`. A
bug related to this step is fixed in #4159.

<img width="787" alt="image"
src="https://user-images.githubusercontent.com/20915464/224345002-92dc2bcb-823d-4971-9041-31111cf85e77.png">

### Follow-ups
- #4161
- ~#4162~
 
## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Kaya Gokalp <kayagokalp@fuel.sh>
2023-03-16 10:01:16 +00:00
Mohammad Fawaz
49eae2dd93
Bump to v0.35.5 (#4242) 2023-03-08 13:12:24 -05:00
Mohammad Fawaz
3770dd8c21
bump to v0.35.4 (#4230) 2023-03-07 14:38:24 +00:00
mitchmindtree
f357e2490e
feat(forc-pkg): Print *before* compiling each package. Only print after on warnings/error. (#4187)
## Description

We now print with the following format *prior* to compiling a package:

```
Compiling <ty> <name> (<src>)
```

Rather than only printing `Compiled` after compilation is complete.

Closes #3780.

This also aims to improve the formatting of the output a little by using
ansi_term styling to distinguish between action, program kind, package
name and source more clearly.

The fetching, adding and removing actions have had their formatting
updated to match. E.g.

![Screenshot from 2023-02-26
20-14-25](https://user-images.githubusercontent.com/4587373/221402630-28b65eb3-ddfb-491f-81a6-4aead5538a28.png)

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2023-02-26 14:44:16 +03:00