Browse Source

[resources] Init resource accessors lazily and in external function to avoid MethodTooLargeException (#4404)

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

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

@ -188,42 +188,50 @@ private fun getChunkFileSpec(
val objectSpec = TypeSpec.objectBuilder(chunkClassName).also { typeObject -> val objectSpec = TypeSpec.objectBuilder(chunkClassName).also { typeObject ->
typeObject.addModifiers(KModifier.PRIVATE) typeObject.addModifiers(KModifier.PRIVATE)
typeObject.addAnnotation(experimentalAnnotation) typeObject.addAnnotation(experimentalAnnotation)
val properties = idToResources.map { (resName, items) -> val properties = idToResources.keys.map { resName ->
PropertySpec.builder(resName, type.getClassName()) PropertySpec.builder(resName, type.getClassName())
.initializer( .delegate("\nlazy·{ init_$resName() }")
CodeBlock.builder()
.add("%T(\n", type.getClassName()).withIndent {
add("\"${type}:${resName}\",")
if (type == ResourceType.STRING) add(" \"$resName\",")
withIndent {
add("\nsetOf(\n").withIndent {
items.forEach { item ->
add("%T(", resourceItemClass)
add("setOf(").addQualifiers(item).add("), ")
//file separator should be '/' on all platforms
add("\"${item.path.invariantSeparatorsPathString}\"") //todo: add module ID here
add("),\n")
}
}
add(")\n")
}
}
.add(")")
.build().toString()
)
.build() .build()
} }
typeObject.addProperties(properties) typeObject.addProperties(properties)
}.build() }.build()
chunkFile.addType(objectSpec) chunkFile.addType(objectSpec)
idToResources.keys.forEach { resName -> idToResources.forEach { (resName, items) ->
val accessor = PropertySpec.builder(resName, type.getClassName(), KModifier.INTERNAL) val accessor = PropertySpec.builder(resName, type.getClassName(), KModifier.INTERNAL)
.receiver(ClassName(packageName, "Res", type.typeName)) .receiver(ClassName(packageName, "Res", type.typeName))
.addAnnotation(experimentalAnnotation) .addAnnotation(experimentalAnnotation)
.getter(FunSpec.getterBuilder().addStatement("return $chunkClassName.$resName").build()) .getter(FunSpec.getterBuilder().addStatement("return $chunkClassName.$resName").build())
.build() .build()
chunkFile.addProperty(accessor) chunkFile.addProperty(accessor)
val initializer = FunSpec.builder("init_$resName")
.addModifiers(KModifier.PRIVATE)
.addAnnotation(experimentalAnnotation)
.returns(type.getClassName())
.addStatement(
CodeBlock.builder()
.add("return %T(\n", type.getClassName()).withIndent {
add("\"${type}:${resName}\",")
if (type == ResourceType.STRING) add(" \"$resName\",")
withIndent {
add("\nsetOf(\n").withIndent {
items.forEach { item ->
add("%T(", resourceItemClass)
add("setOf(").addQualifiers(item).add("), ")
//file separator should be '/' on all platforms
add("\"${item.path.invariantSeparatorsPathString}\"") //todo: add module ID here
add("),\n")
}
}
add(")\n")
}
}
.add(")")
.build().toString()
)
.build()
chunkFile.addFunction(initializer)
} }
}.build() }.build()
} }

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

@ -299,7 +299,7 @@ class ResourcesTest : GradlePluginTestBase() {
//https://github.com/JetBrains/compose-multiplatform/issues/4194 //https://github.com/JetBrains/compose-multiplatform/issues/4194
//https://github.com/JetBrains/compose-multiplatform/issues/4285 //https://github.com/JetBrains/compose-multiplatform/issues/4285
// //
// 25_000 icons + 25_000 strings!!! // 1500 icons + 1500*20 strings!!!
@Test @Test
fun testHugeNumberOfResources(): Unit = with( fun testHugeNumberOfResources(): Unit = with(
//disable cache for the test because the generateResourceFiles task doesn't support it //disable cache for the test because the generateResourceFiles task doesn't support it

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

@ -8,60 +8,77 @@ import org.jetbrains.compose.resources.ExperimentalResourceApi
@ExperimentalResourceApi @ExperimentalResourceApi
private object Drawable0 { private object Drawable0 {
public val _3_strange_name: DrawableResource = org.jetbrains.compose.resources.DrawableResource( public val _3_strange_name: DrawableResource by
"drawable:_3_strange_name", lazy { init__3_strange_name() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/3-strange-name.xml"),
)
)
public val camelCaseName: DrawableResource = org.jetbrains.compose.resources.DrawableResource( public val camelCaseName: DrawableResource by
"drawable:camelCaseName", lazy { init_camelCaseName() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/camelCaseName.xml"),
)
)
public val vector: DrawableResource = org.jetbrains.compose.resources.DrawableResource( public val vector: DrawableResource by
"drawable:vector", lazy { init_vector() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(org.jetbrains.compose.resources.LanguageQualifier("ast"), public val vector_2: DrawableResource by
), "drawable-ast/vector.xml"), lazy { init_vector_2() }
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 @ExperimentalResourceApi
internal val Res.drawable._3_strange_name: DrawableResource internal val Res.drawable._3_strange_name: DrawableResource
get() = Drawable0._3_strange_name get() = Drawable0._3_strange_name
@ExperimentalResourceApi
private fun init__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"),
)
)
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.drawable.camelCaseName: DrawableResource internal val Res.drawable.camelCaseName: DrawableResource
get() = Drawable0.camelCaseName get() = Drawable0.camelCaseName
@ExperimentalResourceApi
private fun init_camelCaseName(): DrawableResource =
org.jetbrains.compose.resources.DrawableResource(
"drawable:camelCaseName",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/camelCaseName.xml"),
)
)
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.drawable.vector: DrawableResource internal val Res.drawable.vector: DrawableResource
get() = Drawable0.vector get() = Drawable0.vector
@ExperimentalResourceApi
private fun init_vector(): DrawableResource = org.jetbrains.compose.resources.DrawableResource(
"drawable:vector",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(org.jetbrains.compose.resources.LanguageQualifier("ast"),
), "drawable-ast/vector.xml"),
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"),
)
)
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.drawable.vector_2: DrawableResource internal val Res.drawable.vector_2: DrawableResource
get() = Drawable0.vector_2 get() = Drawable0.vector_2
@ExperimentalResourceApi
private fun init_vector_2(): DrawableResource = org.jetbrains.compose.resources.DrawableResource(
"drawable:vector_2",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "drawable/vector_2.xml"),
)
)

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

@ -8,14 +8,18 @@ import org.jetbrains.compose.resources.FontResource
@ExperimentalResourceApi @ExperimentalResourceApi
private object Font0 { private object Font0 {
public val emptyFont: FontResource = org.jetbrains.compose.resources.FontResource( public val emptyFont: FontResource by
"font:emptyFont", lazy { init_emptyFont() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "font/emptyFont.otf"),
)
)
} }
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.font.emptyFont: FontResource internal val Res.font.emptyFont: FontResource
get() = Font0.emptyFont get() = Font0.emptyFont
@ExperimentalResourceApi
private fun init_emptyFont(): FontResource = org.jetbrains.compose.resources.FontResource(
"font:emptyFont",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "font/emptyFont.otf"),
)
)

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

@ -8,91 +8,123 @@ import org.jetbrains.compose.resources.StringResource
@ExperimentalResourceApi @ExperimentalResourceApi
private object String0 { private object String0 {
public val PascalCase: StringResource = org.jetbrains.compose.resources.StringResource( public val PascalCase: StringResource by
"string:PascalCase", "PascalCase", lazy { init_PascalCase() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val _1_kebab_case: StringResource = org.jetbrains.compose.resources.StringResource( public val _1_kebab_case: StringResource by
"string:_1_kebab_case", "_1_kebab_case", lazy { init__1_kebab_case() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val app_name: StringResource = org.jetbrains.compose.resources.StringResource( public val app_name: StringResource by
"string:app_name", "app_name", lazy { init_app_name() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val camelCase: StringResource = org.jetbrains.compose.resources.StringResource( public val camelCase: StringResource by
"string:camelCase", "camelCase", lazy { init_camelCase() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val hello: StringResource = org.jetbrains.compose.resources.StringResource( public val hello: StringResource by
"string:hello", "hello", lazy { init_hello() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val multi_line: StringResource = org.jetbrains.compose.resources.StringResource( public val multi_line: StringResource by
"string:multi_line", "multi_line", lazy { init_multi_line() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val str_arr: StringResource = org.jetbrains.compose.resources.StringResource( public val str_arr: StringResource by
"string:str_arr", "str_arr", lazy { init_str_arr() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
public val str_template: StringResource = org.jetbrains.compose.resources.StringResource( public val str_template: StringResource by
"string:str_template", "str_template", lazy { init_str_template() }
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
} }
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.string.PascalCase: StringResource internal val Res.string.PascalCase: StringResource
get() = String0.PascalCase get() = String0.PascalCase
@ExperimentalResourceApi
private fun init_PascalCase(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:PascalCase", "PascalCase",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.string._1_kebab_case: StringResource internal val Res.string._1_kebab_case: StringResource
get() = String0._1_kebab_case get() = String0._1_kebab_case
@ExperimentalResourceApi
private fun init__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"),
)
)
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.string.app_name: StringResource internal val Res.string.app_name: StringResource
get() = String0.app_name get() = String0.app_name
@ExperimentalResourceApi
private fun init_app_name(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:app_name", "app_name",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.string.camelCase: StringResource internal val Res.string.camelCase: StringResource
get() = String0.camelCase get() = String0.camelCase
@ExperimentalResourceApi
private fun init_camelCase(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:camelCase", "camelCase",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.string.hello: StringResource internal val Res.string.hello: StringResource
get() = String0.hello get() = String0.hello
@ExperimentalResourceApi
private fun init_hello(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:hello", "hello",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.string.multi_line: StringResource internal val Res.string.multi_line: StringResource
get() = String0.multi_line get() = String0.multi_line
@ExperimentalResourceApi
private fun init_multi_line(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:multi_line", "multi_line",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.string.str_arr: StringResource internal val Res.string.str_arr: StringResource
get() = String0.str_arr get() = String0.str_arr
@ExperimentalResourceApi
private fun init_str_arr(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:str_arr", "str_arr",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)
@ExperimentalResourceApi @ExperimentalResourceApi
internal val Res.string.str_template: StringResource internal val Res.string.str_template: StringResource
get() = String0.str_template get() = String0.str_template
@ExperimentalResourceApi
private fun init_str_template(): StringResource = org.jetbrains.compose.resources.StringResource(
"string:str_template", "str_template",
setOf(
org.jetbrains.compose.resources.ResourceItem(setOf(), "values/strings.xml"),
)
)

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

@ -1,3 +1,5 @@
import java.util.Locale
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
id("org.jetbrains.compose") id("org.jetbrains.compose")
@ -21,7 +23,15 @@ kotlin {
val generateResourceFiles = tasks.register("generateResourceFiles") { val generateResourceFiles = tasks.register("generateResourceFiles") {
val resourcesFolder = project.file("src/commonMain/composeResources") val resourcesFolder = project.file("src/commonMain/composeResources")
val count = 25_000 val count = 1500
val numberOfLanguages = 20
val langs = Locale.getAvailableLocales()
.map { it.language }
.filter { it.count() == 2 }
.sorted()
.distinct()
.take(numberOfLanguages)
.toList()
doLast { doLast {
val txt = buildString { val txt = buildString {
appendLine("<resources>") appendLine("<resources>")
@ -30,9 +40,12 @@ val generateResourceFiles = tasks.register("generateResourceFiles") {
} }
appendLine("</resources>") appendLine("</resources>")
} }
File(resourcesFolder, "values/strings.xml").apply { langs.forEachIndexed { langIndex, lang ->
parentFile.mkdirs() val stringsFileName = if (langIndex == 0) "values/strings.xml" else "values-$lang/strings.xml"
writeText(txt) File(resourcesFolder, stringsFileName).apply {
parentFile.mkdirs()
writeText(txt)
}
} }
} }
doLast { doLast {

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

File diff suppressed because it is too large Load Diff

10998
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

10998
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

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

File diff suppressed because it is too large Load Diff

40498
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

40498
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

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

5510
gradle-plugins/compose/src/test/test-projects/misc/hugeResources/expected/String48.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