Browse Source
Instead of object properties there are being generated extension properties in different files. fixes https://github.com/JetBrains/compose-multiplatform/issues/4285pull/4296/head
Konstantin
9 months ago
committed by
GitHub
117 changed files with 551493 additions and 324 deletions
@ -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 |
@ -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 |
@ -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 |
@ -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) |
||||
} |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -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 |
||||
} |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
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…
Reference in new issue