Skip to content

Commit

Permalink
forc-pkg: throw error for nested workspaces (FuelLabs#4321)
Browse files Browse the repository at this point in the history
  • Loading branch information
eightfilms authored Mar 22, 2023
1 parent a8b5ff4 commit 9ea1695
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 0 deletions.
4 changes: 4 additions & 0 deletions forc-pkg/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,10 @@ impl WorkspaceManifest {
member_path
);
}
if Self::from_file(&member_path).is_ok() {
bail!("Unexpected nested workspace '{}'. Workspaces are currently only allowed in the project root.", member.display());
};

let member_manifest_file = PackageManifestFile::from_file(member_path.clone())?;
let pkg_name = member_manifest_file.manifest.project.name;
pkg_name_to_paths
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
out
target
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["test_workspace"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
category = "fail"

# check: $()Unexpected nested workspace 'test_workspace'. Workspaces are currently only allowed in the project root.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[[package]]
name = 'test_contract'
source = 'member'
dependencies = ['test_lib']

[[package]]
name = 'test_lib'
source = 'member'

[[package]]
name = 'test_script'
source = 'member'
dependencies = ['test_lib']
contract-dependencies = ['test_contract']
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["test_contract", "test_script", "test_lib"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
out
target
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[project]
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "test_contract"
implicit-std = false

[dependencies]
test_lib = { path = "../test_lib/" }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
contract;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
out
target
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[project]
authors = ["Fuel Labs <[email protected]>"]
entry = "lib.sw"
license = "Apache-2.0"
name = "test_lib"
implicit-std = false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
library;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
out
target
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[project]
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "test_script"
implicit-std = false

[dependencies]
test_lib = { path = "../test_lib/" }

[contract-dependencies]
test_contract = { path = "../test_contract" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
script;

fn main() {

}

0 comments on commit 9ea1695

Please sign in to comment.