Commit graph

525 commits

Author SHA1 Message Date
Kaya Gökalp
53361ee726
forc template implementation (#1614)
* forc template resolves the HEAD and fetches the repo. Prints the requested directorie's path

* forc template works with and without template name

* forc init --template removed, pkg.rs unused pub modifier removed

* extra info added before copy, cargo-toml-lint, udeps fix, mdbook fix

* invoke CI

* Update scripts/mdbook-forc-documenter/examples/forc_template.md

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* Update scripts/mdbook-forc-documenter/examples/forc_template.md

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* default url provided, project_name is last parameter to pass without --project_name

* cargo fmt

* println to tracing::info

* local_repo_name to template_name

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
2022-05-24 02:47:41 +03:00
Nick Furfaro
0215033a18
Bump SDK version to Fuels v0.13 (#1625)
* build: bump sdk deps

* test: update test syntax

* style: fmt

* test: cleanup

* build: bump default SDK version for forc init

* update: modify forc init default code

* fmt
2022-05-20 14:41:18 -06:00
Kaya Gökalp
1cf7696e5e
Transition to tracing in forc (and throughout sway) over println (#1575) 2022-05-20 11:18:01 +03:00
Kaya Gökalp
e9d084fdf1
--url option added to forc deploy (#1607) 2022-05-20 09:13:31 +03:00
Mohammad Fawaz
6eef7ab750
Bump to v0.13.0 (#1587)
* Bump to v0.13.0

* fixing deps in sway-fmt-v2

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
2022-05-19 10:03:42 -04:00
Alex Hansen
fd5ff42c05
Remove the old pest parser code (#1407)
* Remove selector debug which used the old parser

* remove sway-types dep on pest


Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>

* remove friendly error string method
2022-05-16 22:49:36 -04:00
John Adler
d63a9f0363
Remove rand dependency from default Cargo.toml (#1539)
It's only used for a random salt, which is 1) hidden under the hood, and 2) not needed since you can just use zero.
2022-05-13 04:20:40 -04:00
Mohammad Fawaz
2b6e9384f0
bump to 0.12.2 (#1528) 2022-05-12 11:16:00 -04:00
Brandon Kite
f6b036601b
Bump fuels* to 0.12 (#1520)
* bump to latest versions

* remove salt from sample test harness
2022-05-11 12:18:14 -07:00
rashad
0f8de55580
Add --locked to forc (#1442)
* Add --locked to forc

* Add bail on error

Adjust bail logic

* forc-documenter write-docs

* Add forc-documenter write-docs

Co-authored-by: Rashad Alston <rashad@Rashads-MBP.attlocal.net>
2022-05-10 12:23:38 -07:00
Braqzen
6cb2d10676
Manifest files use env variable to set author or default back to the … (#1487)
* Manifest files use env variable to set author or default back to the realname

* Updated formatting

* Moved environment &str into an importable constant

* DRYing the code

* Update for failing forc-documenter CI
2022-05-10 06:54:04 +01:00
bing
eb19599177
move forc completions help text into the book (#1248)
* Add indentation for code block within forc deploy

* Separate examples from constants

* Update examples.rs to the latest version

* Remove long-form discussion in forc completions help

* Update examples and docs

* Revert examples check to shorten diff forn ow

* Newline

* Newline for docs

* Better formatting

* Add link to book within help

* Update docs

* Remove redundant shell command prefixes $ and PS

* Missed the C:s

* Run write-docs script

* Re-add FORC_COMPLETIONS_EXAMPLE
2022-05-10 12:41:03 +08:00
Kaya Gökalp
b35f30ac61
Fix for forc test doesn't return with error code if Cargo manifest is invalid #1464 (#1481) 2022-05-08 12:23:39 +03:00
Braqzen
d1db317f07
Changed default manifest dependency ordering (#1496) 2022-05-07 09:02:48 +01:00
Braqzen
de23c8a8fe
Moved name & version keys to the top of [package] (#1485)
* Moved name & version keys to the top of [package]

* Update for failing forc-documenter CI
2022-05-06 13:53:12 +01:00
bing
c8cc838d90
Hide use orig asm and parser in the help text for forc build, deploy, run (#1469)
* hide = true for use-orig-asm and use-orig-parser

* update docs

* Hide use_orig_asm and use_orig_parser for deploy and run as well

* Update docs for run and deploy

Co-authored-by: binggh <binggh@proton.me>
2022-05-05 10:15:01 +08:00
rashad
bc313eb9b8
Add --describe -d opt to forc plugins (#1453)
* Add --describe -d opt to forc plugins

* forc-documenter write-docs

* Implement JoshuaBatty feedback

Update print_plugin error messaging

Add docstrings

* Address no -h flag bug

* Revert forc-documenter write-docs

* Add forc-documenter write-docs

Co-authored-by: Rashad Alston <rashad@Rashads-MBP.attlocal.net>
Co-authored-by: Rashad Alston <rashad@Rashads-MacBook-Pro.local>
2022-05-04 16:44:12 -07:00
Mohammad Fawaz
a03a5d1c06
bump to 0.12.1 (#1473) 2022-05-04 12:31:40 -04:00
Mohammad Fawaz
489f0ca961
Bump to 0.12.0 (#1457)
* bump to v0.11.1

* bump to v0.12.0 instead due to breaking changes
2022-05-03 12:34:07 -04:00
Mohammad Fawaz
30fef8dfca
Fix forc run default URL (#1441) 2022-04-30 23:26:42 -04:00
Mohammad Fawaz
289cee86f4
Support jnzi in the compiler (#1417)
* Use jnzi for branches

* Use jnzi for branches

* Updating tests

* Use jnzi for branches

* Use jnzi for branches

* Updating tests

* Fixing Cargo.lock

* bumping versions

* bump fuel-gql-client

* more bumps

* bumping graph-gql-client and fixing url issues

* Update fuel-core version for CI

* update forc run doc

* revert change in

* Update lib-std tests

* fmt

* fmt

* bumping test-helpers

* bump fuel-core in ci

* test: fix ecpected error messages

* test: fix token_ops

* test: fix context test

* Changing 0.6.3 to 0.6

* Update sway-core/src/asm_lang/mod.rs

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* Update test/src/sdk-harness/test-helpers/Cargo.toml

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

Co-authored-by: Nick Furfaro <nfurfaro33@gmail.com>
Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
2022-04-30 09:23:44 -04:00
Braqzen
7989a4d994
Added examples from examples repo (#1370)
* Added examples from examples repo

* Updated formatting

* Updating formatting again. I really need to figure out why cargo fmt is not running here

* change hello_world to counter in URL

* Use SWAY_GIT_TAG instead of master in URL

* Cleaned up branching. Alphabetized examples

* Removed hardcoded examples in favour of error handling and future auto example discovery

* Added automatic repo discovery upon user entering a nonexistent template

* Cleaned up error handling to use anyhow!()

* Cleaned up the formatting

* Changed the URL to query the SWAY_GIT_TAG instead of master

Co-authored-by: Chris O'Brien <57543709+eureka-cpu@users.noreply.github.com>
2022-04-27 08:00:36 +01:00
Alex Hansen
95816e4e41
v0.11.0 (#1402)
* v0.10.4

* v0.11.0

Co-authored-by: Alexander Hansen <alexanderhansen@AlexandersMBP2.home>
2022-04-26 11:35:42 -07:00
Chris O'Brien
a9011c3910
Updated forc-init to accept program_type parameters (#1351)
* wip

* fmt

* added project-type

* added help msg

* add project_type file

* fixed up default programs and entry point names

* updated test to use constant

* rmv unused constants from sway-utils

* updated forc init docs

* update to prog type, and flags

* rmv needless help msg

* update docstrings in init

* update md

* Update forc/src/ops/forc_init.rs

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* update doc and error msg

* lib to library

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
2022-04-25 19:19:32 -05:00
Chris O'Brien
750f2c0b96
Replace hello_world example with counter example (#1360) 2022-04-25 19:12:24 -05:00
rashad
cdd35dcd2f
Hide Forc.lock creation warn behind verbosity (#1354)
* Hide Forc.lock creation warn behind verbosity

* Hide additional warning

* Remove silent_flag usage

Co-authored-by: Rashad Alston <rashad@Rashads-MacBook-Pro.local>
2022-04-24 08:30:08 -07:00
bing
a48a7e96e8
update forc plugins to emit file names only, with option of full paths (#1381)
* emit file names by default, with option of full path

* pub use PluginsCommmand

* cargo fmt

* better handling of file_name

* Use expect for print_plugin + add panic assumptions comment

* Run forc-documenter for forc plugins

Co-authored-by: bing <binggh@proton.me>
2022-04-24 16:58:42 +10:00
Hannes Karppila
d17a848045
Show hexdump instead of decimal arrays in parse-bytecode (#1326) 2022-04-21 09:02:12 +02:00
Andrew Cann
6b8a46b8c0
sway-parse initial PR (#1286)
* remove pest::Span from sway_types::Span

* Add new parser implementation

* use new parser in sway-core

* Proper error handling in convert_parse_tree

* rename new-parser-again to sway-parse

* remove redundant test bin from sway-parse

* fix dependencies in sway-parse

* fix clippy lints

* put dependencies in alphabetical order

* run rustfmt

* record full span in TokenStream

* remove an unused function

* alphabetically sort workspace members

* add --use-orig-parser cli option

* rust rustfmt

* update crate metadata for sway-parse

* update forc docs for --use-orig-parser
2022-04-21 12:09:00 +08:00
amadeusluntz
3ef9085cf2
Shorthand for build and test (#1285)
* added shorthands

* using alias

* using visible_alias to add to help
2022-04-19 16:17:20 +10:00
bing
d6f0270de2
replace content in forc README with link to book instead (#1300) 2022-04-19 14:42:18 +10:00
Mohammad Fawaz
e7676db6f4
bump to 0.10.3 (#1294) 2022-04-18 09:09:52 -04:00
Mohammad Fawaz
443abbffd5
Bump to 0.10.2 (#1290)
* Bump to 0.10.2

* adding Cargo.lock
2022-04-18 07:57:40 -04:00
Nick
24f4533495
forc init welcome message (#1257)
* expanded init for forc welcome

* remove useless format

* toml formatting

* toml formatting

* cargo formatting

* add welcome message to tempalte and no template init

* resolve urls, fix typescript, small nits

* formatting

Co-authored-by: Nicholas Dodson <nick@Nicholass-MacBook-Pro.local>
2022-04-15 09:47:11 -07:00
mitchmindtree
79d9364c5c
Introduce a path-aware ManifestFile type (#1249)
* Introduce a path-aware `ManifestFile` type

After loading a `Manifest`, most useful operations involving it require
knowledge of the directory path from which it was loaded from (i.e.
`entry_string`, `program_type`).

This introduces a `ManifestFile` type that stores the path to the
`Forc.toml` from which its inner `Manifest` was read. This allows to
avoid a lot of unnecessary code duplication related to traversing the
parents to find the root manifest directory. Now, we can just load the
`ManifestFile` and call `manifest.path()` or `manifest.dir()` to get the
path to the `Forc.toml` or its enclosing directory respectively.

* Use correct manifest directory path for `fetch_deps`

* Replace comment previously lost in rebase conflict resolution

* Use existing error constructor provided by pkg module
2022-04-15 08:27:00 +10:00
Chris O'Brien
030ac36616
Updated from_dir to check parent directories (#1232)
* moved check project type to manifest

* added find_manifest_dir to from_dir

* find and remove duplicate find_manifest_dir

* added manifest_dir to fns that require it
2022-04-14 23:21:08 +10:00
Joshua Batty
8333abe050
Fix forc init --template counter (#1245)
* only edit Cargo.toml on template init if it already exists

* init with default test harness
2022-04-14 15:05:49 +10:00
Mohammad Fawaz
37aad01aed
Checking E2E contract test receipts (#1205)
* checking contract test receipts

* Update forc/src/ops/forc_run.rs

Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>

* Update forc/src/ops/forc_run.rs

Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>

* change any to all

* Enable configurable returns

* merge with master

Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>
2022-04-12 14:16:10 -04:00
Mohammad Fawaz
93417809c0
remove std from the list of dependencies in Forc.toml (#1226) 2022-04-12 13:30:57 -04:00
Mohammad Fawaz
5c85d2b712
bump to v0.10.1 (#1222) 2022-04-11 21:22:50 -04:00
ControlCplusControlV
08fc1502f3
Update forc init to include a more realistic test and contract skeleton (#1194)
* updated forc init

* Fixed fmt and warning

* fix clippy

* fmt all?

* fmt the templates

* Fix default contract fmt

* TODO comment

* Added Test Function so things work in 3 cmds now
2022-04-11 15:12:39 -06:00
Mohammad Fawaz
a88ea439c9
bump to v0.10.0 (#1207) 2022-04-11 13:24:33 -04:00
mitchmindtree
f0d72a976b
Add a forc plugins command for listing all plugins (#1199)
* Add a `forc plugins` command for listing all plugins

Closes #1198.

Lists the full path to every `forc-*` plugin discovered under the user's
`PATH`.

For example:

```sh
[mindtree@minddesk:~]$ forc plugins
/home/mindtree/.cargo/bin/forc-fmt
/home/mindtree/.cargo/bin/forc-explore
/home/mindtree/.cargo/bin/forc-lsp
```

We could potentially add flags to this command in the future for:

- only emitting executable names (not full paths)
- printing versions and descriptions in a table
- outputting via JSON or TOML for easier machine digestion.

For now, this PR just aims to add initial support.

The logic included in this should make it easier to include available
plugin commands in a future `forc --list` command too (ala #702).

* Specify major.minor for forc's walkdir dependency
2022-04-11 15:59:15 +10:00
mitchmindtree
b9aeebfba9
Move forc's fmt command support into a dedicated forc-fmt plugin crate (#1196)
* Add a new `forc-fmt` forc plugin for running the Sway code formatter

In preparation for removing internal support for formatting from `forc`
as a part of an ongoing effort toward slimming down `forc`'s dependency
graph.

* forc: Remove `fmt` command in favour of new `forc-fmt` plugin crate
2022-04-08 23:04:57 +10:00
mitchmindtree
4b83356eb8
Move forc's block explorer support into a dedicated forc-explore plugin crate (#1180)
* Add `forc-explore` plugin for running the fuel block explorer

This is aimed at replacing `forc`'s internal support for running the
block explorer, to be removed in a follow-up commit.

* Remove `forc` block explorer support in favour of `forc-explore` plugin

* forc-explore: don't panic on failed archive extraction

* forc-explore: sync to current `forc` version at 0.9.2

* forc-explore: use major.minor versions for deps

Also updates the `Cargo.lock` with the 0.9 -> 0.9.2 version change.

* forc-explore: forc-util dep version must be major.minor.patch
2022-04-08 13:40:12 +10:00
mitchmindtree
a121a43580
Move forc's LSP support into a dedicated forc-lsp plugin crate (#1179)
* Move `forc`'s LSP support into a dedicated `forc-lsp` plugin crate.

This creates a dedicated `forc-lsp` plugin crate. With `forc`'s new
plugin support, having this plugin installed and available via `PATH`
enables the original behaviour of starting the sway language server via
`forc lsp <args>`.

This also acts as a local test for `forc` plugin support and as a simple
example of how to implement a `forc` plugin.

The old `lsp` and `forc_lsp` modules have been removed from `forc` in
favour of this new `forc-lsp` plugin.

* Add forc-lsp plugin to CI git tag version check

* forc-lsp: sync to current `forc` version at 0.9.2

* fuel-lsp: Use `major.minor` for dep versions

* forc-lsp: local deps must be major.minor.patch for publishing
2022-04-08 12:47:40 +10:00
mitchmindtree
c70240a268
Allow forwarding options and arguments from forc test to cargo test (#1181)
This allows for forwarding both custom options and custom arguments
through to `forc test`'s underlying `cargo test` invocation.

See the documentation for the new `forc_test::Command` fields for
information on how to forward options and arguments.

This also removes the permanent "--nocapture" arg that we previously
passed through to `cargo test` in favour of allowing the user to
optionally specify it if they wish.

To achieve the original behaviour, you can invoke `forc test` with the
following:

```
forc test -- --nocapture
```

Note that this PR *does* keep the original behaviour of permanently
setting `--color always` in order to provide nice colorful output by
default. This is useful as cargo appears to disable colored output by
default when run as a child process.

In the case that the user wishes to disable colored output, they can
still do so by specifying the necessary `cargo test` option, e.g.

```
forc test --cargo-test-opts="--color never"
```

Closes #1004
2022-04-08 10:21:49 +10:00
mitchmindtree
637e8ac053
Appease clippy's latest gripes for CI (#1193) 2022-04-08 10:21:06 +10:00
mitchmindtree
4fcce7abcc
Add support for forc CLI plugins (#1178)
Adds support for treating external executables as `forc` plugins,
provided they are of the name `forc-*` and are available via `PATH`.

For example, this allows for using an installed `forc-foo <args>` plugin
via `forc foo <args>`.

This should enable us to cut down on some of `forc`'s bloat by moving
support for things like the block explorer, language server and running
a fuel node into dedicated plugins.
2022-04-08 09:50:55 +10:00
Joshua Batty
6d8ff71bfd
print all parsed LSP tokens as warnings in VScode (#1148)
* wip

* can now emit lsp warnings for all parsed tokens

* set lsp DebugFlags via CLI input

* update tests to take a client and config

* add ops forc_lsp module

* cargo fmt

* add Cargo.lock

* remove commented line
2022-04-07 12:44:34 +10:00