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

fix full_deploy build folder collision #13612

Merged
merged 4 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion conan/internal/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def full_deploy(graph, output_folder):
for dep in conanfile.dependencies.values():
if dep.package_folder is None:
continue
folder_name = os.path.join(dep.context, dep.ref.name, str(dep.ref.version))
folder_name = os.path.join("full_deploy", dep.context, dep.ref.name, str(dep.ref.version))
build_type = dep.info.settings.get_safe("build_type")
arch = dep.info.settings.get_safe("arch")
if build_type:
Expand Down
18 changes: 9 additions & 9 deletions conans/test/functional/command/test_install_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,18 @@ def package_info(self):
"-s build_type=Debug -s arch=x86")

host_arch = c.get_default_host_profile().settings['arch']
release = c.load(f"output/host/dep/0.1/Release/{host_arch}/include/hello.h")
release = c.load(f"output/full_deploy/host/dep/0.1/Release/{host_arch}/include/hello.h")
assert f"Release-{host_arch}" in release
debug = c.load("output/host/dep/0.1/Debug/x86/include/hello.h")
debug = c.load("output/full_deploy/host/dep/0.1/Debug/x86/include/hello.h")
assert "Debug-x86" in debug
cmake_release = c.load(f"output/dep-release-{host_arch}-data.cmake")
assert 'set(dep_INCLUDE_DIRS_RELEASE "${dep_PACKAGE_FOLDER_RELEASE}/include")' in cmake_release
assert f"${{CMAKE_CURRENT_LIST_DIR}}/host/dep/0.1/Release/{host_arch}" in cmake_release
assert f"${{CMAKE_CURRENT_LIST_DIR}}/full_deploy/host/dep/0.1/Release/{host_arch}" in cmake_release
assert 'set(dep_BUILD_MODULES_PATHS_RELEASE ' \
'"${dep_PACKAGE_FOLDER_RELEASE}/build/my_tools_host.cmake")' in cmake_release
cmake_debug = c.load("output/dep-debug-x86-data.cmake")
assert 'set(dep_INCLUDE_DIRS_DEBUG "${dep_PACKAGE_FOLDER_DEBUG}/include")' in cmake_debug
assert "${CMAKE_CURRENT_LIST_DIR}/host/dep/0.1/Debug/x86" in cmake_debug
assert "${CMAKE_CURRENT_LIST_DIR}/full_deploy/host/dep/0.1/Debug/x86" in cmake_debug
assert 'set(dep_BUILD_MODULES_PATHS_DEBUG ' \
'"${dep_PACKAGE_FOLDER_DEBUG}/build/my_tools_host.cmake")' in cmake_debug

Expand All @@ -198,14 +198,14 @@ def test_deploy_reference():

c.run("install --requires=pkg/1.0 --deploy=full_deploy --output-folder=output")
# NOTE: Full deployer always use build_type/arch, even if None/None in the path, same structure
header = c.load("output/host/pkg/1.0/include/hi.h")
header = c.load("output/full_deploy/host/pkg/1.0/include/hi.h")
assert "hi" in header

# Testing that we can deploy to the current folder too
c.save({}, clean_first=True)
c.run("install --requires=pkg/1.0 --deploy=full_deploy")
# NOTE: Full deployer always use build_type/arch, even if None/None in the path, same structure
header = c.load("host/pkg/1.0/include/hi.h")
header = c.load("full_deploy/host/pkg/1.0/include/hi.h")
assert "hi" in header


Expand All @@ -217,14 +217,14 @@ def test_deploy_overwrite():
c.run("create .")

c.run("install --requires=pkg/1.0 --deploy=full_deploy --output-folder=output")
header = c.load("output/host/pkg/1.0/include/hi.h")
header = c.load("output/full_deploy/host/pkg/1.0/include/hi.h")
assert "hi" in header

# modify the package
c.save({"conanfile.py": GenConanfile("pkg", "1.0").with_package_file("include/hi.h", "bye")})
c.run("create .")
c.run("install --requires=pkg/1.0 --deploy=full_deploy --output-folder=output")
header = c.load("output/host/pkg/1.0/include/hi.h")
header = c.load("output/full_deploy/host/pkg/1.0/include/hi.h")
assert "bye" in header


Expand All @@ -241,7 +241,7 @@ def test_deploy_editable():
# If we don't change to another folder, the full_deploy will be recursive and fail
with c.chdir(temp_folder()):
c.run("install --requires=pkg/1.0 --deploy=full_deploy --output-folder=output")
header = c.load("output/host/pkg/1.0/src/include/hi.h")
header = c.load("output/full_deploy/host/pkg/1.0/src/include/hi.h")
assert "hi" in header


Expand Down
5 changes: 2 additions & 3 deletions conans/test/functional/toolchains/cmake/test_ninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from conan.tools.cmake import CMakeToolchain
from conan.tools.cmake.presets import load_cmake_presets
from conan.tools.build import load_toolchain_args
from conans.test.assets.cmake import gen_cmakelists
from conans.test.assets.genconanfile import GenConanfile
from conans.test.assets.sources import gen_function_h, gen_function_cpp
Expand Down Expand Up @@ -79,7 +78,7 @@ def test_locally_build_linux(build_type, shared, client):
assert 'cmake -G "Ninja"' in client.out
assert "main: {}!".format(build_type) in client.out
client.run(f"install --requires=hello/1.0@ --deploy=full_deploy -of=mydeploy {settings}")
deploy_path = os.path.join(client.current_folder, "mydeploy", "host", "hello", "1.0",
deploy_path = os.path.join(client.current_folder, "mydeploy", "full_deploy", "host", "hello", "1.0",
build_type, "x86_64")
client.run_command(f"LD_LIBRARY_PATH='{deploy_path}/lib' {deploy_path}/bin/myapp")
check_exe_run(client.out, ["main", "hello"], "gcc", None, build_type, "x86_64", cppstd=None)
Expand Down Expand Up @@ -113,7 +112,7 @@ def test_locally_build_msvc(build_type, shared, client):
assert 'cmake -G "Ninja"' in client.out
assert "main: {}!".format(build_type) in client.out
client.run(f"install --requires=hello/1.0@ --deploy=full_deploy -of=mydeploy {settings}")
client.run_command(fr"mydeploy\host\hello\1.0\{build_type}\x86_64\bin\myapp.exe")
client.run_command(fr"mydeploy\full_deploy\host\hello\1.0\{build_type}\x86_64\bin\myapp.exe")
check_exe_run(client.out, ["main", "hello"], "msvc", "19", build_type, "x86_64", cppstd="14")


Expand Down
10 changes: 5 additions & 5 deletions conans/test/integration/symlinks/symlinks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def checker(folder):
c.run("remove * -c")
c.save({}, clean_first=True)
c.run("install --requires=hello/0.1 --deploy=full_deploy")
checker(os.path.join(c.current_folder, "host", "hello", "0.1"))
checker(os.path.join(c.current_folder, "full_deploy", "host", "hello", "0.1"))


@pytest.mark.skipif(platform.system() == "Windows", reason="Requires Symlinks")
Expand Down Expand Up @@ -90,7 +90,7 @@ def checker(folder):
c.run("remove * -c")
c.save({}, clean_first=True)
c.run("install --requires=hello/0.1 --deploy=full_deploy")
checker(os.path.join(c.current_folder, "host", "hello", "0.1"))
checker(os.path.join(c.current_folder, "full_deploy", "host", "hello", "0.1"))


@pytest.mark.skipif(platform.system() == "Windows", reason="Requires Symlinks")
Expand Down Expand Up @@ -127,7 +127,7 @@ def checker(folder):
c.run("remove * -c")
c.save({}, clean_first=True)
c.run("install --requires=hello/0.1 --deploy=full_deploy")
checker(os.path.join(c.current_folder, "host", "hello", "0.1"))
checker(os.path.join(c.current_folder, "full_deploy", "host", "hello", "0.1"))


@pytest.mark.skipif(platform.system() == "Windows", reason="Requires Symlinks")
Expand Down Expand Up @@ -172,7 +172,7 @@ def checker(folder):
c.run("remove * -c")
c.save({}, clean_first=True)
c.run("install --requires=hello/0.1 --deploy=full_deploy")
checker(os.path.join(c.current_folder, "host", "hello", "0.1"))
checker(os.path.join(c.current_folder, "full_deploy", "host", "hello", "0.1"))


@pytest.mark.skipif(platform.system() != "Linux", reason="Only linux")
Expand Down Expand Up @@ -232,7 +232,7 @@ def assert_folder_symlinks(base_folder):
# Check package files are there
package_folder = client2.get_latest_pkg_layout(pref).package()
assert_folder_symlinks(package_folder)
assert_folder_symlinks(os.path.join(client2.current_folder, "host", "hello", "0.1"))
assert_folder_symlinks(os.path.join(client2.current_folder, "full_deploy", "host", "hello", "0.1"))


@pytest.mark.skipif(platform.system() == "Windows", reason="Symlinks not in Windows")
Expand Down