@@ -582,3 +582,62 @@ def package_info(self):
582582 conan_uses_xcconfig = client .load ("conan_uses_components_uses_components.xcconfig" )
583583 assert '#include "conan_has_components_first.xcconfig"' in conan_uses_xcconfig
584584 assert '#include "conan_has_components_second.xcconfig"' not in conan_uses_xcconfig
585+
586+
587+ def test_dont_add_skipped_xcconfigs_when_required_by_components ():
588+ client = TestClient ()
589+ regular_lib = textwrap .dedent ("""
590+ from conan import ConanFile
591+ class PkgWithComponents(ConanFile):
592+ name = 'regular_lib'
593+ version = '1.0'
594+ settings = 'os', 'compiler', 'arch', 'build_type'
595+ def requirements(self):
596+ self.requires('header_skip/1.0')
597+ self.requires('header_transitive/1.0', transitive_headers=True)
598+ def package_info(self):
599+ self.cpp_info.components['component'].requires = ['header_skip::header_skip',
600+ 'header_transitive::header_transitive']
601+ """ )
602+
603+ header_transitive = textwrap .dedent ("""
604+ from conan import ConanFile
605+ class PkgUsesComponent(ConanFile):
606+ name = 'header_transitive'
607+ version = '1.0'
608+ settings = 'os', 'compiler', 'arch', 'build_type'
609+ package_type = 'header-library'
610+ def package_info(self):
611+ self.cpp_info.includedirs = ["include"]
612+ """ )
613+
614+ header_skip = textwrap .dedent ("""
615+ from conan import ConanFile
616+ class PkgUsesComponent(ConanFile):
617+ name = 'header_skip'
618+ version = '1.0'
619+ settings = 'os', 'compiler', 'arch', 'build_type'
620+ package_type = 'header-library'
621+ def package_info(self):
622+ self.cpp_info.includedirs = ["include"]
623+ """ )
624+
625+ client .save ({"header_transitive.py" : header_transitive ,
626+ "header_skip.py" : header_skip ,
627+ "regular_lib.py" : regular_lib })
628+ client .run ("create header_transitive.py" )
629+ client .run ("create header_skip.py" )
630+ client .run ("create regular_lib.py" )
631+ client .run ("install --requires=regular_lib/1.0 -g XcodeDeps" )
632+
633+ conandeps = client .load ("conan_regular_lib_component.xcconfig" )
634+ assert '#include "conan_header_skip.xcconfig"' not in conandeps
635+ assert '#include "conan_header_transitive.xcconfig"' in conandeps
636+
637+ # Verify that header_skip xcconfig files are NOT generated (skipped dependency)
638+ skip_files = [f for f in os .listdir (client .current_folder ) if 'header_skip' in f and f .endswith ('.xcconfig' )]
639+ assert len (skip_files ) == 0 , f"Header skip files should not be generated: { skip_files } "
640+
641+ # Verify that header_transitive xcconfig files ARE generated (transitive dependency)
642+ transitive_files = [f for f in os .listdir (client .current_folder ) if 'header_transitive' in f and f .endswith ('.xcconfig' )]
643+ assert len (transitive_files ) > 0 , f"Header transitive files should be generated: { transitive_files } "
0 commit comments