Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 11 additions & 8 deletions conan/cli/commands/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,17 @@ def _install_build(conan_api: ConanAPI, parser, subparser, build, *args):
ref = RecipeReference.loads(elem["ref"])
for package_level in elem["packages"]:
for package in package_level:
if package["binary"] == "Build": # Build external to Workspace
cmd = f'install {package["build_args"]} {profile_args}'
ConanOutput().box(f"Workspace building external {ref}")
ConanOutput().info(f"Command: {cmd}\n")
conan_api.command.run(cmd)
elif package["binary"] in ("Editable", "EditableBuild"):
path = all_editables[ref]["path"]
output_folder = all_editables[ref].get("output_folder")
ws_pkg = all_editables.get(ref)
is_editable = package["binary"] in ("Editable", "EditableBuild")
if ws_pkg is None:
if is_editable or package["binary"] == "Build": # Build external to Workspace
cmd = f'install {package["build_args"]} {profile_args}'
ConanOutput().box(f"Workspace building external {ref}")
ConanOutput().info(f"Command: {cmd}\n")
conan_api.command.run(cmd)
else:
path = ws_pkg["path"]
output_folder = ws_pkg.get("output_folder")
build_arg = "--build-require" if package["context"] == "build" else ""
ref_args = " ".join(f"--{k}={getattr(ref, k)}"
for k in ("name", "version", "user", "channel")
Expand Down
28 changes: 28 additions & 0 deletions test/integration/workspace/test_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,34 @@ def packages(self):
c.run("workspace build")
assert "conanfile.py (pkga/0.1): Building pkga AND 0.1!!!" in c.out

def test_build_with_external_editable_python_requires(self):
c = TestClient(light=True)
c.save({"conanws.yml": "",
"ext/conanfile.py": GenConanfile("ext", "0.1").with_package_type("python-require"),
"pkga/conanfile.py": GenConanfile("pkga", "0.1").with_python_requires("ext/0.1")
})
c.run("editable add ext")
c.run("workspace add pkga")
c.run("workspace build")
c.assert_listed_binary({"pkga/0.1": ("8bca2eae7cd0d6b6da8d14f8c86069d89d265bd4",
"EditableBuild")})
c.assert_listed_require({"ext/0.1": "Editable"}, python=True)

def test_build_with_external_editable(self):
c = TestClient(light=True)
c.save({"conanws.yml": "",
"ext/conanfile.py": GenConanfile("ext", "0.1").with_build_msg("BUILD EXT!"),
"pkga/conanfile.py": GenConanfile("pkga", "0.1").with_requires("ext/0.1")
})
c.run("editable add ext")
c.run("workspace add pkga")
c.run("workspace build")
assert "ext/0.1: WARN: BUILD EXT!" in c.out
c.assert_listed_binary({"pkga/0.1": ("38f8a554b1b3c2cbb44321f0e731b3863359126c",
"EditableBuild"),
"ext/0.1": ("da39a3ee5e6b4b0d3255bfef95601890afd80709",
"EditableBuild")})


class TestNew:
def test_new(self):
Expand Down
Loading