@@ -385,3 +385,64 @@ def test_transitive_orphans(self, order, test):
385385 assert dep_pkg2 ["visible" ] is True
386386 assert dep_pkg3 ["ref" ] == "pkg3/1.1"
387387 assert dep_pkg2 ["visible" ] is True
388+
389+
390+ def test_visible_order_issue ():
391+ # libc -> libb/1.0 (static) -> lib_a/1.1 (header)
392+ # \-------------------------------/
393+ # Order mattered here
394+ # libc2 ---------------------> lib_a/1.1 (header)
395+ # \----> libb/1.0 (static) -> lib_a/1.2 (header)
396+ c = TestClient (light = True )
397+ c .save ({"liba/conanfile.py" : GenConanfile ("lib_a" ).with_package_type ("header-library" ),
398+ "libb/conanfile.py" : GenConanfile ("lib_b" , "1.0" ).with_package_type ("static-library" )
399+ .with_requires ("lib_a/[>=1]" ),
400+ "libc/conanfile.py" : GenConanfile ("lib_c" , "1.0" ).with_package_type ("shared-library" )
401+ .with_requirement ("lib_b/1.0" ,
402+ visible = False )
403+ .with_requirement ("lib_a/1.1" ),
404+ "libc2/conanfile.py" : GenConanfile ("lib_c" , "1.0" ).with_package_type ("shared-library" )
405+ .with_requirement ("lib_a/1.1" )
406+ .with_requirement ("lib_b/1.0" ,
407+ visible = False ),
408+ })
409+ c .run ("export liba --version=1.0" )
410+ c .run ("export liba --version=1.1" )
411+ c .run ("export liba --version=1.2" )
412+ c .run ("export libb" )
413+ c .run ("graph info libc --format=json" )
414+ graph = json .loads (c .stdout )
415+ assert len (graph ["graph" ]["nodes" ]) == 3
416+
417+ c .run ("graph info libc2 --format=json" )
418+ graph = json .loads (c .stdout )
419+ assert len (graph ["graph" ]["nodes" ]) == 3
420+
421+
422+ def test_visible_order_full_diamond_issue ():
423+ c = TestClient (light = True )
424+ c .save ({"liba/conanfile.py" : GenConanfile ("lib_a" ).with_package_type ("header-library" ),
425+ "libb/conanfile.py" : GenConanfile ("lib_b" , "1.0" ).with_package_type ("static-library" )
426+ .with_requires ("lib_a/[>=1]" ),
427+ "libd/conanfile.py" : GenConanfile ("lib_d" , "1.0" ).with_package_type ("static-library" )
428+ .with_requires ("lib_a/1.1" ),
429+ "libc/conanfile.py" : GenConanfile ("lib_c" , "1.0" ).with_package_type ("shared-library" )
430+ .with_requirement ("lib_b/1.0" ,
431+ visible = False )
432+ .with_requirement ("lib_d/1.0" ),
433+ "libc2/conanfile.py" : GenConanfile ("lib_c" , "1.0" ).with_package_type ("shared-library" )
434+ .with_requirement ("lib_d/1.0" )
435+ .with_requirement ("lib_b/1.0" ,
436+ visible = False ),
437+ })
438+ c .run ("export liba --version=1.0" )
439+ c .run ("export liba --version=1.1" )
440+ c .run ("export liba --version=1.2" )
441+ c .run ("export libb" )
442+ c .run ("export libd" )
443+ c .run ("graph info libc" , assert_error = True )
444+ assert "ERROR: Version conflict: Conflict between lib_a/1.1 and lib_a/1.2 in the graph" in c .out
445+
446+ c .run ("graph info libc2 --format=json" )
447+ graph = json .loads (c .stdout )
448+ assert len (graph ["graph" ]["nodes" ]) == 4
0 commit comments