Skip to content

Commit

Permalink
Ensure msvc fallback does not ignore 194 binaries (#16573)
Browse files Browse the repository at this point in the history
* Ensure msvc fallback does not ignore already existing ones

* Reorder, so same compiler version is checked first

* Simplify test

* Simplify test

* More general test, each combination of factors will now be tested

* Don't unexpectedly shadow variables
  • Loading branch information
AbrilRBS authored Jul 1, 2024
1 parent 9b40332 commit 847e0e8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
8 changes: 4 additions & 4 deletions conans/client/graph/compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def cppstd_compat(conanfile):
new_combinations = []
for comb in combinations:
for f in factor:
comb = comb.copy()
comb.update(f)
new_combinations.append(comb)
combinations = new_combinations
new_comb = comb.copy()
new_comb.update(f)
new_combinations.append(new_comb)
combinations.extend(new_combinations)
ret = []
for comb in combinations:
Expand Down
18 changes: 18 additions & 0 deletions test/integration/package_id/compatible_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,21 @@ def package_id(self):

c.run("install --requires=pdfium/2020.9 -pr=myprofile -s build_type=Debug")
assert "missing. Using compatible package" in c.out

def test_compatibility_msvc_and_cppstd(self):
"""msvc 194 would not find compatible packages built with same version but different cppstd
due to an issue in the msvc fallback compatibility rule."""
tc = TestClient()
profile = textwrap.dedent("""
[settings]
compiler=msvc
compiler.version=194
compiler.runtime=dynamic
""")
tc.save({"dep/conanfile.py": GenConanfile("dep", "1.0").with_setting("compiler"),
"conanfile.py": GenConanfile("app", "1.0").with_require("dep/1.0").with_setting("compiler"),
"profile": profile})

tc.run("create dep -pr=profile -s compiler.cppstd=20")
tc.run("create . -pr=profile -s compiler.cppstd=17")
tc.assert_listed_binary({"dep/1.0": ("b6d26a6bc439b25b434113982791edf9cab4d004", "Cache")})

0 comments on commit 847e0e8

Please sign in to comment.