Skip to content

Commit 8bb8a37

Browse files
AbrilRBSmemshardeddavidsanfalczoidokambala-decapitator
authored
Improve graph resolution for some corner cases (#18947)
* Failing test for reported issue * Sketch solution * new approach * orphan test * Multiple CMake builds from single conanfile (#18905) * cmake multi * wip * wip * reuse multi wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Add `recipes_only` feature for remotes (#18896) * Sketch allow_binary_downloads feature for remotes * Update nbaming to recipes_only * Simpler parsing * Cleanup * Simplify * Use typings, not the type literal, supported only in newer pythons (#18977) * Use typings, not the type literal, supported only in newer pythons * Update conan/api/model/list.py Co-authored-by: James <[email protected]> --------- Co-authored-by: Carlos Zoido <[email protected]> Co-authored-by: James <[email protected]> * Default recipe paths to cwd when not specified when calling Conan (#18964) * Default conanfile paths to current working directory unless told otherwise * Tests, fix missing nargs * Better way to handle new param in default=None case for graphs * Tests for defaulted path * Revert unrelated change * Maybe betetr default for test package * Simplify test * Duplicated line * Remove unused check * Graph build-order comment * Add default in help string * XcodeBuild: extend build parameters (#18668) * allow passing custom build config # Conflicts: # conan/tools/apple/xcodebuild.py * redirect all build artifacts to the build directory * allow passing arbitrary options to xcodebuild * fix xcode tests * fix indent * Revert "fix xcode tests" This reverts commit 95fb3bd. * add param to activate build files redirection * revert format change * handle paths with spaces * add test * improve docstrings * remove use_build_folder * remove docstring * wip * change name to cli_args * minor changes --------- Co-authored-by: Carlos Zoido <[email protected]> * Add `--context={build,host}` filter to `conan audit scan` (#18976) * Add context filter to conan scan * Rename to both * Update to noth have a both argument * Simplify testing * moving legacy vars in CMakeConfigDeps (#18860) * moving legacy vars in CMakeConfigDeps * wip * fix * fix * post_package_id hook (#18960) * post_package_id hook * fix VCVars path with mixed slashes (#18907) * Fix/mesontoolchain linker script (#18922) * fix MesonToolchain definition of linker script with quotes * extra test for cmake * refactor, move http requester to private helpers (#18970) * review, for performance --------- Co-authored-by: Abril Rincón Blanco <[email protected]> * fix CMake presets njobs (#18984) * adding dotenv files (#18266) * adding dotenv files * fix test in multiplatform * Update conan/tools/env/environment.py Co-authored-by: Abril Rincón Blanco <[email protected]> * Sort overrides when serializing * Coverage (#18275) * testing RequirementsInfo * removed conan config-install gz, unused * simplify gzopen_without_timestamps * Allow composition of conf values that are different categories of numbers (#18265) * Add profile composition test for numbers * Add failing test * Allow composition over conf values that are different categories of numbers * new test for lockfile requires error * Add clearer message when missing some keys in graph file * simplify test * new tests for options and settings negation (#18306) * Adding C standard detection (#18290) * Add default C standard detection for various compilers * Add detection for C standard in default settings * Update comments * Remove cstd from default generated profiles Co-authored-by: Abril Rincón Blanco <[email protected]> * Add some unit tests * Remove detect_cstd function * Update detect.py module after removing `detect_cstd` * Update conan/internal/api/detect/detect_api.py * Cleanups --------- Co-authored-by: Abril Rincón Blanco <[email protected]> * [fix] tools.files.copy should exclude symlinks for folders (#18304) * Validate copy exclude for symlinks Signed-off-by: Uilian Ries <[email protected]> * Validate copy exclude for file symlinks Signed-off-by: Uilian Ries <[email protected]> * Validate exclude folder as pattern Signed-off-by: Uilian Ries <[email protected]> * Exclude symlink when matching the pattern Signed-off-by: Uilian Ries <[email protected]> * Keep pep8 format Signed-off-by: Uilian Ries <[email protected]> --------- Signed-off-by: Uilian Ries <[email protected]> * Test/modernize (#18292) * modernize tests * speed up CMake checks * fixing tests * tests short summary * tests short summary * fix test * Add gcc 14.3 * Avoid duplicate component requirements * [fix] Change wording on unzip tool when uncompressing file * use existing test * Refactor cache save to create a list of files to compress and reuse existing function * Applied suggestions * Add test for checking pkglist.json destination compression * Remove pkglist file after compression from tmp folder * Update conan/internal/api/uploader.py Co-authored-by: James <[email protected]> * Expose default_cstd for the build method * Add missing default import * fixing grafted commits (#18315) * fixing grafted commits * --decorate for grafted log msg * check * avoid first --depth=1 * adding --refetch * Add super() test for set_version * wip * wip * wip * wip * wip * wip * wip * wip * [workspace] Removed `home_folder` mechanism (#18339) Removed home_folder definition from WS * Putting conanws as top root for WS if exists * Add support for extra configure arguments (#18333) * Add support for extra configure arguments Signed-off-by: Uilian Ries <[email protected]> * Check configuration type Signed-off-by: Uilian Ries <[email protected]> * Validate type-check for list-like Signed-off-by: Uilian Ries <[email protected]> * Replace extra_configure_args by configure_args Signed-off-by: Uilian Ries <[email protected]> * Do not check type Co-authored-by: Francisco Ramírez <[email protected]> * Do not check type Co-authored-by: Francisco Ramírez <[email protected]> * Revert "Replace extra_configure_args by configure_args" This reverts commit 91ac324. * Simplify tests^ Signed-off-by: Uilian Ries <[email protected]> --------- Signed-off-by: Uilian Ries <[email protected]> Co-authored-by: Francisco Ramírez <[email protected]> * modernizing tests (#18349) * modernizing tests * more tests * moved test * fix conanws folder (#18352) * Fix | Validate if the licenses in the SBOM are SPDX compatible (#18358) * validate spdx_licenses in the sbom, test * add deprecated licenses and fixes * Fix urls for audit command (#18360) * fix url * fix more urls * new test for build-scripts transitive * moved test to integration * Renamed 'editables' to 'packages' * new test for editable with build-host folders * fix parse errors * trying again to define CMAKE_XX_COMPILER in generated presets, only for cl * WIP: added premake toolchain and updated premake generator * Updated premake toolchain * Created build method on Premake, fix cross building and map architectures * Added extra flags on premake generator * Stable version, not complete * Detailed tooling * Improved code generation identation * Add option to disable projects * Removed global projects as it is not an stable solution * Use ConanException instead * Removed possibility of managing different workspaces * Restore multi workspace allowing PremakeToolchain to be used as a plain generator * Added more premake tests * Parametrize premake test * Added some comments * Removed old premake functional test * Added docstring and a way of controlling verbosity on premake * Fixed tests * Revert extra formatting * Remove print * Keep both legacy premake generator logic While introducing new generator by simply enabling PremakeToolchain * Added new tests for premake generators * Drop support for buildenv flags reading * fixing clang-cl autotools * also work for clang-cl * wip * fixing cppstd flag * wip * wip * tests passing * Fix Conan Source folders.root issue - Fixed issue in local.py where source() method did not account for self.folders.root (when specified) - Added test/integration/command/source_test.py::SourceTest::test_local_source_layout_root Close #18376 * Update Integration Test - Test should now pass on windows, linux, and mac OS - Test creates a file in `source()` method and loads the file in the `build()` method. The test will fail if both `source()` and `build()` do not use the same `self.source_folder` * Update test/integration/command/source_test.py * Fix codecov.yml invalid format (#18372) * Add gcc 13.4 (#18374) * Add gcc 13.4 * Update conan/internal/default_settings.py * fixing autotools_exe template, avoiding libtool (#18378) * fixing CmakeConfigDeps link flags (#18367) * Conan 2.18.0-dev * Fix PyInstaller --exclude-module (#18381) add wildcard * fix(tests): fix some non-functional asserts in conflict_diamond_test.py (#18394) * [fix] Honor when raising ConanInvalidConfiguration in hooks (#18385) * Honor ConanInvalidConfiguration in hooks Signed-off-by: Uilian Ries <[email protected]> * Cover post_validate Signed-off-by: Uilian Ries <[email protected]> --------- Signed-off-by: Uilian Ries <[email protected]> * Feature/profile contexts (#18383) * investigating if possible to add context to profile rendering * added test * fix tests * fix tests * Add open functionality to TestClient * Comment * Assert out when running on CI and calling open * [CMakeConfigDeps] Fixed `find_package` in subforlders (#18407) * new test for CMakeConfigDeps with subfolders * wip * fix tests * fix test * fix test * Allow multi version minors for detected compilers * Dont pick up spaces * Dont pick up spaces * Make older gccs explictily return up to minor, to keep compat with old behaviour * [fix] local-recipe-index find bug, select pattern with only name (#18423) * fix with test * Update list_test.py * simplify test * more test cases * [BazelDeps] Pure refactor (#18424) * Refactoring. WIP * wip * Fixed * better remote caching (#18411) * Ensure performance test have known cache location that works everywhere (#18428) * Make performance cache live inside the test folder * Add gitignore for performance cache * Create folders if they don't exist when using `--out-file` (#18427) mkdir for --out-file Co-authored-by: memsharded <[email protected]> * fixing source retrieval when resetting local-index remote (#18418) * feature: Add support for source targets CMakeConfigDeps generator (#18350) * first implementation * implement compontents * fix * clean tests * only linux for tests and cleanup * move tests * move join to jinja template * Update conan/tools/cmake/cmakedeps2/target_configuration.py Co-authored-by: Francisco Ramírez <[email protected]> * Revert "Update conan/tools/cmake/cmakedeps2/target_configuration.py" This reverts commit a55b0c9. * headers not needed * add deduce test * improve test * integrate sources into lib code --------- Co-authored-by: Francisco Ramírez <[email protected]> * Less verbose text upload (#18430) less verbose text upload * [feature] Add generic config for CMake and Meson install strip (#18429) * Use tools.install:strip for CMake Signed-off-by: Uilian Ries <[email protected]> * Add meson install strip Signed-off-by: Uilian Ries <[email protected]> * Validate strip flag when installing with meson Signed-off-by: Uilian Ries <[email protected]> * Improve strip config description Signed-off-by: Uilian Ries <[email protected]> * Fallback for tools.cmake:install_strip Signed-off-by: Uilian Ries <[email protected]> * Use deprecation flag for config Co-authored-by: James <[email protected]> * Reduce install strip property Signed-off-by: Uilian Ries <[email protected]> * Rename config to tools.build.install:strip Signed-off-by: Uilian Ries <[email protected]> * Rename config to tools.build.install_strip Signed-off-by: Uilian Ries <[email protected]> * Fix typo tools.build.install_strip Signed-off-by: Uilian Ries <[email protected]> --------- Signed-off-by: Uilian Ries <[email protected]> Co-authored-by: James <[email protected]> * Add support for sbom and lockfiles for conan audit list (#18437) * Add support for sbom and lockfiles for conan audit list * Ensure sbom is cyclone * Fix remote for list * Add test for pkglist with remote --------- Co-authored-by: Carlos Zoido <[email protected]> * fixing CMake presets on Windows with backslash (#18435) * fixing CMake presets on Windows with backslash * adding checks to test * Fix: parse -cc args when running "conan cache backup-upload" * [fix] Add support for Git tree-less repository when getting the URL (#18444) * Add test to validate Git treeless clone support Signed-off-by: Uilian Ries <[email protected]> * Remove git method from the remote url Signed-off-by: Uilian Ries <[email protected]> * rsplit FTW Signed-off-by: Uilian Ries <[email protected]> * Always return string Signed-off-by: Uilian Ries <[email protected]> * Filter out (fetch) and (push) Signed-off-by: Uilian Ries <[email protected]> --------- Signed-off-by: Uilian Ries <[email protected]> * fix issue with missing folder in local-recipes-index (#18449) * `conan export-pkg` now correctly passes a `str` as the conanfile version (#18456) * conan export-pkg now correctly passes a str as the conanfile version * Add type test * Add test to verify that we always call parse_args for every command * Work for workspace too * Added wasm64 architecture * Added MEMORY64=1 on wasm64 to architecture_flag function * Support asm.js arch correctly * Added emcc compiler support * Added emcc compiler support * WIP Added functional tests * WIP: Added emscripten on windows * WIP: Added emscripten on windows * WIP: Added emscripten on windows * WIP: Added emscripten on windows * WIP: Added emscripten on windows * WIP: Added emscripten on windows * Fix dockerfile * Fix dockerfile * Fix dockerfile * Fix dockerfile * Add EM_CACHE in docker container * Pre build emscripten binaries on image and remove windows specific tests * Pre build emscripten binaries on image and remove windows specific tests * Pre build emscripten binaries on image and remove windows specific tests * Only run node wasm64 on macos * Relax tests to be os agnostic * Removed unneded platform_tool_requires * do not call generators for editables not being built (#18402) * Skip emcc tests on python < 3.8 (#18461) * fix in autotools win-clang and test for NMake with clang-cl * fix tests * Update test/functional/utils.py * Removed -rf pytest option and leave default (-rfE) which prints failed tests at the end * refactoring graph node.dependencies->node.edges (#18463) * refactoring graph node.dependencies->node.edges * fix sbom * adding a deprecation warning and fallback for Node.dependencies->edges * [new command] `conan report diff` to inspect diffs between versions and revisions (#18247) * wip * wip Co-Authored-By: Abril Rincón Blanco <[email protected]> * Fix sidebar overflow behaviour, escape lines of html charcaters * Update conan/cli/commands/compare.py Co-authored-by: James <[email protected]> * Update conan/cli/commands/compare.py Co-authored-by: James <[email protected]> * Cleanup html diff generation, follow formatter style from Conan commands * Fix imports * Simplify parameter handling, fix ref report for download * Add search bar * Fix list visuals after search * Improve performance for large diffs * Add json formatter --------- Co-authored-by: Ernesto de Gracia Herranz <[email protected]> * Typo * Avoid encoding issues by ignoring them The implementation right now is a bit ugly, will simplify when it's ready --------- Co-authored-by: Ernesto de Gracia Herranz <[email protected]> * Add some basic tests --------- Co-authored-by: Ernesto de Gracia Herranz <[email protected]> * improve test and use "--- a" instead of "diff --git" (path with spaces) * fix * fix path * change html test * wip * Make test fail when there are patches * Test confgiure_source * Test for patches * Html test * Tests * test contents * replace("\\", "/") for windows and use buffer to reorderlines * fix * fix * fix new files, and fix tests * Rename * Break everything * Don't show repeated files * Simplify generation, share json/html inut data * Fix styling * More expressive check * Move to api? This might get reverted later if we find a better place * Improve output * Add exclude search * Don't take into account paths when filtering * Remove duplication, don't try tro download cache refs * Typo * fix test * Dont modify load function * Rename function * Use conan_run * Hide git diff stderr * Revert check_output_runner * Fix issues with paths --------- Co-authored-by: Abril Rincón Blanco <[email protected]> Co-authored-by: Abril Rincón Blanco <[email protected]> Co-authored-by: James <[email protected]> * XcodeToolchain: fix deployment target for non-macOS (#18471) * XcodeToolchain: fix deployment target for non-macOS * remove duplicate line * add new test * Simplify testing * Simplify testing --------- Co-authored-by: Abril Rincón Blanco <[email protected]> * Fix head method not working in testing mocked requests * [PkgConfigDeps] Mechanism to skip some `*.pc` files creation (#18439) * Add pkg_config_skip property to PkgConfigDeps * Add pkg_config_skip property to PkgConfigDeps test * Remove debug message * Remove unsued import * Move to use none pkg_config_name * Update conan/tools/gnu/pkgconfigdeps.py * Component whose main is skipped should define the pkg_config_name * None components is not hidden * Review * Update test/integration/toolchains/gnu/test_pkgconfigdeps.py Co-authored-by: Francisco Ramírez <[email protected]> --------- Co-authored-by: Francisco Ramírez <[email protected]> * Give wasm support to premake toolchain * Improved premake toolchain: - Support fPIC option - Support emcc compiler and other architectures - Added premake exe and lib templates - Improved test cases detecting new issues - Fixed arch bug * Added shared option support on premake libs * Fix premake integration tests * Fix tests * Changed dylib for so as test runs in linux * Run premake test only in linux * Update pyproject.toml Co-authored-by: James <[email protected]> * Feature: workspace create (#18390) * workspace Python files proposal * fixes * review * workspace create * wip * wip * tests passing * wip * wip * wip * wip * wip * tests passing, first proposal for orchestrated build + create * dynamic ref attributes for conan workspace create * test for conan workspace build too * wip * Update conan/cli/commands/workspace.py Co-authored-by: Abril Rincón Blanco <[email protected]> * wip * [feature] Add generic config for CMake and Meson install strip (#18429) * Use tools.install:strip for CMake Signed-off-by: Uilian Ries <[email protected]> * Add meson install strip Signed-off-by: Uilian Ries <[email protected]> * Validate strip flag when installing with meson Signed-off-by: Uilian Ries <[email protected]> * Improve strip config description Signed-off-by: Uilian Ries <[email protected]> * Fallback for tools.cmake:install_strip Signed-off-by: Uilian Ries <[email protected]> * Use deprecation flag for config Co-authored-by: James <[email protected]> * Reduce install strip property Signed-off-by: Uilian Ries <[email protected]> * Rename config to tools.build.install:strip Signed-off-by: Uilian Ries <[email protected]> * Rename config to tools.build.install_strip Signed-off-by: Uilian Ries <[email protected]> * Fix typo tools.build.install_strip Signed-off-by: Uilian Ries <[email protected]> --------- Signed-off-by: Uilian Ries <[email protected]> Co-authored-by: James <[email protected]> * Add support for sbom and lockfiles for conan audit list (#18437) * Add support for sbom and lockfiles for conan audit list * Ensure sbom is cyclone * Fix remote for list * Add test for pkglist with remote --------- Co-authored-by: Carlos Zoido <[email protected]> * fixing CMake presets on Windows with backslash (#18435) * fixing CMake presets on Windows with backslash * adding checks to test * Fix: parse -cc args when running "conan cache backup-upload" * [fix] Add support for Git tree-less repository when getting the URL (#18444) * Add test to validate Git treeless clone support Signed-off-by: Uilian Ries <[email protected]> * Remove git method from the remote url Signed-off-by: Uilian Ries <[email protected]> * rsplit FTW Signed-off-by: Uilian Ries <[email protected]> * Always return string Signed-off-by: Uilian Ries <[email protected]> * Filter out (fetch) and (push) Signed-off-by: Uilian Ries <[email protected]> --------- Signed-off-by: Uilian Ries <[email protected]> * fix issue with missing folder in local-recipes-index (#18449) * removed --local * renamed editables->packages * wip * wip * new test to check global.conf/-cc --------- Signed-off-by: Uilian Ries <[email protected]> Co-authored-by: Abril Rincón Blanco <[email protected]> Co-authored-by: Uilian Ries <[email protected]> Co-authored-by: Carlos Zoido <[email protected]> Co-authored-by: LUCAS K DAL CASTEL <[email protected]> * Removed ObjC/C++ flags from C/C++ ones * wip * Added Objective C/C++ flags to both Gnu/Autotools toolchain * Fix * Fix * implementing support for exe editables in CMakeConfigDeps (#18489) * implementing support for exe editables in CMakeConfigDeps * fix _package_framework var * Added architecture linker specific flags to toolchains * fix detection of riscv64 cpu in Meson toolchain * fix broken tests in windows * Remove print Co-authored-by: Carlos Zoido <[email protected]> * Fixed elif issue in cmake blocks and added unit test * Fix issues with `self.generator_info` (#18503) * Failing tests * Make second one fail too * Fixes * Discard changes to conan/internal/model/conan_file.py * Update test/integration/generators/test_generators_from_br.py * Update test/integration/generators/test_generators_from_br.py * Fix tests * add fix to support git<2.36 (#18501) * avoid leaking core.conf in user profiles (#18474) * avoid leaking core.conf in user profiles * Update conan/internal/model/conf.py Co-authored-by: Francisco Ramírez <[email protected]> --------- Co-authored-by: Francisco Ramírez <[email protected]> * Improvement over ill-formed graphs with different visible=True/False for the same dependency (#18440) * wip * wip * wip * removed GraphRuntimeError in favor of GraphConflictError * wip * better removal of orphans * simplified * reduced warnings * reducing warnings * new output proposal * new output warnings * [workspace] Changed `conanws.yml` format (#18493) * Dynamically loading the name and version * Fixed * Fixed commands * wip * Changing tests * Fixed tests * Suggestions * test * wip * Update conan/internal/model/workspace.py Co-authored-by: James <[email protected]> * Update conan/api/subapi/workspace.py Co-authored-by: James <[email protected]> * wip * Raising error if duplicated references. Added test --------- Co-authored-by: James <[email protected]> * small fix sbom component bom-ref * 1_6 * Added architecture linker specific flags to premake * Add build_folder parameter in basic_layout (#18442) * add build_folder * test and use subproject path * Added threads subsetting in emcc compiler model (#18520) * Added threads subsetting on emcc compiler model * Fixed test * Return list instead * Update test/integration/toolchains/meson/test_mesontoolchain.py * Added integration tests to every toolchain * WIP fix windows tests * Fix windows autotools tests --------- Co-authored-by: James <[email protected]> * fix qcc cppstd support for latest QNX 8.0 for c++20 (#18538) * new 'conan cache ref <path>' to reverse-look the Conan cache (#18518) * new 'conan cache ref <path>' to reverse-look the Conan cache * fix * fix bad paths stacktrace * wip * review * avoid incorrect definitions in conf_info (#18541) * avoid incorrect user.xxx definitions in conf_info * test tools.xxx too * more efficient checks * Fix: Fix cache check-intregrity output (#18544) * Fix: Fix cache check-intregrity output * bring indent back * fix tests * add missing package file test * fix test * better error message for wrong cpp_info.requires (#18552) * Avoid library renames when Meson + Windows + MSVC static builds (#18533) * wip * Added splitext cmake function * wip * Added functional test * Adding CMakeConfigDeps * CMakeDeps backporting future change from CMake newer versions. Removed PkgConfigDeps change (too risky). Moved and modified test * reducing diff * add assert message in CMakeConfigDeps (#18558) * better error message in CMakeConfigDeps for incorrect component requires (#18562) * fix incorrect inputs for relativize paths generator (#18561) * allow consuming meson libname.a libs in MSBuildDeps (#18557) * allow consuming meson libname.a libs in MSBuildDeps * fix test in OSX * Avoid hyphens for msbuild verbosity argument passed to CMake after -- in powershell (#18548) * replace - for / * wip * test powershell in integration * simplify * remove unused fixture * define CMake try-compile configuration (#18559) * define CMake try-compile configuration * risky fix * try_compile only for known configurations * add checks in tests * guard cmake_try_compile_configuration * Conan 2.19.0-dev * Preamke generator: fix some issues with windows paths and MSBuild (#18572) * Preamke generator: fix some issues with windows paths and MSBuild * Added integration test case for msbuild_platform * Revert Better remote caching (#18586) * Revert "better remote caching (#18411)" This reverts commit ad76fa2. * Bump version * Add gcc 12.5 (#18587) * Test refactor and improvements (#18576) * improving tests * rmeoved old config_path from tests * wip * wip * wip * wip * fix tests * removed xfailed test only fails in Windows if short-paths but not CI * Fix `test_makefile_sysroot` test in Windows (#18595) * Fix test_makefile_sysroot test in Windows * Different paths for Windows * Autotools: Added new makefile parameter to make function (#18578) * Added new makefile parameter to make * Use -f instead of --makefile option * Use long option instead * fix: Typo (#18571) Co-authored-by: James <[email protected]> * Add freeze_support (#18603) * Add freeze_support * Freeze support call inside the __main__ method * [Part 2] Better remote caching (#18588) * Let's avoid saving the whole object * Caching only NotFoundException. Restoring remote.invalidate_cache() calls * Cleaner * CMakeConfigDeps filter requires() to package_type=application (#18611) * SSH runner: User friendly paramiko import protection (#18566) * User friendly paramiko import protection * Updated exception message * Test/improvements (#18616) * modernizing tests to pytest * more tests * another batch * finished refactor of unittest * wip * wip * Debounce search input on html formats (#18575) * Debounce search input * Debounce search input for html graph too * Focus from current pov * Update conan/cli/formatters/report/diff_html.py Co-authored-by: Ernesto de Gracia Herranz <[email protected]> --------- Co-authored-by: Ernesto de Gracia Herranz <[email protected]> * enabling test_package_folder for conan export-pkg command (#18621) * Allow auto-detect with custom cc paths including spaces (#18628) * wip * wip * fix tests * fix login messages hidden by verbosity level (#18642) * Add explicit error when trying to export a reference with `channel` but no `user` (#18646) * Error out if trying to export ref with channel and no user * Add test * PLay around with class attributes * Fix error * Remove redundant check * Review * add `@user/channel` to SBOM (#18649) * add user channel to sbom * Update conan/tools/sbom/cyclonedx.py Co-authored-by: Abril Rincón Blanco <[email protected]> * fix --------- Co-authored-by: Abril Rincón Blanco <[email protected]> * Improve version detection for cc compilers (#18600) * Skip build information for gcc if present * Simpler cc detection * Let `conan source` reference the backup sources it generates in more cases (#18655) * Let conan source reference the sources it downloads in more cases * Test that the cache backup-upload also tries to upload non unknown references * PremakeDeps: ensure correct linkage on dependent libraries (#18631) * fix: 🐛 PremakeDeps was not providing correct link order to the linker Co-authored-by: Abril Rincón Blanco <[email protected]> * Update conan/tools/premake/premakedeps.py Co-authored-by: Abril Rincón Blanco <[email protected]> * Fixed tests * Removed redundant assert * Improved test case on PremakeDeps --------- Co-authored-by: Abril Rincón Blanco <[email protected]> Co-authored-by: Abril Rincón Blanco <[email protected]> * serialize conandata information (#18661) * Add `cmake_target_aliases` support for `CMakeConfigDeps` (#18662) * Add support for cmake_target_aliases * Add aliases tests, coming from old cmakedeps * Fix aliases for imported default target * Remove redundant target store * Restrict cmake version * Typo * Check for duplication caused by aliases * Dont let users alias the global target * Remove redundant test * Create api helpers to help with initialization order and caching of common objects (#18644) * Check conan version before loading hooks * Make helpers class, name to be decided * Rename, pep8 blank lines * parametrize on reinit * Reinit helpers * wip * experimental * review * fix and new test --------- Signed-off-by: Uilian Ries <[email protected]> Co-authored-by: Abril Rincón Blanco <[email protected]> Co-authored-by: Abril Rincón Blanco <[email protected]> Co-authored-by: shtanko-sv <[email protected]> Co-authored-by: Uilian Ries <[email protected]> Co-authored-by: Francisco Ramirez de Anton <[email protected]> Co-authored-by: danimtb <[email protected]> Co-authored-by: PerseoGI <[email protected]> Co-authored-by: Ernesto de Gracia Herranz <[email protected]> Co-authored-by: Carlos Zoido <[email protected]> Co-authored-by: Timothy J Viola <[email protected]> Co-authored-by: PerseoGI <[email protected]> Co-authored-by: Nikita Rudenko <[email protected]> Co-authored-by: LUCAS K DAL CASTEL <[email protected]> Co-authored-by: Andrey Filipenkov <[email protected]> Co-authored-by: Michaël Melchiore <[email protected]> Co-authored-by: Dominik Wernberger <[email protected]> Co-authored-by: Ernesto de Gracia Herranz <[email protected]> * potential fix * cleaned up --------- Signed-off-by: Uilian Ries <[email protected]> Co-authored-by: memsharded <[email protected]> Co-authored-by: David Sánchez Falero <[email protected]> Co-authored-by: Carlos Zoido <[email protected]> Co-authored-by: James <[email protected]> Co-authored-by: Andrey Filipenkov <[email protected]> Co-authored-by: shtanko-sv <[email protected]> Co-authored-by: Uilian Ries <[email protected]> Co-authored-by: Francisco Ramirez de Anton <[email protected]> Co-authored-by: danimtb <[email protected]> Co-authored-by: PerseoGI <[email protected]> Co-authored-by: Ernesto de Gracia Herranz <[email protected]> Co-authored-by: Timothy J Viola <[email protected]> Co-authored-by: PerseoGI <[email protected]> Co-authored-by: Nikita Rudenko <[email protected]> Co-authored-by: LUCAS K DAL CASTEL <[email protected]> Co-authored-by: Michaël Melchiore <[email protected]> Co-authored-by: Dominik Wernberger <[email protected]> Co-authored-by: Ernesto de Gracia Herranz <[email protected]>
1 parent f978fda commit 8bb8a37

File tree

3 files changed

+72
-5
lines changed

3 files changed

+72
-5
lines changed

conan/internal/graph/graph.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,13 @@ def propagate_downstream(self, require, node, visibility_conflicts, src_node=Non
138138

139139
assert not require.version_range # No ranges slip into transitive_deps definitions
140140
# TODO: Might need to move to an update() for performance
141-
self.transitive_deps.pop(require, None)
141+
poped = self.transitive_deps.pop(require, None)
142142
self.transitive_deps[require] = TransitiveRequirement(require, node)
143-
if ill_formed: # remove dead .edges, to avoid orphans
144-
direct_nodes = set(t.node for t in self.transitive_deps.values() if t.require.direct)
145-
self.edges = [e for e in self.edges if e.dst in direct_nodes]
143+
if poped is not None: # adjust .edges, to avoid orphans
144+
for e in self.edges:
145+
if e.dst is poped.node: # check for identity, pointing to that node
146+
e.dst = node
147+
break
146148

147149
if self.conanfile.vendor:
148150
return

conan/internal/graph/graph_builder.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def _expand_require(self, require, node, graph, profile_host, profile_build, gra
7474
# node -(require)-> previous (creates a diamond with a previously existing node)
7575
# TODO: allow bootstrapping, use references instead of names
7676
# print(" Expanding require ", node, "->", require)
77+
self._deduce_host_version(require, node)
7778
previous = node.check_downstream_exists(require)
7879
prev_node = None
7980
if previous is not None:
@@ -338,7 +339,8 @@ def _resolve_replace_requires(self, node, require, profile_build, profile_host,
338339
node.replaced_requires[original_require] = require
339340
break # First match executes the alternative and finishes checking others
340341

341-
def _create_new_node(self, node, require, graph, profile_host, profile_build, graph_lock):
342+
@staticmethod
343+
def _deduce_host_version(require, node):
342344
require_version = str(require.ref.version)
343345
if require_version.startswith("<host_version") and require_version.endswith(">"):
344346
if not require.build or require.visible:
@@ -357,6 +359,7 @@ def _create_new_node(self, node, require, graph, profile_host, profile_build, gr
357359
"host dependency")
358360
require.ref.version = transitive.require.ref.version
359361

362+
def _create_new_node(self, node, require, graph, profile_host, profile_build, graph_lock):
360363
resolved = self._resolved_system(node, require, profile_build, profile_host,
361364
self._resolve_prereleases)
362365
if graph_lock is not None:

test/integration/build_requires/build_requires_test.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,68 @@ def build_requirements(self):
565565
else:
566566
assert "pkg/0.1: Package '39f6a091994d2d080081ea888d75ef65c1d04c8d' created" in c.out
567567

568+
@pytest.mark.parametrize("shared", [True, False])
569+
def test_host_version_transitive_contexts(self, shared):
570+
# app ---------------------------------------> protobuf (shared)
571+
# \---tool-require-> grpc/<host> (shared) -> protobuf (shared)
572+
# \--tool-require-------(host)----------------/
573+
tc = TestClient(light=True)
574+
tc.save({"grpc/conanfile.py": GenConanfile("grpc", "0.1").with_shared_option(shared)
575+
.with_requirement("protobuf/0.1"),
576+
"protobuf/conanfile.py": GenConanfile("protobuf", "0.1")
577+
.with_shared_option(shared),
578+
"conanfile.py": GenConanfile("app", "0.1").with_requires("protobuf/[*]")
579+
.with_tool_requirement("grpc/[*]")
580+
.with_tool_requirement("protobuf/<host_version>")
581+
})
582+
tc.run("export protobuf")
583+
tc.run("export grpc")
584+
tc.run("graph info .")
585+
assert "Conflict between" not in tc.out
586+
587+
@pytest.mark.parametrize("shared", [True, False])
588+
def test_host_version_transitive_contexts2(self, shared):
589+
# app -> grpc (shared) -> protobuf (shared)
590+
# \-----------------------/
591+
# \---tool-require-> grpc/<host> (shared) -> protobuf (shared)
592+
# \--tool-require-------(host)----------------/
593+
tc = TestClient(light=True)
594+
tc.save({"grpc/conanfile.py": GenConanfile("grpc", "0.1").with_shared_option(shared)
595+
.with_requirement("protobuf/0.1"),
596+
"protobuf/conanfile.py": GenConanfile("protobuf", "0.1")
597+
.with_shared_option(shared),
598+
"conanfile.py": GenConanfile("app", "0.1").with_requires("grpc/0.1")
599+
.with_requires("protobuf/[*]")
600+
.with_tool_requirement("grpc/<host_version>")
601+
.with_tool_requirement("protobuf/<host_version>")
602+
})
603+
tc.run("export protobuf")
604+
tc.run("export grpc")
605+
tc.run("graph info .")
606+
assert "Conflict between" not in tc.out
607+
608+
def test_host_version_transitive_contexts_orphan(self):
609+
tc = TestClient(light=True)
610+
tc.save({"grpc/conanfile.py": GenConanfile("grpc", "0.1")
611+
.with_requirement("protobuf/0.1").with_shared_option(False),
612+
"protobuf/conanfile.py": GenConanfile("protobuf", "0.1").with_shared_option(False),
613+
"conanfile.py": GenConanfile("app", "0.1").with_requires("grpc/0.1")
614+
.with_requires("protobuf/[*]")
615+
.with_tool_requirement("protobuf/<host_version>")
616+
.with_tool_requirement("grpc/<host_version>")})
617+
tc.run("export protobuf")
618+
tc.run("export grpc")
619+
tc.run("graph info . -o:a=*:shared=True -f=json", redirect_stdout="graph.json")
620+
data = json.loads(tc.load("graph.json"))
621+
622+
def _assert_no_orphan(deps_graph):
623+
ids = set(deps_graph["nodes"].keys())
624+
seen = set(deps_graph["root"].keys())
625+
for node in deps_graph["nodes"].values():
626+
seen.update(node["dependencies"].keys())
627+
assert not ids - seen, f"Orphan nodes found: {ids - seen}"
628+
_assert_no_orphan(data["graph"])
629+
568630
def test_user_channel_error(self):
569631
lib = textwrap.dedent("""
570632
from conan import ConanFile

0 commit comments

Comments
 (0)