-
Notifications
You must be signed in to change notification settings - Fork 989
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor apple_min_version_flag() (#16017)
* refactor apple_min_version_flag() * Refactored all the apple module and where it was being used (AutotoolsToolchain and MesonToolchain for now) * Fixed bad return * Fixing tests * Keeping legacy behavior in apple_min_version_flag function * Preventing possible breaking change --------- Co-authored-by: Francisco Ramirez de Anton <franchuti688@gmail.com>
- Loading branch information
1 parent
27a96d4
commit 0f16d0b
Showing
6 changed files
with
137 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import os | ||
import platform | ||
|
||
import pytest | ||
|
||
from conan.tools.apple.apple import XCRun | ||
from conans.test.utils.mocks import ConanFileMock, MockSettings | ||
from conans.util.runners import conan_run | ||
|
||
|
||
@pytest.mark.skipif(platform.system() != "Darwin", reason="Requires OSX and xcrun tool") | ||
def test_xcrun(): | ||
def _common_asserts(xcrun_): | ||
assert xcrun_.cc.endswith('clang') | ||
assert xcrun_.cxx.endswith('clang++') | ||
assert xcrun_.ar.endswith('ar') | ||
assert xcrun_.ranlib.endswith('ranlib') | ||
assert xcrun_.strip.endswith('strip') | ||
assert xcrun_.find('lipo').endswith('lipo') | ||
assert os.path.isdir(xcrun_.sdk_path) | ||
|
||
conanfile = ConanFileMock( runner=conan_run) | ||
conanfile.settings = MockSettings( | ||
{"os": "Macos", | ||
"arch": "x86"}) | ||
xcrun = XCRun(conanfile) | ||
_common_asserts(xcrun) | ||
|
||
conanfile.settings = MockSettings( | ||
{"os": "iOS", | ||
"arch": "x86"}) | ||
xcrun = XCRun(conanfile, sdk='macosx') | ||
_common_asserts(xcrun) | ||
# Simulator | ||
assert "iPhoneOS" not in xcrun.sdk_path | ||
|
||
conanfile.settings = MockSettings( | ||
{"os": "iOS", | ||
"os.sdk": "iphoneos", | ||
"arch": "armv7"}) | ||
xcrun = XCRun(conanfile) | ||
_common_asserts(xcrun) | ||
assert "iPhoneOS" in xcrun.sdk_path | ||
|
||
conanfile.settings = MockSettings( | ||
{"os": "watchOS", | ||
"os.sdk": "watchos", | ||
"arch": "armv7"}) | ||
xcrun = XCRun(conanfile) | ||
_common_asserts(xcrun) | ||
assert "WatchOS" in xcrun.sdk_path | ||
|
||
# Default one | ||
conanfile.settings = MockSettings({}) | ||
xcrun = XCRun(conanfile) | ||
_common_asserts(xcrun) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters