-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gradle] Add DSL to configure compose resources #4482
Conversation
2dfc72d
to
7412abf
Compare
Adding a second reviewer, as we introduce a new API |
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/ResourcesExtension.kt
Outdated
Show resolved
Hide resolved
Renamed DSL parameter to make it more clear compose.resources {
publicResClass = true
- resourceProjectId = "me.sample.library.resources"
+ packageOfResClass = "me.sample.library.resources"
generateResClass = auto
} |
Example: compose.resources { publicResClass = true resourceProjectId = "me.sample.library.resources" generateResClass = auto }
…xtension.packageOfResClass'
94e15a2
to
3dcb3d1
Compare
Ports a part of Unicode's ICU in pure Kotlin and implements Android-style plural string resource support. Fixes #425. # Changes - Added `org.jetbrains.compose.resources.intl.{PluralCategory, PluralRule, PluralRuleList}`, which parses and evaluates scripts in Unicode's Locale Data Markup Langauge. - Copied `plurals.xml` from Unicode's [CLDR](https://github.com/unicode-org/cldr/blob/release-44-1/common/supplemental/plurals.xml). - Added `GeneratePluralRuleListsTask`, which parses `plurals.xml` and generates required Kotlin source codes. - Added `PluralStringResource`, `pluralStringResource`, or `getPluralString`, corresponding to `StringResource`, `stringResource`, or `getString`. - Modified `ResourcesSpec.kt` so the generated `Res` class exposes `Res.plurals`. # Potential Further Improvements - [ ] Allow configuring the default language in the `compose.resources {}` block (#4482) to determine the default pluralization rule (or just presume English as default) - [ ] Move the parser logic to the Gradle plugin and generate pluralization rules in `Res` only for languages used in `composeResources` --------- Co-authored-by: Konstantin Tskhovrebov <konstantin.tskhovrebov@jetbrains.com>
Hi @terrakok ,, sorry im still confused, how to set the Res class become public? i already use 1.6.2, but my Res class still internal, and i cant find the compose.resource extentions in my gradle, thanks if you reply this |
@Deorigami I don't think it made it to 1.6.2 but it was available in 1.6.10-dev1575 and it works!! |
Hi @terrakok 👋 I can make the Res class public and access my string Res from another project in code, but if I don't keep the copy of the same string resource, then the UI will show only an empty string. |
Many-many thanx!!! |
The feature works only with kotlin 2.0.0 |
Hello @terrakok 👋 with kotlin version 2.0.0-RC1 development is working well but still same issue in production |
I need a reproducer. Could you share it? |
@terrakok this is my project repo https://github.com/mdsadique-inam/PDNS-Manager you can build using |
OK. this is not related with the DSL. It seems a kotlin wasm target's problem. |
https://youtrack.jetbrains.com/issue/KT-66228 |
try to run |
please have a look at: https://youtrack.jetbrains.com/issue/KT-66228/K-Wasm-2.0.0-Beta4-distribution-doesnt-contain-all-files#focus=Comments-27-9719548.0-0 and here: https://kotlinlang.org/docs/wasm-get-started.html#generate-artifacts |
Example: