Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor forc-pkg with generic manifest trait #5625

Merged
merged 82 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
50c5471
WIP Source maps
sdankel Dec 13, 2023
b7e9af3
Merge branch 'master' into sophie/sourcemaps
sdankel Dec 19, 2023
9322150
update deps
sdankel Dec 19, 2023
2a8d9fc
Merge branch 'master' into sophie/sourcemaps
sdankel Dec 20, 2023
9dc970d
offsets
sdankel Jan 2, 2024
7d4cf70
breakpoints working
sdankel Jan 9, 2024
a3cd5a0
configuration done
sdankel Jan 10, 2024
29eb2fc
don't overwrite bp id
sdankel Jan 15, 2024
29d4bf6
continue
sdankel Jan 15, 2024
94ca7d7
callstack
sdankel Jan 15, 2024
9c483e6
show registers
sdankel Jan 16, 2024
c6a9a2e
dynamic path
sdankel Jan 16, 2024
fa2ee38
refactoring 1
sdankel Jan 16, 2024
ef8e347
refactor 2
sdankel Jan 16, 2024
981ec6f
refactoring 3
sdankel Jan 16, 2024
67a86b2
format test results
sdankel Jan 16, 2024
381a5d5
cargo fmt
sdankel Jan 16, 2024
54e03a9
Merge branch 'master' into sophie/sourcemaps
sdankel Jan 16, 2024
ffb7fd0
merge conflict
sdankel Jan 16, 2024
a6eb1cf
add jump offset
sdankel Jan 19, 2024
2f7d63d
next, pause, restart
sdankel Jan 19, 2024
11ae91c
Merge branch 'master' into sophie/sourcemaps
sdankel Jan 19, 2024
52b8575
gas and receipts
sdankel Jan 19, 2024
e7a56ae
Merge branch 'master' into sophie/sourcemaps
sdankel Jan 19, 2024
6539626
cleanup
sdankel Jan 19, 2024
82e9433
state refactor
sdankel Jan 19, 2024
3becd91
Merge branch 'master' into sophie/sourcemaps
sdankel Jan 20, 2024
251a61f
feat: implement `-o` flags for disabling optimizations (#5385)
sdankel Jan 24, 2024
928b8d2
Forbid configurables in constants (#5497)
IGI-111 Jan 21, 2024
b7c50fa
Change auto_import test to use git tag of std lib (#5501)
JoshuaBatty Jan 22, 2024
b154f98
set opt level
sdankel Jan 22, 2024
6b7b468
refactor
sdankel Jan 24, 2024
630b817
error handling
sdankel Jan 24, 2024
a8a03a6
Merge branch 'master' into sophie/sourcemaps
sdankel Jan 24, 2024
258eb4f
reenable dce
sdankel Jan 24, 2024
26e46cb
restore vm version
sdankel Jan 24, 2024
b00bf17
don't use test_offset
sdankel Jan 24, 2024
5dac60b
handle_stack_trace
sdankel Jan 24, 2024
ccdada2
project name in workspace
sdankel Jan 24, 2024
170fb41
more handlers
sdankel Jan 24, 2024
6b61819
current opcode
sdankel Jan 29, 2024
62df122
unit tests
sdankel Feb 1, 2024
73ae64f
integration tests
sdankel Feb 2, 2024
a6f3dc5
Merge branch 'master' into sophie/sourcemaps
sdankel Feb 2, 2024
c6f2bed
formatting
sdankel Feb 2, 2024
c096f5b
Merge branch 'master' into sophie/sourcemaps
sdankel Feb 2, 2024
0de86f5
remove commented out code
sdankel Feb 2, 2024
0c17485
feedback
sdankel Feb 5, 2024
d840a00
Merge branch 'master' into sophie/sourcemaps
sdankel Feb 5, 2024
28c8351
simplify build failed err
sdankel Feb 5, 2024
8969018
add imm, hex, and evaluate
sdankel Feb 6, 2024
de8816d
store all instructions in source map
sdankel Feb 6, 2024
100a3b0
remove unused struct
sdankel Feb 6, 2024
5d830bd
Merge branch 'master' into sophie/sourcemaps
sdankel Feb 6, 2024
49199c4
improve tests
sdankel Feb 6, 2024
ff33454
Merge branch 'master' into sophie/sourcemaps
sdankel Feb 6, 2024
44e790e
Disable DCA and writing diagnostics on did_change events (#5555)
JoshuaBatty Feb 6, 2024
df195ef
Bump to v0.50.0 (#5564)
IGI-111 Feb 7, 2024
388323b
Fix build-mdbook CI failure (#5574)
sdankel Feb 7, 2024
3aad2f2
Turn struct field privacy warnings into errors (#5569)
ironcev Feb 8, 2024
1a32c21
u256: log, log2 and sqrt impl (#5329) (#5565)
sudhackar Feb 8, 2024
60a359c
Fixes issue of missing type annotations on explicit returns. (#5575)
esdrubal Feb 8, 2024
37b4e6e
Remove `DeRef` and `DeRefMut` implementations in the `namespace` modu…
jjcnn Feb 8, 2024
2f605d5
Implements Iterator trait and for loops. (#5557)
esdrubal Feb 8, 2024
211ee91
feature not supported msg
sdankel Feb 8, 2024
bf621fa
Merge branch 'master' into sophie/sourcemaps
sdankel Feb 8, 2024
a860ad4
clippy
sdankel Feb 8, 2024
4631726
remove commented out code
sdankel Feb 8, 2024
f452338
more commented out code
sdankel Feb 8, 2024
b79728f
cargo fmt
sdankel Feb 8, 2024
06826e5
Update forc-plugins/forc-debug/tests/fixtures/simple/Forc.toml
sdankel Feb 8, 2024
422fd59
Merge branch 'master' into sophie/sourcemaps
sdankel Feb 9, 2024
b8ddfe1
Merge branch 'master' into sophie/sourcemaps
JoshuaBatty Feb 11, 2024
bcd5f8f
feedback
sdankel Feb 15, 2024
4906bbf
Merge branch 'master' into sophie/sourcemaps
sdankel Feb 15, 2024
9ce9ebd
clippy
sdankel Feb 15, 2024
924deee
Refactor with generic manifest trait
sdankel Feb 16, 2024
7100002
update imports
sdankel Feb 16, 2024
397d537
clippty
sdankel Feb 16, 2024
287c5d6
clippy again
sdankel Feb 16, 2024
40c5a60
Merge branch 'master' into sophie/generic-manifest-trait
sdankel Feb 20, 2024
22e7269
Merge branch 'master' into sophie/generic-manifest-trait
sdankel Feb 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
377 changes: 194 additions & 183 deletions forc-pkg/src/manifest/mod.rs

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions forc-pkg/src/pkg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::manifest::GenericManifestFile;
use crate::{
lock::Lock,
manifest::{
Expand Down Expand Up @@ -579,7 +580,7 @@ impl BuildPlan {
std::env::current_dir()?
};

let manifest_file = ManifestFile::from_dir(&manifest_dir)?;
let manifest_file = ManifestFile::from_dir(manifest_dir)?;
let member_manifests = manifest_file.member_manifests()?;
// Check if we have members to build so that we are not trying to build an empty workspace.
if member_manifests.is_empty() {
Expand Down Expand Up @@ -2760,7 +2761,7 @@ mod test {
.parent()
.unwrap()
.join("test/src/e2e_vm_tests/test_programs/should_pass/forc/workspace_building/");
let manifest_file = ManifestFile::from_dir(&manifest_dir).unwrap();
let manifest_file = ManifestFile::from_dir(manifest_dir).unwrap();
let member_manifests = manifest_file.member_manifests().unwrap();
let lock_path = manifest_file.lock_path().unwrap();
BuildPlan::from_lock_and_manifests(
Expand Down
2 changes: 2 additions & 0 deletions forc-pkg/src/source/git/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
mod auth;

use crate::manifest::GenericManifestFile;
use crate::{
manifest::{self, PackageManifestFile},
source,
Expand Down
1 change: 1 addition & 0 deletions forc-pkg/src/source/ipfs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::manifest::GenericManifestFile;
use crate::{
manifest::{self, PackageManifestFile},
source,
Expand Down
1 change: 1 addition & 0 deletions forc-pkg/src/source/member.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::manifest::GenericManifestFile;
use crate::{manifest::PackageManifestFile, source};
use serde::{Deserialize, Serialize};
use std::{
Expand Down
1 change: 1 addition & 0 deletions forc-pkg/src/source/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub mod path;
mod reg;

use self::git::Url;
use crate::manifest::GenericManifestFile;
use crate::{
manifest::{self, MemberManifestFiles, PackageManifestFile},
pkg::{ManifestMap, PinnedId},
Expand Down
1 change: 1 addition & 0 deletions forc-pkg/src/source/path.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::manifest::GenericManifestFile;
use crate::{manifest::PackageManifestFile, pkg::PinnedId, source};
use serde::{Deserialize, Serialize};
use std::{
Expand Down
1 change: 1 addition & 0 deletions forc-plugins/forc-client/src/op/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{
},
};
use anyhow::{bail, Context, Result};
use forc_pkg::manifest::GenericManifestFile;
use forc_pkg::{self as pkg, PackageManifestFile};
use forc_tracing::println_warning;
use forc_util::default_output_directory;
Expand Down
4 changes: 2 additions & 2 deletions forc-plugins/forc-client/src/util/pkg.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::{collections::HashMap, path::Path, sync::Arc};

use anyhow::Result;
use forc_pkg::manifest::GenericManifestFile;
use forc_pkg::{self as pkg, manifest::ManifestFile, BuildOpts, BuildPlan};
use pkg::{build_with_options, BuiltPackage};
use std::{collections::HashMap, path::Path, sync::Arc};

pub(crate) fn built_pkgs(path: &Path, build_opts: BuildOpts) -> Result<Vec<Arc<BuiltPackage>>> {
let manifest_file = ManifestFile::from_dir(path)?;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::server::{AdapterError, DapServer};
use crate::types::Instruction;
use forc_pkg::manifest::GenericManifestFile;
use forc_pkg::{self, BuildProfile, Built, BuiltPackage, PackageManifestFile};
use forc_test::execute::TestExecutor;
use forc_test::setup::TestSetup;
Expand Down
3 changes: 2 additions & 1 deletion forc-plugins/forc-doc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use clap::Parser;
use cli::Command;
use colored::*;
use forc_pkg as pkg;
use forc_pkg::manifest::GenericManifestFile;
use forc_util::default_output_directory;
use include_dir::{include_dir, Dir};
use pkg::{manifest::ManifestFile, PackageManifestFile};
Expand Down Expand Up @@ -175,7 +176,7 @@ pub fn compile_html(
} else {
std::env::current_dir()?
};
let manifest = ManifestFile::from_dir(&dir)?;
let manifest = ManifestFile::from_dir(dir)?;
let pkg_manifest = if let ManifestFile::Package(pkg_manifest) = &manifest {
pkg_manifest
} else {
Expand Down
5 changes: 4 additions & 1 deletion forc-plugins/forc-fmt/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

use anyhow::{bail, Result};
use clap::Parser;
use forc_pkg::{manifest::ManifestFile, WorkspaceManifestFile};
use forc_pkg::{
manifest::{GenericManifestFile, ManifestFile},
WorkspaceManifestFile,
};
use prettydiff::{basic::DiffOp, diff_lines};
use std::{
default::Default,
Expand Down
3 changes: 2 additions & 1 deletion forc/src/ops/forc_check.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::cli::CheckCommand;
use anyhow::Result;
use forc_pkg as pkg;
use forc_pkg::manifest::GenericManifestFile;
use pkg::manifest::ManifestFile;
use std::path::PathBuf;
use sway_core::{language::ty, Engines};
Expand All @@ -22,7 +23,7 @@ pub fn check(command: CheckCommand, engines: &Engines) -> Result<(Option<ty::TyP
} else {
std::env::current_dir()?
};
let manifest_file = ManifestFile::from_dir(&this_dir)?;
let manifest_file = ManifestFile::from_dir(this_dir)?;
let member_manifests = manifest_file.member_manifests()?;
let lock_path = manifest_file.lock_path()?;
let plan = pkg::BuildPlan::from_lock_and_manifests(
Expand Down
3 changes: 2 additions & 1 deletion forc/src/ops/forc_clean.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::cli::CleanCommand;
use anyhow::{anyhow, bail, Result};
use forc_pkg::manifest::GenericManifestFile;
use forc_pkg::manifest::ManifestFile;
use forc_util::default_output_directory;
use std::path::PathBuf;
Expand All @@ -25,7 +26,7 @@ pub fn clean(command: CleanCommand) -> Result<()> {
)
}
};
let manifest = ManifestFile::from_dir(&manifest_dir)?;
let manifest = ManifestFile::from_dir(manifest_dir)?;
// If this is a workspace collect all member paths and clean each of them.
let paths: Vec<PathBuf> = match manifest {
ManifestFile::Package(_) => std::iter::once(this_dir).collect(),
Expand Down
3 changes: 2 additions & 1 deletion forc/src/ops/forc_update.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::cli::UpdateCommand;
use anyhow::{anyhow, Result};
use forc_pkg::manifest::GenericManifestFile;
use forc_pkg::{self as pkg, lock, Lock};
use forc_util::lock_path;
use pkg::manifest::ManifestFile;
Expand Down Expand Up @@ -33,7 +34,7 @@ pub async fn update(command: UpdateCommand) -> Result<()> {
None => std::env::current_dir()?,
};

let manifest = ManifestFile::from_dir(&this_dir)?;
let manifest = ManifestFile::from_dir(this_dir)?;
let lock_path = lock_path(manifest.dir());
let old_lock = Lock::from_path(&lock_path).ok().unwrap_or_default();
let offline = false;
Expand Down
7 changes: 5 additions & 2 deletions sway-lsp/src/core/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ use lsp_types::{
TextDocumentContentChangeEvent, TextEdit, Url,
};
use parking_lot::RwLock;
use pkg::{manifest::ManifestFile, BuildPlan};
use pkg::{
manifest::{GenericManifestFile, ManifestFile},
BuildPlan,
};
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use std::{
path::PathBuf,
Expand Down Expand Up @@ -323,7 +326,7 @@ impl Session {
pub(crate) fn build_plan(uri: &Url) -> Result<BuildPlan, LanguageServerError> {
let manifest_dir = PathBuf::from(uri.path());
let manifest =
ManifestFile::from_dir(&manifest_dir).map_err(|_| DocumentError::ManifestFileNotFound {
ManifestFile::from_dir(manifest_dir).map_err(|_| DocumentError::ManifestFileNotFound {
dir: uri.path().into(),
})?;
let member_manifests =
Expand Down
1 change: 1 addition & 0 deletions sway-lsp/src/core/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::{
utils::document::{get_path_from_url, get_url_from_path, get_url_from_span},
};
use dashmap::DashMap;
use forc_pkg::manifest::GenericManifestFile;
use forc_pkg::{manifest::Dependency, PackageManifestFile};
use indexmap::IndexMap;
use lsp_types::Url;
Expand Down
1 change: 1 addition & 0 deletions sway-lsp/src/server_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::{
};
use crossbeam_channel::{Receiver, Sender};
use dashmap::DashMap;
use forc_pkg::manifest::GenericManifestFile;
use forc_pkg::PackageManifestFile;
use lsp_types::{Diagnostic, Url};
use parking_lot::RwLock;
Expand Down
Loading