Native: rename Xcode.current to .findCurrent()
To reflect that it is a non-trivial operation with possible performance overhead.
This commit is contained in:
committed by
Space
parent
e92f7b5ec3
commit
5afbbecea4
@@ -259,7 +259,7 @@ private fun simulator(project: Project): ExecutorService = object : ExecutorServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val simctl by lazy {
|
private val simctl by lazy {
|
||||||
val sdk = Xcode.current.pathToPlatformSdk(configurables.platformName())
|
val sdk = Xcode.findCurrent().pathToPlatformSdk(configurables.platformName())
|
||||||
val out = ByteArrayOutputStream()
|
val out = ByteArrayOutputStream()
|
||||||
val result = project.exec {
|
val result = project.exec {
|
||||||
commandLine("/usr/bin/xcrun", "--find", "simctl", "--sdk", sdk)
|
commandLine("/usr/bin/xcrun", "--find", "simctl", "--sdk", sdk)
|
||||||
@@ -638,7 +638,7 @@ fun KonanTestExecutable.configureXcodeBuild() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val sdk = when (project.testTarget) {
|
val sdk = when (project.testTarget) {
|
||||||
KonanTarget.IOS_ARM32, KonanTarget.IOS_ARM64 -> Xcode.current.iphoneosSdk
|
KonanTarget.IOS_ARM32, KonanTarget.IOS_ARM64 -> Xcode.findCurrent().iphoneosSdk
|
||||||
else -> error("Unsupported target: ${project.testTarget}")
|
else -> error("Unsupported target: ${project.testTarget}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable {
|
|||||||
val configs = project.testTargetConfigurables as AppleConfigurables
|
val configs = project.testTargetConfigurables as AppleConfigurables
|
||||||
val swiftPlatform = configs.platformName().toLowerCase()
|
val swiftPlatform = configs.platformName().toLowerCase()
|
||||||
val simulatorPath = when (configs.targetTriple.isSimulator) {
|
val simulatorPath = when (configs.targetTriple.isSimulator) {
|
||||||
true -> Xcode.current.getLatestSimulatorRuntimeFor(configs.target.family, configs.osVersionMin)
|
true -> xcode.getLatestSimulatorRuntimeFor(configs.target.family, configs.osVersionMin)
|
||||||
?.bundlePath
|
?.bundlePath
|
||||||
?.let { "$it/Contents/Resources/RuntimeRoot/usr/lib/swift" }
|
?.let { "$it/Contents/Resources/RuntimeRoot/usr/lib/swift" }
|
||||||
else -> null
|
else -> null
|
||||||
@@ -255,7 +255,7 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable {
|
|||||||
if (configurables.targetTriple.isSimulator) {
|
if (configurables.targetTriple.isSimulator) {
|
||||||
return // bitcode-build-tool doesn't support simulators.
|
return // bitcode-build-tool doesn't support simulators.
|
||||||
}
|
}
|
||||||
val sdk = Xcode.current.pathToPlatformSdk(configurables.platformName())
|
val sdk = xcode.pathToPlatformSdk(configurables.platformName())
|
||||||
|
|
||||||
val python3 = listOf("/usr/bin/python3", "/usr/local/bin/python3")
|
val python3 = listOf("/usr/bin/python3", "/usr/local/bin/python3")
|
||||||
.map { Paths.get(it) }.firstOrNull { Files.exists(it) }
|
.map { Paths.get(it) }.firstOrNull { Files.exists(it) }
|
||||||
@@ -264,4 +264,6 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable {
|
|||||||
runTest(executorService = localExecutorService(project), testExecutable = python3,
|
runTest(executorService = localExecutorService(project), testExecutable = python3,
|
||||||
args = listOf("-B", bitcodeBuildTool, "--sdk", sdk, "-v", "-t", toolPath, frameworkBinary))
|
args = listOf("-B", bitcodeBuildTool, "--sdk", sdk, "-v", "-t", toolPath, frameworkBinary))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val xcode by lazy { Xcode.findCurrent() }
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ object PlatformInfo {
|
|||||||
&& properties.checkXcodeVersion
|
&& properties.checkXcodeVersion
|
||||||
&& requiredMajorVersion != null
|
&& requiredMajorVersion != null
|
||||||
) {
|
) {
|
||||||
val currentXcodeVersion = Xcode.current.version
|
val currentXcodeVersion = Xcode.findCurrent().version
|
||||||
val currentMajorVersion = currentXcodeVersion.splitToSequence('.').first()
|
val currentMajorVersion = currentXcodeVersion.splitToSequence('.').first()
|
||||||
if (currentMajorVersion != requiredMajorVersion) {
|
if (currentMajorVersion != requiredMajorVersion) {
|
||||||
throw IllegalStateException(
|
throw IllegalStateException(
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class AppleConfigurablesImpl(
|
|||||||
if (InternalServer.isAvailable) {
|
if (InternalServer.isAvailable) {
|
||||||
XcodePartsProvider.InternalServer
|
XcodePartsProvider.InternalServer
|
||||||
} else {
|
} else {
|
||||||
val xcode = Xcode.current
|
val xcode = Xcode.findCurrent()
|
||||||
|
|
||||||
if (properties.getProperty("ignoreXcodeVersionCheck") != "true") {
|
if (properties.getProperty("ignoreXcodeVersionCheck") != "true") {
|
||||||
properties.getProperty("minimalXcodeVersion")?.let { minimalXcodeVersion ->
|
properties.getProperty("minimalXcodeVersion")?.let { minimalXcodeVersion ->
|
||||||
|
|||||||
@@ -56,8 +56,11 @@ interface Xcode {
|
|||||||
companion object {
|
companion object {
|
||||||
// Don't cache the instance: the compiler might be executed in a Gradle daemon process,
|
// Don't cache the instance: the compiler might be executed in a Gradle daemon process,
|
||||||
// so current Xcode might actually change between different invocations.
|
// so current Xcode might actually change between different invocations.
|
||||||
|
@Deprecated("", ReplaceWith("this.findCurrent()"), DeprecationLevel.WARNING)
|
||||||
val current: Xcode
|
val current: Xcode
|
||||||
get() = CurrentXcode()
|
get() = findCurrent()
|
||||||
|
|
||||||
|
fun findCurrent(): Xcode = CurrentXcode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user