* BuildPlan generation from lock file does not break when there is a dependency removal from manifest file.
* While removing the deleted nodes handle orphaned childs
* removed debug println
* removed_deps removed from BuildPlan
* While checking from parent's manifest check for package name as well
* removed unnecessary reference
* split validate into generate_diff and validate
* apply_pkg_diff visits nodes to delete in reverse BFS order
* docs added for generate_diff
* removed unnecessary logic in apply_diff_after_lock
* doc updates
* clippy && extra dereferencing removed
* Apply suggestions from code review effor -> effort
Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>
* duplicate code removed
* change visibility of apply_pkg_diff and from_lock to private
* doc updated
* patch checks are added
* check for patches corrected
* lsp uses load_from_manifest, from_lock_file is private
* add use::collections::HashSet
* WIP Improve `BuildPlan` graph reconstruction
* Minimise I/O by replacing BuildProfile's PathMap with a ManifestMap
This commit reduces the number of times that we need to read each
dependency's manifest from file in order to reduce the amount of I/O
performed. Each dependency's manifest should now only be loaded once
during either `graph_to_manifest_map` or `fetch_graph`.
This required implementing `Clone` for `ManifestFile` to allow for
constructing the build plan in a manner that does not require consuming
the manifest file. `ManifestFile::clone` should only ever be called for
the root node.
As a side-effect, the `build` and `check` commands no longer require
loading each package's manifest as they are already provided by the
build plan. As a result both commands no longer require the sway git
tag to be passed through.
* Ensure only one edge between a package and each dependency
* Ensure lock is updated if path child dependencies change
* Address clippy nits
* Address formatting nits
* Improve accuracy of dependency removal by invalidating by edges
Previously, all dependency nodes were removed in the case that they were
invalid for any one of their parents.
This commit changes the behaviour to not remove the node, but rather
each invalid dependency *edge* instead. This means that if a node is
valid for one parent but not another, only the edge to the other parent
is removed and not the whole node itself. The node is only removed in
the case that it is invalid for all of its parents.
This is necessary for handling the case where a dependency no longer
exists in one parent's `[dependencies]` but still exists in another. The
most common case for this is `std`, as many nodes may depend on `std`
however we don't want to remove `std` and have to re-fetch it just
because one of the nodes removed their depenency on it.
* Avoid visiting a node's dependencies multiple times during validation
* Improve name and docs for BuildPlan constructors
* Remove unnecessary path root validation from Lock::to_graph.
This is checked during the `validate_graph` phase.
Also improves a bunch of comments.
Co-authored-by: kayagokalp <kaya.gokalp@fuel.sh>
Co-authored-by: Chris O'Brien <57543709+eureka-cpu@users.noreply.github.com>
Co-authored-by: Kaya Gökalp <kayagokalp@sabanciuniv.edu>
* Copy over changes from PR#1669
* Rework `forc new` in terms of `forc init`
This removes all of the duplicated logic from the `forc new` command in
favour of re-using the `forc init` op.
* Add missing doc
* Add missing comment
Co-authored-by: Rashad Alston <rashad@Rashads-MacBook-Pro.local>
Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>
Co-authored-by: Rashad Alston <rashad@Rashads-MBP.attlocal.net>
Use the full path of the plugin when parsing it for a description.
This avoids the following panic caused by trying to exec an executable
in a sub-folder with a partial path:
```
~/dev/sway/target/debug$ forc plugins
Installed Plugins:
thread 'main' panicked at 'Could not get plugin description.: Os { code:
2, kind: NotFound, message: "No such file or directory" }',
forc/src/cli/commands/plugins.rs:43:10
stack backtrace:
0: rust_begin_unwind
at
/rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at
/rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
2: core::result::unwrap_failed
at
/rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/result.rs:1785:5
3: core::result::Result<T,E>::expect
at
/rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/result.rs:1035:23
4: forc::cli::commands::plugins::parse_description_for_plugin
at
/home/joao/dev/sway/forc/src/cli/commands/plugins.rs:40:16
5: forc::cli::commands::plugins::format_print_description
at
/home/joao/dev/sway/forc/src/cli/commands/plugins.rs:81:23
6: forc::cli::commands::plugins::print_plugin
at
/home/joao/dev/sway/forc/src/cli/commands/plugins.rs:97:5
7: forc::cli::commands::plugins::exec
at
/home/joao/dev/sway/forc/src/cli/commands/plugins.rs:28:21
```
* Enable storage initializers and dump out a JSON file
* Move the new functions into a separate storage module
* Use StorageSlot directly from fuel-tx
* forc deploy now uses the storage slots
* add some tests
* lint, change initializers -> slots, and fixing some tests
* enhance a comment
* Revert unneeded changes to sway-types
* add a failing test
* Fix failing test
* renaming some functions
* Test the storage slots JSON in e2e tests and add forc json-storage-slots command
* ignore *_output.json
* forc documenter changes
* Remove forc json-storage-slots and stop relying on forc json-abi
* Enhance some comments
* Remove unnecessary oracle
* make items under [project] ordered alphabetically in forc.toml
* issue #1893store/show bytecode hash
* formatted
* added cargo lock file
* cargo toml dependencies in alphabetical order
* hash bin of script or predicate only
* format
* generating bytecode hash only on scripts and predicates
* removed option from Compiled::tree_type
* ran clippy
* added to forc_build documentation
* made filename suffix containing bin hash a constant
* get root of predicate bytecode
* Apply suggestions from code review
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
* if let to match on program type
* Update forc/src/cli/commands/build.rs
updating bin-root filename
Co-authored-by: mitchmindtree <mail@mitchellnordine.com>
* added benchmarks for compilation process
* use macro instead of closure for wrapping parts of compilation process
Co-authored-by: Waseem G <contact@waseem-g.com>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: mitchmindtree <mail@mitchellnordine.com>
Co-authored-by: Toby Hutton <toby@grusly.com>
Previously, if any of the `print` args were set, the rest of the
selected build profile was ignored. This changes the behaviour so that
the command line arguments only override their associated build profile
fields.
Also renames `BuildConfig` to `BuildProfile` and moves it from
`forc_pkg::pkg` to `forc_pkg::manifest` along with the rest of the
serializable manifest types.
* wip
* moving back to PC computer
* adding check function to forc pkg
* have ast returning from forc pkg
* can now successfully parse all sway examples
* fmt
* added forc check
* tidy up lsp tests
* add forc check command
* forc ops doesnt need to be public
* tidy up lsp tests
* remove non relevant code
* rebase on master
* add Cargo.lock file
* add forc check to mdbook
* make items under [project] ordered alphabetically in forc.toml
* issue #1893store/show bytecode hash
* formatted
* added cargo lock file
* cargo toml dependencies in alphabetical order
* hash bin of script or predicate only
* format
* generating bytecode hash only on scripts and predicates
* removed option from Compiled::tree_type
* ran clippy
* added to forc_build documentation
* made filename suffix containing bin hash a constant
* get root of predicate bytecode
* Apply suggestions from code review
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
* if let to match on program type
* Update forc/src/cli/commands/build.rs
updating bin-root filename
Co-authored-by: mitchmindtree <mail@mitchellnordine.com>
Co-authored-by: Waseem G <contact@waseem-g.com>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: mitchmindtree <mail@mitchellnordine.com>
* forc run output is formatted such that key! types and data fields are printed as hex strings
* json abis updated (needed because of preserve_order)
* Receipts are serialized as a single valid JSON, preserve_order removed
* json ABIs reverted to original
* Bump fuel-core to v0.8, and sub-deps.
* Fixes for new version.
* Fix u64 ops test.
* Fix u128 test.
* fix contract ids in test scripts
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>