Browse Source

Delete the experimental mark from the stable resources library API (#4623)

And remove internal testing methods
pull/4650/head v1.6.10-dev1590
Konstantin 7 months ago committed by GitHub
parent
commit
2d225f3450
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      components/resources/demo/shared/src/jsMain/kotlin/main.js.kt
  2. 3
      components/resources/demo/shared/src/wasmJsMain/kotlin/main.wasm.kt
  3. 1
      components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/FontResources.android.kt
  4. 2
      components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/ResourceReader.android.kt
  5. 14
      components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/FontResources.kt
  6. 16
      components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ImageResources.kt
  7. 7
      components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/PluralStringResources.kt
  8. 1
      components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Resource.kt
  9. 2
      components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceEnvironment.kt
  10. 1
      components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceReader.kt
  11. 4
      components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringArrayResources.kt
  12. 7
      components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringResources.kt
  13. 3
      components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/MalformedXMLException.kt
  14. 12
      components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt
  15. 5
      components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ResourceTest.kt
  16. 8
      components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/TestUtils.kt
  17. 2
      components/resources/library/src/desktopMain/kotlin/org/jetbrains/compose/resources/ResourceReader.desktop.kt
  18. 1
      components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.ios.kt
  19. 1
      components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ImageResources.js.kt
  20. 1
      components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.js.kt
  21. 1
      components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.macos.kt
  22. 2
      components/resources/library/src/nativeMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/DomXmlParser.kt
  23. 1
      components/resources/library/src/skikoMain/kotlin/org/jetbrains/compose/resources/FontResources.skiko.kt
  24. 1
      components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ImageResources.wasmJs.kt
  25. 1
      components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.wasmJs.kt
  26. 4
      components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt
  27. 6
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/GeneratedResClassSpec.kt
  28. 4
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/androidMainResourceAccessors/my/lib/res/String0.androidMain.kt
  29. 10
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Drawable0.commonMain.kt
  30. 4
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Font0.commonMain.kt
  31. 4
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Plurals0.commonMain.kt
  32. 16
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/String0.commonMain.kt
  33. 5
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonResClass/my/lib/res/Res.kt
  34. 4
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/desktopMainResourceAccessors/my/lib/res/String0.desktopMain.kt
  35. 4
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/androidMainResourceAccessors/app/group/resources_test/generated/resources/String0.androidMain.kt
  36. 10
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Drawable0.commonMain.kt
  37. 4
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Font0.commonMain.kt
  38. 4
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Plurals0.commonMain.kt
  39. 16
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/String0.commonMain.kt
  40. 3
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonResClass/app/group/resources_test/generated/resources/Res.kt
  41. 4
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/desktopMainResourceAccessors/app/group/resources_test/generated/resources/String0.desktopMain.kt
  42. 3
      gradle-plugins/compose/src/test/test-projects/misc/emptyResources/expected/Res.kt
  43. 3
      gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/commonResClass/me/app/jvmonlyresources/generated/resources/Res.kt
  44. 4
      gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/mainResourceAccessors/me/app/jvmonlyresources/generated/resources/Drawable0.main.kt

3
components/resources/demo/shared/src/jsMain/kotlin/main.js.kt

@ -5,13 +5,12 @@
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.window.CanvasBasedWindow
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.configureWebResources
import org.jetbrains.compose.resources.demo.shared.UseResources
import org.jetbrains.skiko.wasm.onWasmReady
@OptIn(ExperimentalComposeUiApi::class, ExperimentalResourceApi::class)
@OptIn(ExperimentalComposeUiApi::class)
fun main() {
configureWebResources {
// Not necessary - It's the same as the default. We add it here just to present this feature.

3
components/resources/demo/shared/src/wasmJsMain/kotlin/main.wasm.kt

@ -1,10 +1,9 @@
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.window.CanvasBasedWindow
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.configureWebResources
import org.jetbrains.compose.resources.demo.shared.UseResources
@OptIn(ExperimentalComposeUiApi::class, ExperimentalResourceApi::class)
@OptIn(ExperimentalComposeUiApi::class)
fun main() {
configureWebResources {
// Not necessary - It's the same as the default. We add it here just to present this feature.

1
components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/FontResources.android.kt

@ -5,7 +5,6 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.*
@ExperimentalResourceApi
@Composable
actual fun Font(resource: FontResource, weight: FontWeight, style: FontStyle): Font {
val environment = LocalComposeEnvironment.current.rememberEnvironment()

2
components/resources/library/src/androidMain/kotlin/org/jetbrains/compose/resources/ResourceReader.android.kt

@ -19,7 +19,6 @@ internal actual fun getPlatformResourceReader(): ResourceReader = object : Resou
return result
}
@OptIn(ExperimentalResourceApi::class)
override fun getUri(path: String): String {
val classLoader = getClassLoader()
val resource = classLoader.getResource(path) ?: run {
@ -31,7 +30,6 @@ internal actual fun getPlatformResourceReader(): ResourceReader = object : Resou
return resource.toURI().toString()
}
@OptIn(ExperimentalResourceApi::class)
private fun getResourceAsStream(path: String): InputStream {
val classLoader = getClassLoader()
val resource = classLoader.getResourceAsStream(path) ?: run {

14
components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/FontResources.kt

@ -12,23 +12,10 @@ import androidx.compose.ui.text.font.*
*
* @see Resource
*/
@ExperimentalResourceApi
@Immutable
class FontResource
@InternalResourceApi constructor(id: String, items: Set<ResourceItem>): Resource(id, items)
/**
* Creates an [FontResource] object with the specified path.
*
* @param path The path to the font resource file.
* @return A new [FontResource] object.
*/
@ExperimentalResourceApi
fun FontResource(path: String): FontResource = FontResource(
id = "FontResource:$path",
items = setOf(ResourceItem(emptySet(), path, -1, -1))
)
/**
* Creates a font using the specified font resource, weight, and style.
*
@ -41,7 +28,6 @@ fun FontResource(path: String): FontResource = FontResource(
* @throws NotFoundException if the specified resource ID is not found.
*/
@Composable
@ExperimentalResourceApi
expect fun Font(
resource: FontResource,
weight: FontWeight = FontWeight.Normal,

16
components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ImageResources.kt

@ -21,23 +21,10 @@ import org.jetbrains.compose.resources.vector.xmldom.Element
* @param id The unique identifier of the drawable resource.
* @param items The set of resource items associated with the image resource.
*/
@ExperimentalResourceApi
@Immutable
class DrawableResource
@InternalResourceApi constructor(id: String, items: Set<ResourceItem>) : Resource(id, items)
/**
* Creates an [DrawableResource] object with the specified path.
*
* @param path The path of the drawable resource.
* @return An [DrawableResource] object.
*/
@ExperimentalResourceApi
fun DrawableResource(path: String): DrawableResource = DrawableResource(
id = "DrawableResource:$path",
items = setOf(ResourceItem(emptySet(), path, -1, -1))
)
/**
* Retrieves a [Painter] using the specified drawable resource.
* Automatically select a type of the Painter depending on the file extension.
@ -45,7 +32,6 @@ fun DrawableResource(path: String): DrawableResource = DrawableResource(
* @param resource The drawable resource to be used.
* @return The [Painter] loaded from the resource.
*/
@ExperimentalResourceApi
@Composable
fun painterResource(resource: DrawableResource): Painter {
val environment = LocalComposeEnvironment.current.rememberEnvironment()
@ -67,7 +53,6 @@ private val emptyImageBitmap: ImageBitmap by lazy { ImageBitmap(1, 1) }
* @param resource The drawable resource to be used.
* @return The ImageBitmap loaded from the resource.
*/
@ExperimentalResourceApi
@Composable
fun imageResource(resource: DrawableResource): ImageBitmap {
val resourceReader = LocalResourceReader.current
@ -91,7 +76,6 @@ private val emptyImageVector: ImageVector by lazy {
* @param resource The drawable resource to be used.
* @return The ImageVector loaded from the resource.
*/
@ExperimentalResourceApi
@Composable
fun vectorResource(resource: DrawableResource): ImageVector {
val resourceReader = LocalResourceReader.current

7
components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/PluralStringResources.kt

@ -11,7 +11,6 @@ import org.jetbrains.compose.resources.plural.PluralRuleList
* @param key The key used to retrieve the string resource.
* @param items The set of resource items associated with the string resource.
*/
@ExperimentalResourceApi
@Immutable
class PluralStringResource
@InternalResourceApi constructor(id: String, val key: String, items: Set<ResourceItem>) : Resource(id, items)
@ -25,7 +24,6 @@ class PluralStringResource
*
* @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file.
*/
@ExperimentalResourceApi
@Composable
fun pluralStringResource(resource: PluralStringResource, quantity: Int): String {
val resourceReader = LocalResourceReader.current
@ -44,11 +42,9 @@ fun pluralStringResource(resource: PluralStringResource, quantity: Int): String
*
* @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file.
*/
@ExperimentalResourceApi
suspend fun getPluralString(resource: PluralStringResource, quantity: Int): String =
loadPluralString(resource, quantity, DefaultResourceReader, getResourceEnvironment())
@OptIn(InternalResourceApi::class, ExperimentalResourceApi::class)
private suspend fun loadPluralString(
resource: PluralStringResource,
quantity: Int,
@ -78,7 +74,6 @@ private suspend fun loadPluralString(
*
* @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file.
*/
@ExperimentalResourceApi
@Composable
fun pluralStringResource(resource: PluralStringResource, quantity: Int, vararg formatArgs: Any): String {
val resourceReader = LocalResourceReader.current
@ -99,7 +94,6 @@ fun pluralStringResource(resource: PluralStringResource, quantity: Int, vararg f
*
* @throws IllegalArgumentException If the provided ID or the pluralization is not found in the resource file.
*/
@ExperimentalResourceApi
suspend fun getPluralString(resource: PluralStringResource, quantity: Int, vararg formatArgs: Any): String =
loadPluralString(
resource, quantity,
@ -108,7 +102,6 @@ suspend fun getPluralString(resource: PluralStringResource, quantity: Int, varar
getResourceEnvironment(),
)
@OptIn(ExperimentalResourceApi::class)
private suspend fun loadPluralString(
resource: PluralStringResource,
quantity: Int,

1
components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Resource.kt

@ -14,7 +14,6 @@ annotation class InternalResourceApi
* @property id The ID of the resource.
* @property items The set of resource items associated with the resource.
*/
@ExperimentalResourceApi
@Immutable
sealed class Resource
@InternalResourceApi constructor(

2
components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceEnvironment.kt

@ -48,7 +48,7 @@ internal expect fun getSystemEnvironment(): ResourceEnvironment
*/
internal var getResourceEnvironment = ::getSystemEnvironment
@OptIn(InternalResourceApi::class, ExperimentalResourceApi::class)
@OptIn(InternalResourceApi::class)
internal fun Resource.getResourceItemByEnvironment(environment: ResourceEnvironment): ResourceItem {
//Priority of environments: https://developer.android.com/guide/topics/resources/providing-resources#table2
items.toList()

1
components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/ResourceReader.kt

@ -2,7 +2,6 @@ package org.jetbrains.compose.resources
import androidx.compose.runtime.staticCompositionLocalOf
@ExperimentalResourceApi
class MissingResourceException(path: String) : Exception("Missing resource with path: $path")
/**

4
components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringArrayResources.kt

@ -16,7 +16,6 @@ import org.jetbrains.compose.resources.vector.xmldom.NodeList
* @param key The key used to retrieve the string array resource.
* @param items The set of resource items associated with the string array resource.
*/
@ExperimentalResourceApi
@Immutable
class StringArrayResource
@InternalResourceApi constructor(id: String, val key: String, items: Set<ResourceItem>) : Resource(id, items)
@ -29,7 +28,6 @@ class StringArrayResource
*
* @throws IllegalStateException if the string array with the given ID is not found.
*/
@ExperimentalResourceApi
@Composable
fun stringArrayResource(resource: StringArrayResource): List<String> {
val resourceReader = LocalResourceReader.current
@ -47,11 +45,9 @@ fun stringArrayResource(resource: StringArrayResource): List<String> {
*
* @throws IllegalStateException if the string array with the given ID is not found.
*/
@ExperimentalResourceApi
suspend fun getStringArray(resource: StringArrayResource): List<String> =
loadStringArray(resource, DefaultResourceReader, getResourceEnvironment())
@OptIn(ExperimentalResourceApi::class, InternalResourceApi::class)
private suspend fun loadStringArray(
resource: StringArrayResource,
resourceReader: ResourceReader,

7
components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringResources.kt

@ -9,7 +9,6 @@ import androidx.compose.runtime.*
* @param key The key used to retrieve the string resource.
* @param items The set of resource items associated with the string resource.
*/
@ExperimentalResourceApi
@Immutable
class StringResource
@InternalResourceApi constructor(id: String, val key: String, items: Set<ResourceItem>) : Resource(id, items)
@ -22,7 +21,6 @@ class StringResource
*
* @throws IllegalArgumentException If the provided ID is not found in the resource file.
*/
@ExperimentalResourceApi
@Composable
fun stringResource(resource: StringResource): String {
val resourceReader = LocalResourceReader.current
@ -40,11 +38,9 @@ fun stringResource(resource: StringResource): String {
*
* @throws IllegalArgumentException If the provided ID is not found in the resource file.
*/
@ExperimentalResourceApi
suspend fun getString(resource: StringResource): String =
loadString(resource, DefaultResourceReader, getResourceEnvironment())
@OptIn(ExperimentalResourceApi::class, InternalResourceApi::class)
private suspend fun loadString(
resource: StringResource,
resourceReader: ResourceReader,
@ -64,7 +60,6 @@ private suspend fun loadString(
*
* @throws IllegalArgumentException If the provided ID is not found in the resource file.
*/
@ExperimentalResourceApi
@Composable
fun stringResource(resource: StringResource, vararg formatArgs: Any): String {
val resourceReader = LocalResourceReader.current
@ -84,7 +79,6 @@ fun stringResource(resource: StringResource, vararg formatArgs: Any): String {
*
* @throws IllegalArgumentException If the provided ID is not found in the resource file.
*/
@ExperimentalResourceApi
suspend fun getString(resource: StringResource, vararg formatArgs: Any): String = loadString(
resource,
formatArgs.map { it.toString() },
@ -92,7 +86,6 @@ suspend fun getString(resource: StringResource, vararg formatArgs: Any): String
getResourceEnvironment()
)
@OptIn(ExperimentalResourceApi::class)
private suspend fun loadString(
resource: StringResource,
args: List<String>,

3
components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/MalformedXMLException.kt

@ -1,9 +1,6 @@
package org.jetbrains.compose.resources.vector.xmldom
import org.jetbrains.compose.resources.ExperimentalResourceApi
/**
* Error throw when parsed XML is malformed
*/
@ExperimentalResourceApi
class MalformedXMLException(message: String?) : Exception(message)

12
components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt

@ -9,7 +9,7 @@ import kotlinx.coroutines.test.runTest
import org.jetbrains.skiko.URIManager
import kotlin.test.*
@OptIn(ExperimentalTestApi::class, ExperimentalResourceApi::class, InternalResourceApi::class)
@OptIn(ExperimentalTestApi::class, InternalResourceApi::class)
class ComposeResourceTest {
init {
@ -20,7 +20,7 @@ class ComposeResourceTest {
@Test
fun testCountRecompositions() = runComposeUiTest {
var res by mutableStateOf(DrawableResource("1.png"))
var res by mutableStateOf(TestDrawableResource("1.png"))
val recompositionsCounter = RecompositionsCounter()
setContent {
CompositionLocalProvider(LocalComposeEnvironment provides TestComposeEnvironment) {
@ -31,7 +31,7 @@ class ComposeResourceTest {
}
}
waitForIdle()
res = DrawableResource("2.png")
res = TestDrawableResource("2.png")
waitForIdle()
assertEquals(2, recompositionsCounter.count)
}
@ -39,7 +39,7 @@ class ComposeResourceTest {
@Test
fun testImageResourceCache() = runComposeUiTest {
val testResourceReader = TestResourceReader()
var res by mutableStateOf(DrawableResource("1.png"))
var res by mutableStateOf(TestDrawableResource("1.png"))
setContent {
CompositionLocalProvider(
LocalResourceReader provides testResourceReader,
@ -49,9 +49,9 @@ class ComposeResourceTest {
}
}
waitForIdle()
res = DrawableResource("2.png")
res = TestDrawableResource("2.png")
waitForIdle()
res = DrawableResource("1.png")
res = TestDrawableResource("1.png")
waitForIdle()
assertEquals(

5
components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ResourceTest.kt

@ -10,16 +10,15 @@ import org.jetbrains.compose.resources.ThemeQualifier.DARK
import org.jetbrains.compose.resources.ThemeQualifier.LIGHT
import kotlin.test.*
@OptIn(ExperimentalResourceApi::class, InternalResourceApi::class)
class ResourceTest {
@Test
fun testResourceEquals() {
assertEquals(DrawableResource("a"), DrawableResource("a"))
assertEquals(TestDrawableResource("a"), TestDrawableResource("a"))
}
@Test
fun testResourceNotEquals() {
assertNotEquals(DrawableResource("a"), DrawableResource("b"))
assertNotEquals(TestDrawableResource("a"), TestDrawableResource("b"))
}
@Test

8
components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/TestUtils.kt

@ -17,27 +17,29 @@ private val cvrMap: Map<String, ResourceItem> = mapOf(
"str_arr" to ResourceItem(setOf(), "strings.cvr", 211, 47),
)
@OptIn(ExperimentalResourceApi::class)
internal fun TestStringResource(key: String) = StringResource(
"STRING:$key",
key,
setOf(cvrMap[key] ?: error("String ID=`$key` is not found!"))
)
@OptIn(ExperimentalResourceApi::class)
internal fun TestStringArrayResource(key: String) = StringArrayResource(
"STRING:$key",
key,
setOf(cvrMap[key] ?: error("String ID=`$key` is not found!"))
)
@OptIn(ExperimentalResourceApi::class)
internal fun TestPluralStringResource(key: String) = PluralStringResource(
"PLURALS:$key",
key,
setOf(cvrMap[key] ?: error("String ID=`$key` is not found!"))
)
internal fun TestDrawableResource(path: String) = DrawableResource(
path,
setOf(ResourceItem(emptySet(), path, -1, -1))
)
internal fun parsePluralSamples(samples: String): List<Int> {
return samples.split(',').flatMap {
val range = it.trim()

2
components/resources/library/src/desktopMain/kotlin/org/jetbrains/compose/resources/ResourceReader.desktop.kt

@ -18,14 +18,12 @@ internal actual fun getPlatformResourceReader(): ResourceReader = object : Resou
return result
}
@OptIn(ExperimentalResourceApi::class)
override fun getUri(path: String): String {
val classLoader = getClassLoader()
val resource = classLoader.getResource(path) ?: throw MissingResourceException(path)
return resource.toURI().toString()
}
@OptIn(ExperimentalResourceApi::class)
private fun getResourceAsStream(path: String): InputStream {
val classLoader = getClassLoader()
return classLoader.getResourceAsStream(path) ?: throw MissingResourceException(path)

1
components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.ios.kt

@ -5,7 +5,6 @@ import kotlinx.cinterop.usePinned
import platform.Foundation.*
import platform.posix.memcpy
@OptIn(ExperimentalResourceApi::class)
internal actual fun getPlatformResourceReader(): ResourceReader = object : ResourceReader {
override suspend fun read(path: String): ByteArray {
val data = readData(getPathInBundle(path))

1
components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ImageResources.js.kt

@ -3,7 +3,6 @@ package org.jetbrains.compose.resources
import org.jetbrains.compose.resources.vector.xmldom.*
import org.w3c.dom.parsing.DOMParser
@OptIn(ExperimentalResourceApi::class)
internal actual fun ByteArray.toXmlElement(): Element {
val xmlString = decodeToString()
val xmlDom = DOMParser().parseFromString(xmlString, "application/xml")

1
components/resources/library/src/jsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.js.kt

@ -7,7 +7,6 @@ import org.khronos.webgl.Int8Array
import org.w3c.files.Blob
import kotlin.js.Promise
@OptIn(ExperimentalResourceApi::class)
internal actual fun getPlatformResourceReader(): ResourceReader = object : ResourceReader {
override suspend fun read(path: String): ByteArray {
return readAsBlob(path).asByteArray()

1
components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/ResourceReader.macos.kt

@ -5,7 +5,6 @@ import kotlinx.cinterop.usePinned
import platform.Foundation.*
import platform.posix.memcpy
@OptIn(ExperimentalResourceApi::class)
internal actual fun getPlatformResourceReader(): ResourceReader = object : ResourceReader {
override suspend fun read(path: String): ByteArray {
val data = readData(getPathOnDisk(path))

2
components/resources/library/src/nativeMain/kotlin/org/jetbrains/compose/resources/vector/xmldom/DomXmlParser.kt

@ -4,7 +4,6 @@
*/
package org.jetbrains.compose.resources.vector.xmldom
import org.jetbrains.compose.resources.ExperimentalResourceApi
import platform.Foundation.NSError
import platform.Foundation.NSString
import platform.Foundation.NSUTF8StringEncoding
@ -58,7 +57,6 @@ private class ElementImpl(
override fun lookupPrefix(namespaceURI: String): String = prefixMap[namespaceURI] ?: ""
}
@OptIn(ExperimentalResourceApi::class)
@Suppress("CONFLICTING_OVERLOADS", "PARAMETER_NAME_CHANGED_ON_OVERRIDE")
private class DomXmlParser : NSObject(), NSXMLParserDelegateProtocol {

1
components/resources/library/src/skikoMain/kotlin/org/jetbrains/compose/resources/FontResources.skiko.kt

@ -29,7 +29,6 @@ private val emptyFontBase64 =
@OptIn(ExperimentalEncodingApi::class)
private val defaultEmptyFont by lazy { Font("org.jetbrains.compose.emptyFont", Base64.decode(emptyFontBase64)) }
@ExperimentalResourceApi
@Composable
actual fun Font(resource: FontResource, weight: FontWeight, style: FontStyle): Font {
val resourceReader = LocalResourceReader.current

1
components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ImageResources.wasmJs.kt

@ -5,7 +5,6 @@ import org.jetbrains.compose.resources.vector.xmldom.ElementImpl
import org.jetbrains.compose.resources.vector.xmldom.MalformedXMLException
import org.w3c.dom.parsing.DOMParser
@OptIn(ExperimentalResourceApi::class)
internal actual fun ByteArray.toXmlElement(): Element {
val xmlString = decodeToString()
val xmlDom = DOMParser().parseFromString(xmlString, "application/xml".toJsString())

1
components/resources/library/src/wasmJsMain/kotlin/org/jetbrains/compose/resources/ResourceReader.wasmJs.kt

@ -22,7 +22,6 @@ private external fun jsExportInt8ArrayToWasm(src: Int8Array, size: Int, dstAddr:
@JsFun("(blob) => blob.arrayBuffer()")
private external fun jsExportBlobAsArrayBuffer(blob: Blob): Promise<ArrayBuffer>
@OptIn(ExperimentalResourceApi::class)
internal actual fun getPlatformResourceReader(): ResourceReader = object : ResourceReader {
override suspend fun read(path: String): ByteArray {
return readAsBlob(path).asByteArray()

4
components/resources/library/src/webMain/kotlin/org/jetbrains/compose/resources/Resource.web.kt

@ -6,7 +6,6 @@ package org.jetbrains.compose.resources
* @see configureWebResources - for overriding the default configuration.
*/
@Suppress("unused")
@ExperimentalResourceApi
object WebResourcesConfiguration {
internal var getResourcePath: (path: String) -> String = { "./$it" }
@ -16,7 +15,6 @@ object WebResourcesConfiguration {
*
* @param map the mapping function that takes a path String and returns a modified path String
*/
@ExperimentalResourceApi
fun resourcePathMapping(map: (path: String) -> String) {
getResourcePath = map
}
@ -41,12 +39,10 @@ object WebResourcesConfiguration {
* ```
*/
@Suppress("unused")
@ExperimentalResourceApi
fun configureWebResources(configure: WebResourcesConfiguration.() -> Unit) {
WebResourcesConfiguration.configure()
}
@OptIn(ExperimentalResourceApi::class)
internal fun getResourceUrl(windowOrigin: String, windowPathname: String, resourcePath: String): String {
val path = WebResourcesConfiguration.getResourcePath(resourcePath)
return when {

6
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/GeneratedResClassSpec.kt

@ -127,7 +127,6 @@ internal fun getResFileSpec(
)
file.addType(TypeSpec.objectBuilder("Res").also { resObject ->
resObject.addModifiers(resModifier)
resObject.addAnnotation(experimentalAnnotation)
//readFileBytes
val readResourceBytes = MemberName("org.jetbrains.compose.resources", "readResourceBytes")
@ -143,6 +142,7 @@ internal fun getResFileSpec(
@return The content of the file as a byte array.
""".trimIndent()
)
.addAnnotation(experimentalAnnotation)
.addParameter("path", String::class)
.addModifiers(KModifier.SUSPEND)
.returns(ByteArray::class)
@ -164,6 +164,7 @@ internal fun getResFileSpec(
@return The URI string of the file.
""".trimIndent()
)
.addAnnotation(experimentalAnnotation)
.addParameter("path", String::class)
.returns(String::class)
.addStatement("""return %M("$moduleDir" + path)""", getResourceUri)
@ -237,7 +238,6 @@ private fun getChunkFileSpec(
val objectSpec = TypeSpec.objectBuilder(chunkClassName).also { typeObject ->
typeObject.addModifiers(KModifier.PRIVATE)
typeObject.addAnnotation(experimentalAnnotation)
val properties = idToResources.keys.map { resName ->
PropertySpec.builder(resName, type.getClassName())
.delegate("\nlazy·{ init_$resName() }")
@ -250,14 +250,12 @@ private fun getChunkFileSpec(
idToResources.forEach { (resName, items) ->
val accessor = PropertySpec.builder(resName, type.getClassName(), resModifier)
.receiver(ClassName(packageName, "Res", type.accessorName))
.addAnnotation(experimentalAnnotation)
.getter(FunSpec.getterBuilder().addStatement("return $chunkClassName.$resName").build())
.build()
chunkFile.addProperty(accessor)
val initializer = FunSpec.builder("init_$resName")
.addModifiers(KModifier.PRIVATE)
.addAnnotation(experimentalAnnotation)
.returns(type.getClassName())
.addStatement(
CodeBlock.builder()

4
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/androidMainResourceAccessors/my/lib/res/String0.androidMain.kt

@ -3,20 +3,16 @@
package my.lib.res
import kotlin.OptIn
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.StringResource
@ExperimentalResourceApi
private object AndroidMainString0 {
public val android_str: StringResource by
lazy { init_android_str() }
}
@ExperimentalResourceApi
public val Res.string.android_str: StringResource
get() = AndroidMainString0.android_str
@ExperimentalResourceApi
private fun init_android_str(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:android_str", "android_str",
setOf(

10
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Drawable0.commonMain.kt

@ -4,9 +4,7 @@ package my.lib.res
import kotlin.OptIn
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.ExperimentalResourceApi
@ExperimentalResourceApi
private object CommonMainDrawable0 {
public val _3_strange_name: DrawableResource by
lazy { init__3_strange_name() }
@ -21,11 +19,9 @@ private object CommonMainDrawable0 {
lazy { init_vector_2() }
}
@ExperimentalResourceApi
public val Res.drawable._3_strange_name: DrawableResource
get() = CommonMainDrawable0._3_strange_name
@ExperimentalResourceApi
private fun init__3_strange_name(): DrawableResource =
org.jetbrains.compose.resources.DrawableResource(
"drawable:_3_strange_name",
@ -34,11 +30,9 @@ private fun init__3_strange_name(): DrawableResource =
)
)
@ExperimentalResourceApi
public val Res.drawable.camelCaseName: DrawableResource
get() = CommonMainDrawable0.camelCaseName
@ExperimentalResourceApi
private fun init_camelCaseName(): DrawableResource =
org.jetbrains.compose.resources.DrawableResource(
"drawable:camelCaseName",
@ -47,11 +41,9 @@ private fun init_camelCaseName(): DrawableResource =
)
)
@ExperimentalResourceApi
public val Res.drawable.vector: DrawableResource
get() = CommonMainDrawable0.vector
@ExperimentalResourceApi
private fun init_vector(): DrawableResource = org.jetbrains.compose.resources.DrawableResource(
"drawable:vector",
setOf(
@ -72,11 +64,9 @@ private fun init_vector(): DrawableResource = org.jetbrains.compose.resources.Dr
)
)
@ExperimentalResourceApi
public val Res.drawable.vector_2: DrawableResource
get() = CommonMainDrawable0.vector_2
@ExperimentalResourceApi
private fun init_vector_2(): DrawableResource = org.jetbrains.compose.resources.DrawableResource(
"drawable:vector_2",
setOf(

4
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Font0.commonMain.kt

@ -3,20 +3,16 @@
package my.lib.res
import kotlin.OptIn
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.FontResource
@ExperimentalResourceApi
private object CommonMainFont0 {
public val emptyFont: FontResource by
lazy { init_emptyFont() }
}
@ExperimentalResourceApi
public val Res.font.emptyFont: FontResource
get() = CommonMainFont0.emptyFont
@ExperimentalResourceApi
private fun init_emptyFont(): FontResource = org.jetbrains.compose.resources.FontResource(
"font:emptyFont",
setOf(

4
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/Plurals0.commonMain.kt

@ -3,20 +3,16 @@
package my.lib.res
import kotlin.OptIn
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.PluralStringResource
@ExperimentalResourceApi
private object CommonMainPlurals0 {
public val numberOfSongsAvailable: PluralStringResource by
lazy { init_numberOfSongsAvailable() }
}
@ExperimentalResourceApi
public val Res.plurals.numberOfSongsAvailable: PluralStringResource
get() = CommonMainPlurals0.numberOfSongsAvailable
@ExperimentalResourceApi
private fun init_numberOfSongsAvailable(): PluralStringResource =
org.jetbrains.compose.resources.PluralStringResource(
"plurals:numberOfSongsAvailable", "numberOfSongsAvailable",

16
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonMainResourceAccessors/my/lib/res/String0.commonMain.kt

@ -3,10 +3,8 @@
package my.lib.res
import kotlin.OptIn
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.StringResource
@ExperimentalResourceApi
private object CommonMainString0 {
public val PascalCase: StringResource by
lazy { init_PascalCase() }
@ -30,11 +28,9 @@ private object CommonMainString0 {
lazy { init_str_template() }
}
@ExperimentalResourceApi
public val Res.string.PascalCase: StringResource
get() = CommonMainString0.PascalCase
@ExperimentalResourceApi
private fun init_PascalCase(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:PascalCase", "PascalCase",
setOf(
@ -43,11 +39,9 @@ private fun init_PascalCase(): StringResource = org.jetbrains.compose.resources.
)
)
@ExperimentalResourceApi
public val Res.string._1_kebab_case: StringResource
get() = CommonMainString0._1_kebab_case
@ExperimentalResourceApi
private fun init__1_kebab_case(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:_1_kebab_case", "_1_kebab_case",
setOf(
@ -56,11 +50,9 @@ private fun init__1_kebab_case(): StringResource = org.jetbrains.compose.resourc
)
)
@ExperimentalResourceApi
public val Res.string.app_name: StringResource
get() = CommonMainString0.app_name
@ExperimentalResourceApi
private fun init_app_name(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:app_name", "app_name",
setOf(
@ -69,11 +61,9 @@ private fun init_app_name(): StringResource = org.jetbrains.compose.resources.St
)
)
@ExperimentalResourceApi
public val Res.string.camelCase: StringResource
get() = CommonMainString0.camelCase
@ExperimentalResourceApi
private fun init_camelCase(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:camelCase", "camelCase",
setOf(
@ -82,11 +72,9 @@ private fun init_camelCase(): StringResource = org.jetbrains.compose.resources.S
)
)
@ExperimentalResourceApi
public val Res.string.hello: StringResource
get() = CommonMainString0.hello
@ExperimentalResourceApi
private fun init_hello(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:hello", "hello",
setOf(
@ -95,11 +83,9 @@ private fun init_hello(): StringResource = org.jetbrains.compose.resources.Strin
)
)
@ExperimentalResourceApi
public val Res.string.multi_line: StringResource
get() = CommonMainString0.multi_line
@ExperimentalResourceApi
private fun init_multi_line(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:multi_line", "multi_line",
setOf(
@ -108,11 +94,9 @@ private fun init_multi_line(): StringResource = org.jetbrains.compose.resources.
)
)
@ExperimentalResourceApi
public val Res.string.str_template: StringResource
get() = CommonMainString0.str_template
@ExperimentalResourceApi
private fun init_str_template(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:str_template", "str_template",
setOf(

5
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/commonResClass/my/lib/res/Res.kt

@ -12,7 +12,6 @@ import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.getResourceUri
import org.jetbrains.compose.resources.readResourceBytes
@ExperimentalResourceApi
public object Res {
/**
* Reads the content of the resource file at the specified path and returns it as a byte array.
@ -22,6 +21,7 @@ public object Res {
* @param path The path of the file to read in the compose resource's directory.
* @return The content of the file as a byte array.
*/
@ExperimentalResourceApi
public suspend fun readBytes(path: String): ByteArray = readResourceBytes("" + path)
/**
@ -32,6 +32,7 @@ public object Res {
* @param path The path of the file in the compose resource's directory.
* @return The URI string of the file.
*/
@ExperimentalResourceApi
public fun getUri(path: String): String = getResourceUri("" + path)
public object drawable
@ -43,4 +44,4 @@ public object Res {
public object plurals
public object font
}
}

4
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected-open-res/desktopMainResourceAccessors/my/lib/res/String0.desktopMain.kt

@ -3,20 +3,16 @@
package my.lib.res
import kotlin.OptIn
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.StringResource
@ExperimentalResourceApi
private object DesktopMainString0 {
public val desktop_str: StringResource by
lazy { init_desktop_str() }
}
@ExperimentalResourceApi
public val Res.string.desktop_str: StringResource
get() = DesktopMainString0.desktop_str
@ExperimentalResourceApi
private fun init_desktop_str(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:desktop_str", "desktop_str",
setOf(

4
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/androidMainResourceAccessors/app/group/resources_test/generated/resources/String0.androidMain.kt

@ -3,20 +3,16 @@
package app.group.resources_test.generated.resources
import kotlin.OptIn
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.StringResource
@ExperimentalResourceApi
private object AndroidMainString0 {
public val android_str: StringResource by
lazy { init_android_str() }
}
@ExperimentalResourceApi
internal val Res.string.android_str: StringResource
get() = AndroidMainString0.android_str
@ExperimentalResourceApi
private fun init_android_str(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:android_str", "android_str",
setOf(

10
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Drawable0.commonMain.kt

@ -4,9 +4,7 @@ package app.group.resources_test.generated.resources
import kotlin.OptIn
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.ExperimentalResourceApi
@ExperimentalResourceApi
private object CommonMainDrawable0 {
public val _3_strange_name: DrawableResource by
lazy { init__3_strange_name() }
@ -21,11 +19,9 @@ private object CommonMainDrawable0 {
lazy { init_vector_2() }
}
@ExperimentalResourceApi
internal val Res.drawable._3_strange_name: DrawableResource
get() = CommonMainDrawable0._3_strange_name
@ExperimentalResourceApi
private fun init__3_strange_name(): DrawableResource =
org.jetbrains.compose.resources.DrawableResource(
"drawable:_3_strange_name",
@ -34,11 +30,9 @@ private fun init__3_strange_name(): DrawableResource =
)
)
@ExperimentalResourceApi
internal val Res.drawable.camelCaseName: DrawableResource
get() = CommonMainDrawable0.camelCaseName
@ExperimentalResourceApi
private fun init_camelCaseName(): DrawableResource =
org.jetbrains.compose.resources.DrawableResource(
"drawable:camelCaseName",
@ -47,11 +41,9 @@ private fun init_camelCaseName(): DrawableResource =
)
)
@ExperimentalResourceApi
internal val Res.drawable.vector: DrawableResource
get() = CommonMainDrawable0.vector
@ExperimentalResourceApi
private fun init_vector(): DrawableResource = org.jetbrains.compose.resources.DrawableResource(
"drawable:vector",
setOf(
@ -72,11 +64,9 @@ private fun init_vector(): DrawableResource = org.jetbrains.compose.resources.Dr
)
)
@ExperimentalResourceApi
internal val Res.drawable.vector_2: DrawableResource
get() = CommonMainDrawable0.vector_2
@ExperimentalResourceApi
private fun init_vector_2(): DrawableResource = org.jetbrains.compose.resources.DrawableResource(
"drawable:vector_2",
setOf(

4
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Font0.commonMain.kt

@ -3,20 +3,16 @@
package app.group.resources_test.generated.resources
import kotlin.OptIn
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.FontResource
@ExperimentalResourceApi
private object CommonMainFont0 {
public val emptyFont: FontResource by
lazy { init_emptyFont() }
}
@ExperimentalResourceApi
internal val Res.font.emptyFont: FontResource
get() = CommonMainFont0.emptyFont
@ExperimentalResourceApi
private fun init_emptyFont(): FontResource = org.jetbrains.compose.resources.FontResource(
"font:emptyFont",
setOf(

4
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/Plurals0.commonMain.kt

@ -3,20 +3,16 @@
package app.group.resources_test.generated.resources
import kotlin.OptIn
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.PluralStringResource
@ExperimentalResourceApi
private object CommonMainPlurals0 {
public val numberOfSongsAvailable: PluralStringResource by
lazy { init_numberOfSongsAvailable() }
}
@ExperimentalResourceApi
internal val Res.plurals.numberOfSongsAvailable: PluralStringResource
get() = CommonMainPlurals0.numberOfSongsAvailable
@ExperimentalResourceApi
private fun init_numberOfSongsAvailable(): PluralStringResource =
org.jetbrains.compose.resources.PluralStringResource(
"plurals:numberOfSongsAvailable", "numberOfSongsAvailable",

16
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonMainResourceAccessors/app/group/resources_test/generated/resources/String0.commonMain.kt

@ -3,10 +3,8 @@
package app.group.resources_test.generated.resources
import kotlin.OptIn
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.StringResource
@ExperimentalResourceApi
private object CommonMainString0 {
public val PascalCase: StringResource by
lazy { init_PascalCase() }
@ -30,11 +28,9 @@ private object CommonMainString0 {
lazy { init_str_template() }
}
@ExperimentalResourceApi
internal val Res.string.PascalCase: StringResource
get() = CommonMainString0.PascalCase
@ExperimentalResourceApi
private fun init_PascalCase(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:PascalCase", "PascalCase",
setOf(
@ -43,11 +39,9 @@ private fun init_PascalCase(): StringResource = org.jetbrains.compose.resources.
)
)
@ExperimentalResourceApi
internal val Res.string._1_kebab_case: StringResource
get() = CommonMainString0._1_kebab_case
@ExperimentalResourceApi
private fun init__1_kebab_case(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:_1_kebab_case", "_1_kebab_case",
setOf(
@ -56,11 +50,9 @@ private fun init__1_kebab_case(): StringResource = org.jetbrains.compose.resourc
)
)
@ExperimentalResourceApi
internal val Res.string.app_name: StringResource
get() = CommonMainString0.app_name
@ExperimentalResourceApi
private fun init_app_name(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:app_name", "app_name",
setOf(
@ -69,11 +61,9 @@ private fun init_app_name(): StringResource = org.jetbrains.compose.resources.St
)
)
@ExperimentalResourceApi
internal val Res.string.camelCase: StringResource
get() = CommonMainString0.camelCase
@ExperimentalResourceApi
private fun init_camelCase(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:camelCase", "camelCase",
setOf(
@ -82,11 +72,9 @@ private fun init_camelCase(): StringResource = org.jetbrains.compose.resources.S
)
)
@ExperimentalResourceApi
internal val Res.string.hello: StringResource
get() = CommonMainString0.hello
@ExperimentalResourceApi
private fun init_hello(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:hello", "hello",
setOf(
@ -95,11 +83,9 @@ private fun init_hello(): StringResource = org.jetbrains.compose.resources.Strin
)
)
@ExperimentalResourceApi
internal val Res.string.multi_line: StringResource
get() = CommonMainString0.multi_line
@ExperimentalResourceApi
private fun init_multi_line(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:multi_line", "multi_line",
setOf(
@ -108,11 +94,9 @@ private fun init_multi_line(): StringResource = org.jetbrains.compose.resources.
)
)
@ExperimentalResourceApi
internal val Res.string.str_template: StringResource
get() = CommonMainString0.str_template
@ExperimentalResourceApi
private fun init_str_template(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:str_template", "str_template",
setOf(

3
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/commonResClass/app/group/resources_test/generated/resources/Res.kt

@ -12,7 +12,6 @@ import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.getResourceUri
import org.jetbrains.compose.resources.readResourceBytes
@ExperimentalResourceApi
internal object Res {
/**
* Reads the content of the resource file at the specified path and returns it as a byte array.
@ -22,6 +21,7 @@ internal object Res {
* @param path The path of the file to read in the compose resource's directory.
* @return The content of the file as a byte array.
*/
@ExperimentalResourceApi
public suspend fun readBytes(path: String): ByteArray = readResourceBytes("" + path)
/**
@ -32,6 +32,7 @@ internal object Res {
* @param path The path of the file in the compose resource's directory.
* @return The URI string of the file.
*/
@ExperimentalResourceApi
public fun getUri(path: String): String = getResourceUri("" + path)
public object drawable

4
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/desktopMainResourceAccessors/app/group/resources_test/generated/resources/String0.desktopMain.kt

@ -3,20 +3,16 @@
package app.group.resources_test.generated.resources
import kotlin.OptIn
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.StringResource
@ExperimentalResourceApi
private object DesktopMainString0 {
public val desktop_str: StringResource by
lazy { init_desktop_str() }
}
@ExperimentalResourceApi
internal val Res.string.desktop_str: StringResource
get() = DesktopMainString0.desktop_str
@ExperimentalResourceApi
private fun init_desktop_str(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:desktop_str", "desktop_str",
setOf(

3
gradle-plugins/compose/src/test/test-projects/misc/emptyResources/expected/Res.kt

@ -12,7 +12,6 @@ import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.getResourceUri
import org.jetbrains.compose.resources.readResourceBytes
@ExperimentalResourceApi
internal object Res {
/**
* Reads the content of the resource file at the specified path and returns it as a byte array.
@ -22,6 +21,7 @@ internal object Res {
* @param path The path of the file to read in the compose resource's directory.
* @return The content of the file as a byte array.
*/
@ExperimentalResourceApi
public suspend fun readBytes(path: String): ByteArray = readResourceBytes("" + path)
/**
@ -32,6 +32,7 @@ internal object Res {
* @param path The path of the file in the compose resource's directory.
* @return The URI string of the file.
*/
@ExperimentalResourceApi
public fun getUri(path: String): String = getResourceUri("" + path)
public object drawable

3
gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/commonResClass/me/app/jvmonlyresources/generated/resources/Res.kt

@ -12,7 +12,6 @@ import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.getResourceUri
import org.jetbrains.compose.resources.readResourceBytes
@ExperimentalResourceApi
internal object Res {
/**
* Reads the content of the resource file at the specified path and returns it as a byte array.
@ -22,6 +21,7 @@ internal object Res {
* @param path The path of the file to read in the compose resource's directory.
* @return The content of the file as a byte array.
*/
@ExperimentalResourceApi
public suspend fun readBytes(path: String): ByteArray = readResourceBytes("" + path)
/**
@ -32,6 +32,7 @@ internal object Res {
* @param path The path of the file in the compose resource's directory.
* @return The URI string of the file.
*/
@ExperimentalResourceApi
public fun getUri(path: String): String = getResourceUri("" + path)
public object drawable

4
gradle-plugins/compose/src/test/test-projects/misc/jvmOnlyResources/expected/mainResourceAccessors/me/app/jvmonlyresources/generated/resources/Drawable0.main.kt

@ -4,19 +4,15 @@ package me.app.jvmonlyresources.generated.resources
import kotlin.OptIn
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.ExperimentalResourceApi
@ExperimentalResourceApi
private object MainDrawable0 {
public val vector: DrawableResource by
lazy { init_vector() }
}
@ExperimentalResourceApi
internal val Res.drawable.vector: DrawableResource
get() = MainDrawable0.vector
@ExperimentalResourceApi
private fun init_vector(): DrawableResource = org.jetbrains.compose.resources.DrawableResource(
"drawable:vector",
setOf(

Loading…
Cancel
Save