-
Notifications
You must be signed in to change notification settings - Fork 121
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
Feature/add jvm target #159
Feature/add jvm target #159
Conversation
Will check-out the detekt issues & pipeline messages a bit later |
|
||
actual class ResourceFormattedStringDesc actual constructor( | ||
private val stringRes: StringResource, | ||
private val args: List<Any> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now all the android formatted strings we'll be replaced with {n}
when we generate the StringResource
, this means that we lose the type of the argument.
One possible solution would be to leave them as they are, and replace them prior to formatting (and get the necessary type information, before localizing them). See MokoBundle
...s/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/jvm/JvmImagesGenerator.kt
Outdated
Show resolved
Hide resolved
@@ -33,7 +32,10 @@ object Testing { | |||
MR.plurals.test_plural.desc(1), | |||
MR.plurals.test_plural.desc(2), | |||
MR.plurals.test_plural.desc(3), | |||
nestedTest() | |||
MR.plurals.test_plural.desc(7), | |||
// TODO nested won't work with the current implementation, since the library tries to resolve from a bundle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how could we solve this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugin should collect all nested resources too. just like in apple generator implemented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I know what you mean, currently resolving the nested will cause a
Can't find resource for bundle java.util.PropertyResourceBundle, key nested.test
I think on android this works by default, because how android aggregates or searches through the sources, but I may be wrong.
I didn't research much on this, but maybe there is a similar solution for this on the jvm side too.
Did you meant copying over the generated resources from the nested modules, I'd consider that a bit overkill, but I'm not sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in uber-jar all resources aggregates into single jar, so if we have same name of some resources (like MokoBundle for localizations) we got only one version of this files. to fix it i will move generation of files into package-dependend path
sample/desktop-app/src/jvmMain/kotlin/com/icerockdev/desktop/Main.kt
Outdated
Show resolved
Hide resolved
also please fix detekt problems, CI failed because of them |
...s/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/jvm/JvmColorsGenerator.kt
Show resolved
Hide resolved
...ns/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/jvm/JvmFilesGenerator.kt
Show resolved
Hide resolved
...ns/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/jvm/JvmFilesGenerator.kt
Outdated
Show resolved
Hide resolved
...s/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/jvm/JvmImagesGenerator.kt
Outdated
Show resolved
Hide resolved
...ns/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/jvm/JvmFontsGenerator.kt
Show resolved
Hide resolved
resources/src/jvmMain/kotlin/dev/icerock/moko/resources/desc/ResourceStringDesc.kt
Outdated
Show resolved
Hide resolved
resources/src/jvmMain/kotlin/dev/icerock/moko/resources/desc/StringDesc.kt
Show resolved
Hide resolved
sample/desktop-app/src/jvmMain/kotlin/com/icerockdev/desktop/Main.kt
Outdated
Show resolved
Hide resolved
@@ -33,7 +32,10 @@ object Testing { | |||
MR.plurals.test_plural.desc(1), | |||
MR.plurals.test_plural.desc(2), | |||
MR.plurals.test_plural.desc(3), | |||
nestedTest() | |||
MR.plurals.test_plural.desc(7), | |||
// TODO nested won't work with the current implementation, since the library tries to resolve from a bundle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugin should collect all nested resources too. just like in apple generator implemented
also i got error when try to compile sample jvm:
|
plugins/resources-generator/src/main/kotlin/dev/icerock/gradle/generator/jvm/JvmMRGenerator.kt
Outdated
Show resolved
Hide resolved
aa2330c
to
8209e85
Compare
# Conflicts: # buildSrc/src/main/kotlin/Deps.kt
i add some changes in own branch https://github.com/icerockdev/moko-resources/tree/%23151-jvm-target-support |
here current changes between branches 3e8012a...#151-jvm-target-support |
@Alex009 probably we should migrate to |
@Alex009 in 97489b6 I've migrated to
The current jvm implementation requires that args should be passed in correct order, since we replace every argument with {0}, {1}, ... {n} only.
I think 2) would be a far better option |
Any ETA to publish a release with this PR? |
There are a couple of open-questions, created a draft PR to hopefully answer them