Skip to content

1.6.10-dev1559

Pre-release
Pre-release
Compare
Choose a tag to compare
@jb-compose-bot jb-compose-bot released this 03 Apr 16:50
5d9dfde
XML resource optimizations (#4559)

Users noticed if an app has big a `string.xml` file it affects the app
startup time:
https://github.com/JetBrains/compose-multiplatform/issues/4537

The problem is slow XML parsing.

Possible ways for optimization:
 1) inject text resources direct to the source code
 2) convert XMLs to an optimized format to read it faster

We selected the second way because texts injected to source code have
several problems:
 - strict limitations on text size
 - increase compilation and analysation time
 - affects a class loader and GC

> Note: android resources do the same and converts xml values to own
`resources.arsc` file

Things was done in the PR:
 1) added support any XML files in the `values` directory
2) **[BREAKING CHANGE]** added `Res.array` accessor for string-array
resources
3) in a final app there won't be original `values*/*.xml` files. There
will be converted `values*/*.cvr` files.
 4) generated code points on string resources as file -> offset+size
5) string resource cache is by item now (it was by the full xml file
before)
 6) implemented random access to read CVR files
7) tasks for syncing ios resources to a final app were seriously
refactored to support generated resources (CVR files)
 8) restriction for 3-party resources plugin were deleted
9) Gradle property `compose.resources.always.generate.accessors` was
deleted. It was for internal needs only.

Fixes https://github.com/JetBrains/compose-multiplatform/issues/4537