Browse Source

Fix resource accessors compilation when there are huge number of resource files. (#4294)

Instead of object properties there are being generated extension
properties in different files.

fixes https://github.com/JetBrains/compose-multiplatform/issues/4285
igor.demin/fix-pom-publication
Konstantin 10 months ago committed by Igor Demin
parent
commit
cc0e18474a
  1. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/GenerateResClassTask.kt
  2. 122
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/ResourcesSpec.kt
  3. 140
      gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/ResourcesTest.kt
  4. 64
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/Drawable0.kt
  5. 21
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/Font0.kt
  6. 143
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/Res.kt
  7. 98
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/String0.kt
  8. 3
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/src/commonMain/kotlin/App.kt
  9. 6
      gradle-plugins/compose/src/test/test-projects/misc/emptyResources/expected/Res.kt
  10. 50
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/build.gradle.kts
  11. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable0.kt
  12. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable1.kt
  13. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable10.kt
  14. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable11.kt
  15. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable12.kt
  16. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable13.kt
  17. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable14.kt
  18. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable15.kt
  19. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable16.kt
  20. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable17.kt
  21. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable18.kt
  22. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable19.kt
  23. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable2.kt
  24. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable20.kt
  25. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable21.kt
  26. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable22.kt
  27. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable23.kt
  28. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable24.kt
  29. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable25.kt
  30. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable26.kt
  31. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable27.kt
  32. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable28.kt
  33. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable29.kt
  34. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable3.kt
  35. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable30.kt
  36. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable31.kt
  37. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable32.kt
  38. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable33.kt
  39. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable34.kt
  40. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable35.kt
  41. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable36.kt
  42. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable37.kt
  43. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable38.kt
  44. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable39.kt
  45. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable4.kt
  46. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable40.kt
  47. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable41.kt
  48. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable42.kt
  49. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable43.kt
  50. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable44.kt
  51. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable45.kt
  52. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable46.kt
  53. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable47.kt
  54. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable48.kt
  55. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable49.kt
  56. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable5.kt
  57. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable6.kt
  58. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable7.kt
  59. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable8.kt
  60. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable9.kt
  61. 31
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Res.kt
  62. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String0.kt
  63. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String1.kt
  64. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String10.kt
  65. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String11.kt
  66. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String12.kt
  67. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String13.kt
  68. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String14.kt
  69. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String15.kt
  70. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String16.kt
  71. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String17.kt
  72. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String18.kt
  73. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String19.kt
  74. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String2.kt
  75. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String20.kt
  76. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String21.kt
  77. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String22.kt
  78. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String23.kt
  79. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String24.kt
  80. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String25.kt
  81. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String26.kt
  82. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String27.kt
  83. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String28.kt
  84. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String29.kt
  85. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String3.kt
  86. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String30.kt
  87. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String31.kt
  88. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String32.kt
  89. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String33.kt
  90. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String34.kt
  91. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String35.kt
  92. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String36.kt
  93. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String37.kt
  94. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String38.kt
  95. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String39.kt
  96. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String4.kt
  97. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String40.kt
  98. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String41.kt
  99. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String42.kt
  100. 5510
      gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String43.kt
  101. Some files were not shown because too many files have changed in this diff Show More

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/GenerateResClassTask.kt

@ -56,7 +56,7 @@ internal abstract class GenerateResClassTask : DefaultTask() {
} }
.groupBy { it.type } .groupBy { it.type }
.mapValues { (_, items) -> items.groupBy { it.name } } .mapValues { (_, items) -> items.groupBy { it.name } }
getResFileSpec(resources, packageName.get()).writeTo(kotlinDir) getResFileSpecs(resources, packageName.get()).forEach { it.writeTo(kotlinDir) }
} else { } else {
logger.info("Generation Res class is disabled") logger.info("Generation Res class is disabled")
} }

122
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/ResourcesSpec.kt

@ -1,9 +1,9 @@
package org.jetbrains.compose.resources package org.jetbrains.compose.resources
import com.squareup.kotlinpoet.* import com.squareup.kotlinpoet.*
import org.jetbrains.compose.internal.utils.uppercaseFirstChar
import java.nio.file.Path import java.nio.file.Path
import java.util.SortedMap import java.util.*
import java.util.TreeMap
import kotlin.io.path.invariantSeparatorsPathString import kotlin.io.path.invariantSeparatorsPathString
internal enum class ResourceType(val typeName: String) { internal enum class ResourceType(val typeName: String) {
@ -35,6 +35,9 @@ private fun ResourceType.getClassName(): ClassName = when (this) {
} }
private val resourceItemClass = ClassName("org.jetbrains.compose.resources", "ResourceItem") private val resourceItemClass = ClassName("org.jetbrains.compose.resources", "ResourceItem")
private val experimentalAnnotation = AnnotationSpec.builder(
ClassName("org.jetbrains.compose.resources", "ExperimentalResourceApi")
).build()
private fun CodeBlock.Builder.addQualifiers(resourceItem: ResourceItem): CodeBlock.Builder { private fun CodeBlock.Builder.addQualifiers(resourceItem: ResourceItem): CodeBlock.Builder {
val languageQualifier = ClassName("org.jetbrains.compose.resources", "LanguageQualifier") val languageQualifier = ClassName("org.jetbrains.compose.resources", "LanguageQualifier")
@ -101,33 +104,35 @@ private fun CodeBlock.Builder.addQualifiers(resourceItem: ResourceItem): CodeBlo
return this return this
} }
internal fun getResFileSpec( // We need to divide accessors by different files because
//
// if all accessors are generated in a single object
// then a build may fail with: org.jetbrains.org.objectweb.asm.MethodTooLargeException: Method too large: Res$drawable.<clinit> ()V
// e.g. https://github.com/JetBrains/compose-multiplatform/issues/4285
//
// if accessor initializers are extracted from the single object but located in the same file
// then a build may fail with: org.jetbrains.org.objectweb.asm.ClassTooLargeException: Class too large: Res$drawable
private const val ITEMS_PER_FILE_LIMIT = 500
internal fun getResFileSpecs(
//type -> id -> items //type -> id -> items
resources: Map<ResourceType, Map<String, List<ResourceItem>>>, resources: Map<ResourceType, Map<String, List<ResourceItem>>>,
packageName: String packageName: String
): FileSpec = ): List<FileSpec> {
FileSpec.builder(packageName, "Res").apply { val files = mutableListOf<FileSpec>()
addAnnotation( val resClass = FileSpec.builder(packageName, "Res").also { file ->
file.addAnnotation(
AnnotationSpec.builder(ClassName("kotlin", "OptIn")) AnnotationSpec.builder(ClassName("kotlin", "OptIn"))
.addMember("org.jetbrains.compose.resources.InternalResourceApi::class") .addMember("org.jetbrains.compose.resources.InternalResourceApi::class")
.addMember("org.jetbrains.compose.resources.ExperimentalResourceApi::class") .addMember("org.jetbrains.compose.resources.ExperimentalResourceApi::class")
.build() .build()
) )
file.addType(TypeSpec.objectBuilder("Res").also { resObject ->
//we need to sort it to generate the same code on different platforms resObject.addModifiers(KModifier.INTERNAL)
val sortedResources = sortResources(resources) resObject.addAnnotation(experimentalAnnotation)
addType(TypeSpec.objectBuilder("Res").apply {
addModifiers(KModifier.INTERNAL)
addAnnotation(
AnnotationSpec.builder(
ClassName("org.jetbrains.compose.resources", "ExperimentalResourceApi")
).build()
)
//readFileBytes //readFileBytes
val readResourceBytes = MemberName("org.jetbrains.compose.resources", "readResourceBytes") val readResourceBytes = MemberName("org.jetbrains.compose.resources", "readResourceBytes")
addFunction( resObject.addFunction(
FunSpec.builder("readBytes") FunSpec.builder("readBytes")
.addKdoc( .addKdoc(
""" """
@ -145,48 +150,51 @@ internal fun getResFileSpec(
.addStatement("return %M(path)", readResourceBytes) //todo: add module ID here .addStatement("return %M(path)", readResourceBytes) //todo: add module ID here
.build() .build()
) )
val types = sortedResources.map { (type, idToResources) -> ResourceType.values().forEach { type ->
getResourceTypeObject(type, idToResources) resObject.addType(TypeSpec.objectBuilder(type.typeName).build())
} }
addTypes(types)
}.build()) }.build())
}.build()
files.add(resClass)
//we need to sort it to generate the same code on different platforms
sortResources(resources).forEach { (type, idToResources) ->
val chunks = idToResources.keys.chunked(ITEMS_PER_FILE_LIMIT)
sortedResources chunks.forEachIndexed { index, ids ->
.flatMap { (type, idToResources) -> files.add(
idToResources.map { (name, items) -> getChunkFileSpec(type, index, packageName, idToResources.subMap(ids.first(), true, ids.last(), true))
getResourceInitializer(name, type, items) )
} }
} }
.forEach { addFunction(it) }
}.build()
private fun getterName(resourceType: ResourceType, resourceName: String): String = return files
"get_${resourceType.typeName}_$resourceName" }
private fun getResourceTypeObject(type: ResourceType, nameToResources: Map<String, List<ResourceItem>>) = private fun getChunkFileSpec(
TypeSpec.objectBuilder(type.typeName).apply { type: ResourceType,
nameToResources.keys index: Int,
.forEach { name -> packageName: String,
addProperty( idToResources: Map<String, List<ResourceItem>>
PropertySpec ): FileSpec {
.builder(name, type.getClassName()) val chunkClassName = type.typeName.uppercaseFirstChar() + index
.initializer(getterName(type, name) + "()") return FileSpec.builder(packageName, chunkClassName).also { chunkFile ->
chunkFile.addAnnotation(
AnnotationSpec.builder(ClassName("kotlin", "OptIn"))
.addMember("org.jetbrains.compose.resources.InternalResourceApi::class")
.build() .build()
) )
}
}.build()
private fun getResourceInitializer(name: String, type: ResourceType, items: List<ResourceItem>): FunSpec { val objectSpec = TypeSpec.objectBuilder(chunkClassName).also { typeObject ->
val propertyTypeName = type.getClassName() typeObject.addModifiers(KModifier.PRIVATE)
val resourceId = "${type}:${name}" typeObject.addAnnotation(experimentalAnnotation)
return FunSpec.builder(getterName(type, name)) val properties = idToResources.map { (resName, items) ->
.addModifiers(KModifier.PRIVATE) PropertySpec.builder(resName, type.getClassName())
.returns(propertyTypeName) .initializer(
.addStatement(
CodeBlock.builder() CodeBlock.builder()
.add("return %T(\n", propertyTypeName).withIndent { .add("%T(\n", type.getClassName()).withIndent {
add("\"$resourceId\",") add("\"${type}:${resName}\",")
if (type == ResourceType.STRING) add(" \"$name\",") if (type == ResourceType.STRING) add(" \"$resName\",")
withIndent { withIndent {
add("\nsetOf(\n").withIndent { add("\nsetOf(\n").withIndent {
items.forEach { item -> items.forEach { item ->
@ -205,6 +213,20 @@ private fun getResourceInitializer(name: String, type: ResourceType, items: List
) )
.build() .build()
} }
typeObject.addProperties(properties)
}.build()
chunkFile.addType(objectSpec)
idToResources.keys.forEach { resName ->
val accessor = PropertySpec.builder(resName, type.getClassName(), KModifier.INTERNAL)
.receiver(ClassName(packageName, "Res", type.typeName))
.addAnnotation(experimentalAnnotation)
.getter(FunSpec.getterBuilder().addStatement("return $chunkClassName.$resName").build())
.build()
chunkFile.addProperty(accessor)
}
}.build()
}
private fun sortResources( private fun sortResources(
resources: Map<ResourceType, Map<String, List<ResourceItem>>> resources: Map<ResourceType, Map<String, List<ResourceItem>>>

140
gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/ResourcesTest.kt

@ -4,6 +4,7 @@ import org.jetbrains.compose.test.utils.*
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import java.io.File import java.io.File
import java.util.zip.ZipFile import java.util.zip.ZipFile
import kotlin.io.path.relativeTo
import kotlin.test.* import kotlin.test.*
class ResourcesTest : GradlePluginTestBase() { class ResourcesTest : GradlePluginTestBase() {
@ -11,9 +12,9 @@ class ResourcesTest : GradlePluginTestBase() {
fun testGeneratedAccessors(): Unit = with(testProject("misc/commonResources")) { fun testGeneratedAccessors(): Unit = with(testProject("misc/commonResources")) {
//check generated resource's accessors //check generated resource's accessors
gradle("generateComposeResClass").checks { gradle("generateComposeResClass").checks {
assertEqualTextFiles( assertDirectoriesContentEquals(
file("build/generated/compose/resourceGenerator/kotlin/app/group/resources_test/generated/resources/Res.kt"), file("build/generated/compose/resourceGenerator/kotlin/app/group/resources_test/generated/resources"),
file("expected/Res.kt") file("expected")
) )
} }
@ -23,8 +24,8 @@ class ResourcesTest : GradlePluginTestBase() {
) )
gradle("generateComposeResClass").checks { gradle("generateComposeResClass").checks {
assertNotEqualTextFiles( assertNotEqualTextFiles(
file("build/generated/compose/resourceGenerator/kotlin/app/group/resources_test/generated/resources/Res.kt"), file("build/generated/compose/resourceGenerator/kotlin/app/group/resources_test/generated/resources/Drawable0.kt"),
file("expected/Res.kt") file("expected/Drawable0.kt")
) )
} }
@ -123,6 +124,12 @@ class ResourcesTest : GradlePluginTestBase() {
file("src/commonMain/composeResources/drawable/vector_3.xml").renameTo( file("src/commonMain/composeResources/drawable/vector_3.xml").renameTo(
file("src/commonMain/composeResources/drawable/vector_2.xml") file("src/commonMain/composeResources/drawable/vector_2.xml")
) )
gradle("generateComposeResClass").checks {
assertDirectoriesContentEquals(
file("build/generated/compose/resourceGenerator/kotlin/app/group/resources_test/generated/resources"),
file("expected")
)
}
} }
@Test @Test
@ -271,9 +278,9 @@ class ResourcesTest : GradlePluginTestBase() {
@Test @Test
fun testEmptyResClass(): Unit = with(testProject("misc/emptyResources")) { fun testEmptyResClass(): Unit = with(testProject("misc/emptyResources")) {
gradle("generateComposeResClass").checks { gradle("generateComposeResClass").checks {
assertEqualTextFiles( assertDirectoriesContentEquals(
file("build/generated/compose/resourceGenerator/kotlin/app/group/empty_res/generated/resources/Res.kt"), file("build/generated/compose/resourceGenerator/kotlin/app/group/empty_res/generated/resources"),
file("expected/Res.kt") file("expected")
) )
} }
} }
@ -281,96 +288,30 @@ class ResourcesTest : GradlePluginTestBase() {
@Test @Test
fun testJvmOnlyProject(): Unit = with(testProject("misc/jvmOnlyResources")) { fun testJvmOnlyProject(): Unit = with(testProject("misc/jvmOnlyResources")) {
gradle("generateComposeResClass").checks { gradle("generateComposeResClass").checks {
assertEqualTextFiles( assertDirectoriesContentEquals(
file("build/generated/compose/resourceGenerator/kotlin/me/app/jvmonlyresources/generated/resources/Res.kt"), file("build/generated/compose/resourceGenerator/kotlin/me/app/jvmonlyresources/generated/resources"),
file("expected/Res.kt") file("expected")
) )
} }
gradle("jar") gradle("jar")
} }
//https://github.com/JetBrains/compose-multiplatform/issues/4194 //https://github.com/JetBrains/compose-multiplatform/issues/4194
//https://github.com/JetBrains/compose-multiplatform/issues/4285
//
// 25_000 icons + 25_000 strings!!!
@Test @Test
fun testHugeNumberOfStrings(): Unit = with( fun testHugeNumberOfResources(): Unit = with(
//disable cache for the test because the generateStringFiles task doesn't support it //disable cache for the test because the generateResourceFiles task doesn't support it
testProject("misc/commonResources", defaultTestEnvironment.copy(useGradleConfigurationCache = false)) testProject("misc/hugeResources", defaultTestEnvironment.copy(useGradleConfigurationCache = false))
) { ) {
file("build.gradle.kts").let { f -> gradle("compileKotlinDesktop").checks {
val originText = f.readText() check.taskSuccessful(":generateResourceFiles")
f.writeText(
buildString {
appendLine("import java.util.Locale")
append(originText)
appendLine()
append("""
val template = ""${'"'}
<resources>
<string name="app_name">Compose Resources App</string>
<string name="hello">😊 Hello world!</string>
<string name="multi_line">Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
Donec eget turpis ac sem ultricies consequat.</string>
<string name="str_template">Hello, %1${'$'}{"$"}s! You have %2${'$'}{"$"}d new messages.</string>
<string-array name="str_arr">
<item>item 1</item>
<item>item 2</item>
<item>item 3</item>
</string-array>
[ADDITIONAL_STRINGS]
</resources>
""${'"'}.trimIndent()
val generateStringFiles = tasks.register("generateStringFiles") {
val numberOfLanguages = 20
val numberOfStrings = 500
val langs = Locale.getAvailableLocales()
.map { it.language }
.filter { it.count() == 2 }
.sorted()
.distinct()
.take(numberOfLanguages)
.toList()
val resourcesFolder = project.file("src/commonMain/composeResources")
doLast {
// THIS REMOVES THE `values` FOLDER IN `composeResources`
// THIS REMOVES THE `values` FOLDER IN `composeResources`
// Necessary when reducing the number of languages.
resourcesFolder.listFiles()?.filter { it.name.startsWith("values") }?.forEach {
it.deleteRecursively()
}
langs.forEachIndexed { langIndex, lang ->
val additionalStrings =
(0 until numberOfStrings).joinToString(System.lineSeparator()) { index ->
""${'"'}
<string name="string_${'$'}{index.toString().padStart(4, '0')}">String ${'$'}index in lang ${'$'}lang</string>
""${'"'}.trimIndent()
}
val langFile = if (langIndex == 0) {
File(resourcesFolder, "values/strings.xml")
} else {
File(resourcesFolder, "values-${'$'}lang/strings.xml")
}
langFile.parentFile.mkdirs()
langFile.writeText(template.replace("[ADDITIONAL_STRINGS]", additionalStrings))
}
}
}
tasks.named("generateComposeResClass") {
dependsOn(generateStringFiles)
}
""".trimIndent())
}
)
}
gradle("desktopJar").checks {
check.taskSuccessful(":generateStringFiles")
check.taskSuccessful(":generateComposeResClass") check.taskSuccessful(":generateComposeResClass")
assertEquals(513, file("src/commonMain/composeResources/values/strings.xml").readLines().size) assertDirectoriesContentEquals(
file("build/generated/compose/resourceGenerator/kotlin/app/group/huge/generated/resources"),
file("expected")
)
} }
} }
@ -379,4 +320,25 @@ class ResourcesTest : GradlePluginTestBase() {
fun testBundledKotlinPoet(): Unit = with(testProject("misc/bundledKotlinPoet")) { fun testBundledKotlinPoet(): Unit = with(testProject("misc/bundledKotlinPoet")) {
gradle("generateBuildConfig") gradle("generateBuildConfig")
} }
private fun assertDirectoriesContentEquals(actual: File, expected: File) {
require(expected.isDirectory)
require(actual.isDirectory)
assertEquals(expected.exists(), actual.exists())
val expectedPath = expected.toPath()
val actualPath = actual.toPath()
expected.walkTopDown().forEach { expectedFile ->
if (!expectedFile.isDirectory) {
val actualFile = actualPath.resolve(expectedFile.toPath().relativeTo(expectedPath)).toFile()
assertEqualTextFiles(actualFile, expectedFile)
}
}
val expectedFilesCount = expected.walkTopDown()
.map { it.toPath().relativeTo(expectedPath) }.sorted().joinToString("\n")
val actualFilesCount = actual.walkTopDown()
.map { it.toPath().relativeTo(actualPath) }.sorted().joinToString("\n")
assertEquals(expectedFilesCount, actualFilesCount)
}
} }

64
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/Drawable0.kt

@ -0,0 +1,64 @@
@file:OptIn(org.jetbrains.compose.resources.InternalResourceApi::class)
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 Drawable0 {
public val _3_strange_name: DrawableResource = org.jetbrains.compose.resources.DrawableResource(
"drawable:_3_strange_name",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/3-strange-name.xml"),
)
)
public val camelCaseName: DrawableResource = org.jetbrains.compose.resources.DrawableResource(
"drawable:camelCaseName",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/camelCaseName.xml"),
)
)
public val vector: DrawableResource = org.jetbrains.compose.resources.DrawableResource(
"drawable:vector",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(org.jetbrains.compose.resources.LanguageQualifier("au"),
org.jetbrains.compose.resources.RegionQualifier("US"), ), "drawable-au-rUS/vector.xml"),
org.jetbrains.compose.resources.ResourceItem(setOf(org.jetbrains.compose.resources.ThemeQualifier.DARK,
org.jetbrains.compose.resources.LanguageQualifier("ge"), ),
"drawable-dark-ge/vector.xml"),
org.jetbrains.compose.resources.ResourceItem(setOf(org.jetbrains.compose.resources.LanguageQualifier("en"),
), "drawable-en/vector.xml"),
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/vector.xml"),
)
)
public val vector_2: DrawableResource = org.jetbrains.compose.resources.DrawableResource(
"drawable:vector_2",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/vector_2.xml"),
)
)
}
@ExperimentalResourceApi
internal val Res.drawable._3_strange_name: DrawableResource
get() = Drawable0._3_strange_name
@ExperimentalResourceApi
internal val Res.drawable.camelCaseName: DrawableResource
get() = Drawable0.camelCaseName
@ExperimentalResourceApi
internal val Res.drawable.vector: DrawableResource
get() = Drawable0.vector
@ExperimentalResourceApi
internal val Res.drawable.vector_2: DrawableResource
get() = Drawable0.vector_2

21
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/Font0.kt

@ -0,0 +1,21 @@
@file:OptIn(org.jetbrains.compose.resources.InternalResourceApi::class)
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 Font0 {
public val emptyFont: FontResource = org.jetbrains.compose.resources.FontResource(
"font:emptyFont",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "font/emptyFont.otf"),
)
)
}
@ExperimentalResourceApi
internal val Res.font.emptyFont: FontResource
get() = Font0.emptyFont

143
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/Res.kt

@ -8,10 +8,7 @@ package app.group.resources_test.generated.resources
import kotlin.ByteArray import kotlin.ByteArray
import kotlin.OptIn import kotlin.OptIn
import kotlin.String import kotlin.String
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.FontResource
import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.readResourceBytes import org.jetbrains.compose.resources.readResourceBytes
@ExperimentalResourceApi @ExperimentalResourceApi
@ -26,143 +23,9 @@ internal object Res {
*/ */
public suspend fun readBytes(path: String): ByteArray = readResourceBytes(path) public suspend fun readBytes(path: String): ByteArray = readResourceBytes(path)
public object drawable { public object drawable
public val _3_strange_name: DrawableResource = get_drawable__3_strange_name()
public val camelCaseName: DrawableResource = get_drawable_camelCaseName() public object string
public val vector: DrawableResource = get_drawable_vector() public object font
public val vector_2: DrawableResource = get_drawable_vector_2()
}
public object string {
public val PascalCase: StringResource = get_string_PascalCase()
public val _1_kebab_case: StringResource = get_string__1_kebab_case()
public val app_name: StringResource = get_string_app_name()
public val camelCase: StringResource = get_string_camelCase()
public val hello: StringResource = get_string_hello()
public val multi_line: StringResource = get_string_multi_line()
public val str_arr: StringResource = get_string_str_arr()
public val str_template: StringResource = get_string_str_template()
} }
public object font {
public val emptyFont: FontResource = get_font_emptyFont()
}
}
private fun get_drawable__3_strange_name(): DrawableResource =
org.jetbrains.compose.resources.DrawableResource(
"drawable:_3_strange_name",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/3-strange-name.xml"),
)
)
private fun get_drawable_camelCaseName(): DrawableResource =
org.jetbrains.compose.resources.DrawableResource(
"drawable:camelCaseName",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/camelCaseName.xml"),
)
)
private fun get_drawable_vector(): DrawableResource =
org.jetbrains.compose.resources.DrawableResource(
"drawable:vector",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(org.jetbrains.compose.resources.LanguageQualifier("au"),
org.jetbrains.compose.resources.RegionQualifier("US"), ), "drawable-au-rUS/vector.xml"),
org.jetbrains.compose.resources.ResourceItem(setOf(org.jetbrains.compose.resources.ThemeQualifier.DARK,
org.jetbrains.compose.resources.LanguageQualifier("ge"), ), "drawable-dark-ge/vector.xml"),
org.jetbrains.compose.resources.ResourceItem(setOf(org.jetbrains.compose.resources.LanguageQualifier("en"),
), "drawable-en/vector.xml"),
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/vector.xml"),
)
)
private fun get_drawable_vector_2(): DrawableResource =
org.jetbrains.compose.resources.DrawableResource(
"drawable:vector_2",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/vector_2.xml"),
)
)
private fun get_string_PascalCase(): StringResource =
org.jetbrains.compose.resources.StringResource(
"string:PascalCase", "PascalCase",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
private fun get_string__1_kebab_case(): StringResource =
org.jetbrains.compose.resources.StringResource(
"string:_1_kebab_case", "_1_kebab_case",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
private fun get_string_app_name(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:app_name", "app_name",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
private fun get_string_camelCase(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:camelCase", "camelCase",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
private fun get_string_hello(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:hello", "hello",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
private fun get_string_multi_line(): StringResource =
org.jetbrains.compose.resources.StringResource(
"string:multi_line", "multi_line",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
private fun get_string_str_arr(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:str_arr", "str_arr",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
private fun get_string_str_template(): StringResource =
org.jetbrains.compose.resources.StringResource(
"string:str_template", "str_template",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
private fun get_font_emptyFont(): FontResource = org.jetbrains.compose.resources.FontResource(
"font:emptyFont",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "font/emptyFont.otf"),
)
)

98
gradle-plugins/compose/src/test/test-projects/misc/commonResources/expected/String0.kt

@ -0,0 +1,98 @@
@file:OptIn(org.jetbrains.compose.resources.InternalResourceApi::class)
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 String0 {
public val PascalCase: StringResource = org.jetbrains.compose.resources.StringResource(
"string:PascalCase", "PascalCase",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val _1_kebab_case: StringResource = org.jetbrains.compose.resources.StringResource(
"string:_1_kebab_case", "_1_kebab_case",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val app_name: StringResource = org.jetbrains.compose.resources.StringResource(
"string:app_name", "app_name",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val camelCase: StringResource = org.jetbrains.compose.resources.StringResource(
"string:camelCase", "camelCase",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val hello: StringResource = org.jetbrains.compose.resources.StringResource(
"string:hello", "hello",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val multi_line: StringResource = org.jetbrains.compose.resources.StringResource(
"string:multi_line", "multi_line",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val str_arr: StringResource = org.jetbrains.compose.resources.StringResource(
"string:str_arr", "str_arr",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val str_template: StringResource = org.jetbrains.compose.resources.StringResource(
"string:str_template", "str_template",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
}
@ExperimentalResourceApi
internal val Res.string.PascalCase: StringResource
get() = String0.PascalCase
@ExperimentalResourceApi
internal val Res.string._1_kebab_case: StringResource
get() = String0._1_kebab_case
@ExperimentalResourceApi
internal val Res.string.app_name: StringResource
get() = String0.app_name
@ExperimentalResourceApi
internal val Res.string.camelCase: StringResource
get() = String0.camelCase
@ExperimentalResourceApi
internal val Res.string.hello: StringResource
get() = String0.hello
@ExperimentalResourceApi
internal val Res.string.multi_line: StringResource
get() = String0.multi_line
@ExperimentalResourceApi
internal val Res.string.str_arr: StringResource
get() = String0.str_arr
@ExperimentalResourceApi
internal val Res.string.str_template: StringResource
get() = String0.str_template

3
gradle-plugins/compose/src/test/test-projects/misc/commonResources/src/commonMain/kotlin/App.kt

@ -6,6 +6,9 @@ import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import app.group.resources_test.generated.resources.Res import app.group.resources_test.generated.resources.Res
import app.group.resources_test.generated.resources.app_name
import app.group.resources_test.generated.resources.emptyFont
import app.group.resources_test.generated.resources.vector
import org.jetbrains.compose.resources.* import org.jetbrains.compose.resources.*
@OptIn(ExperimentalResourceApi::class) @OptIn(ExperimentalResourceApi::class)

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

@ -22,4 +22,10 @@ internal object Res {
* @return The content of the file as a byte array. * @return The content of the file as a byte array.
*/ */
public suspend fun readBytes(path: String): ByteArray = readResourceBytes(path) public suspend fun readBytes(path: String): ByteArray = readResourceBytes(path)
public object drawable
public object string
public object font
} }

50
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/build.gradle.kts

@ -0,0 +1,50 @@
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
}
group = "app.group"
kotlin {
jvm("desktop")
sourceSets {
commonMain {
dependencies {
implementation(compose.runtime)
implementation(compose.material)
implementation(compose.components.resources)
}
}
}
}
val generateResourceFiles = tasks.register("generateResourceFiles") {
val resourcesFolder = project.file("src/commonMain/composeResources")
val count = 25_000
doLast {
val txt = buildString {
appendLine("<resources>")
repeat(count) {
appendLine(" <string name=\"str_${it}\">str_${it}</string>")
}
appendLine("</resources>")
}
File(resourcesFolder, "values/strings.xml").apply {
parentFile.mkdirs()
writeText(txt)
}
}
doLast {
repeat(count) {
File(resourcesFolder, "drawable/icon_$it.xml").apply {
parentFile.mkdirs()
createNewFile() //empty file
}
}
}
}
tasks.named("generateComposeResClass") {
dependsOn(generateResourceFiles)
}

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable0.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable1.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable10.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable11.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable12.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable13.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable14.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable15.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable16.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable17.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable18.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable19.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable2.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable20.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable21.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable22.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable23.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable24.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable25.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable26.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable27.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable28.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable29.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable3.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable30.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable31.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable32.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable33.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable34.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable35.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable36.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable37.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable38.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable39.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable4.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable40.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable41.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable42.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable43.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable44.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable45.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable46.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable47.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable48.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable49.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable5.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable6.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable7.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable8.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Drawable9.kt

File diff suppressed because it is too large Load Diff

31
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/Res.kt

@ -0,0 +1,31 @@
@file:OptIn(
org.jetbrains.compose.resources.InternalResourceApi::class,
org.jetbrains.compose.resources.ExperimentalResourceApi::class,
)
package app.group.huge.generated.resources
import kotlin.ByteArray
import kotlin.OptIn
import kotlin.String
import org.jetbrains.compose.resources.ExperimentalResourceApi
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.
*
* Example: `val bytes = Res.readBytes("files/key.bin")`
*
* @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.
*/
public suspend fun readBytes(path: String): ByteArray = readResourceBytes(path)
public object drawable
public object string
public object font
}

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String0.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String1.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String10.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String11.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String12.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String13.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String14.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String15.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String16.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String17.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String18.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String19.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String2.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String20.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String21.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String22.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String23.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String24.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String25.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String26.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String27.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String28.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String29.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String3.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String30.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String31.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String32.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String33.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String34.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String35.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String36.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String37.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String38.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String39.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String4.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String40.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String41.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String42.kt

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String43.kt

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save