Browse Source

Components. Fix Its usage must be marked with '@kotlinx.cinterop.ExperimentalForeignApi' (#3383)

* Components. Fix Its usage must be marked with '@kotlinx.cinterop.ExperimentalForeignApi'

https://teamcity.jetbrains.com/buildConfiguration/JetBrainsPublicProjects_Compose_Publish_2_AllGitHubRelease/4238435?buildTab=dependencies&mode=list&state=failed&type=snapshot&hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildProblemsSection=true&showLog=4238425_373_267&logFilter=debug&logView=flowAware#4238426

Kotlin 1.9 broke source compatibility for native targets, usePinned is now experimental

* macOs
release/1.4.2
Igor Demin 1 year ago committed by Igor Demin
parent
commit
2a9905a3cc
  1. 2
      components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/Resource.ios.kt
  2. 2
      components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/Resource.macos.kt

2
components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/Resource.ios.kt

@ -5,6 +5,7 @@
package org.jetbrains.compose.resources package org.jetbrains.compose.resources
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.addressOf import kotlinx.cinterop.addressOf
import kotlinx.cinterop.usePinned import kotlinx.cinterop.usePinned
import platform.Foundation.NSBundle import platform.Foundation.NSBundle
@ -17,6 +18,7 @@ actual fun resource(path: String): Resource = UIKitResourceImpl(path)
@ExperimentalResourceApi @ExperimentalResourceApi
private class UIKitResourceImpl(path: String) : AbstractResourceImpl(path) { private class UIKitResourceImpl(path: String) : AbstractResourceImpl(path) {
@OptIn(ExperimentalForeignApi::class)
override suspend fun readBytes(): ByteArray { override suspend fun readBytes(): ByteArray {
val absolutePath = NSBundle.mainBundle.resourcePath + "/" + path val absolutePath = NSBundle.mainBundle.resourcePath + "/" + path
val contentsAtPath: NSData? = NSFileManager.defaultManager().contentsAtPath(absolutePath) val contentsAtPath: NSData? = NSFileManager.defaultManager().contentsAtPath(absolutePath)

2
components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/Resource.macos.kt

@ -5,6 +5,7 @@
package org.jetbrains.compose.resources package org.jetbrains.compose.resources
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.addressOf import kotlinx.cinterop.addressOf
import kotlinx.cinterop.usePinned import kotlinx.cinterop.usePinned
import platform.Foundation.NSData import platform.Foundation.NSData
@ -16,6 +17,7 @@ actual fun resource(path: String): Resource = MacOSResourceImpl(path)
@ExperimentalResourceApi @ExperimentalResourceApi
private class MacOSResourceImpl(path: String) : AbstractResourceImpl(path) { private class MacOSResourceImpl(path: String) : AbstractResourceImpl(path) {
@OptIn(ExperimentalForeignApi::class)
override suspend fun readBytes(): ByteArray { override suspend fun readBytes(): ByteArray {
val currentDirectoryPath = NSFileManager.defaultManager().currentDirectoryPath val currentDirectoryPath = NSFileManager.defaultManager().currentDirectoryPath
val contentsAtPath: NSData? = NSFileManager.defaultManager().run { val contentsAtPath: NSData? = NSFileManager.defaultManager().run {

Loading…
Cancel
Save