diff --git a/conan/tools/apple/apple.py b/conan/tools/apple/apple.py index b2efefd4820..8bffb654ec9 100644 --- a/conan/tools/apple/apple.py +++ b/conan/tools/apple/apple.py @@ -89,6 +89,7 @@ def __init__(self, conanfile, sdk=None, use_settings_target=False): settings = conanfile.settings if use_settings_target and hasattr(conanfile, "settings_target") and conanfile.settings_target is not None: settings = conanfile.settings_target + self.settings = settings if sdk is None and settings: sdk = apple_sdk_name(settings) @@ -266,7 +267,7 @@ def _fix_executables(conanfile, substitutions): if is_apple_os(conanfile) and conanfile.options.get_safe("shared", False): substitutions = _fix_dylib_files(conanfile) - # Only "fix" executables if dylib files were patched, otherwise + # Only "fix" executables if dylib files were patched, otherwise # there is nothing to do. if substitutions: _fix_executables(conanfile, substitutions) diff --git a/conans/client/migrations_settings.py b/conans/client/migrations_settings.py index 47713239f69..31bd00bf6f3 100644 --- a/conans/client/migrations_settings.py +++ b/conans/client/migrations_settings.py @@ -4029,3 +4029,5 @@ """ settings_1_54_0 = settings_1_53_0 + +settings_1_55_0 = settings_1_54_0 diff --git a/conans/test/unittests/tools/apple/test_apple_tools.py b/conans/test/unittests/tools/apple/test_apple_tools.py index 6331c1dab53..78dd0e93d0f 100644 --- a/conans/test/unittests/tools/apple/test_apple_tools.py +++ b/conans/test/unittests/tools/apple/test_apple_tools.py @@ -2,11 +2,11 @@ from conans.test.utils.mocks import ConanFileMock, MockSettings from conans.test.utils.test_files import temp_folder -from conan.tools.apple import is_apple_os, to_apple_arch, fix_apple_shared_install_name +from conan.tools.apple import is_apple_os, to_apple_arch, fix_apple_shared_install_name, XCRun def test_tools_apple_is_apple_os(): conanfile = ConanFileMock() - + conanfile.settings = MockSettings({"os": "Macos"}) assert is_apple_os(conanfile) == True @@ -16,16 +16,17 @@ def test_tools_apple_is_apple_os(): conanfile.settings = MockSettings({"os": "Windows"}) assert is_apple_os(conanfile) == False - + def test_tools_apple_to_apple_arch(): conanfile = ConanFileMock() - + conanfile.settings = MockSettings({"arch": "armv8"}) assert to_apple_arch(conanfile) == "arm64" conanfile.settings = MockSettings({"arch": "x86_64"}) assert to_apple_arch(conanfile) == "x86_64" + def test_fix_shared_install_name_no_libraries(): conanfile = ConanFileMock( options="""{"shared": [True, False]}""", @@ -36,3 +37,14 @@ def test_fix_shared_install_name_no_libraries(): with pytest.raises(Exception) as e: fix_apple_shared_install_name(conanfile) assert "not found inside package folder" in str(e.value) + + +def test_xcrun_public_settings(): + # https://github.com/conan-io/conan/issues/12485 + conanfile = ConanFileMock() + conanfile.settings = MockSettings({"os": "watchOS"}) + + xcrun = XCRun(conanfile, use_settings_target=True) + settings = xcrun.settings + + assert settings.os == "watchOS"