Since AGP `8.8.0-alpha08` there was added support generated assets in
the new `androidLibrary` target.
We have to support a new target configuration and work with compose
multiplatform resources
Fixes https://youtrack.jetbrains.com/issue/CMP-6982
## Testing
- Added gradle tests
## Release Notes
### Features - Gradle Plugin
- Support compose resources in `androidLibrary` target
Should fix
```
Dependency 'androidx.compose.foundation:foundation-android:1.8.0-alpha02' requires libraries and applications that depend on it to compile against version 35 or later of the Android APIs.
```
skiko.js used to be required for k/wasm projects. But some time ago it
was refactored to use skiko.mjs, so skiko.js is not needed anymore (for
k/wasm, still needed for k/js). But there are k/wasm projects still
including skiko.js in index.html which leads to extra loading time. The
intention is to notify them without causing 404 errors for now.
## Testing
- updated a test
- tested manually
<img width="856" alt="Screenshot 2024-09-10 at 15 34 41"
src="https://github.com/user-attachments/assets/9ad9b790-d3fa-4907-b9ee-f5e682f38858">
## Release Notes
### Highlights - Web
- `skiko.js` is redundant in case of K/Wasm Compose for Web applications
and it can be removed from index.html files to not load redundant files.
We are going to remove `skiko.js` from the k/wasm distribution in the
future releases. `skiko.js` is still needed in case of K/JS Compose for
Web apps.
Use a correct file to configure the cocoapods resources integration
instead of a relative path.
Fixes https://youtrack.jetbrains.com/issue/CMP-4303
## Release Notes
### Fixes - Resources
- _(prerelease fix)_ Fix cocoapods resources integration which leaded to
a lack resources in ios apps
1) The PR adds a support test resources in Compose multiplatform
projects.
2) The PR adds a support multi-module resources in JVM-only projects.
Fixes https://youtrack.jetbrains.com/issue/CMP-1470
Fixes https://youtrack.jetbrains.com/issue/CMP-5963
## Release Notes
### Features - Resources
- Added support of test resources in Compose Multiplatform projects
- Added support of multi-module resources in JVM-only projects
After the fix there will be a correct configuration cache usage.
Fixes https://youtrack.jetbrains.com/issue/CMP-5674
## Release Notes
### Fixes - Gradle Plugin
- _(prerelease fix)_ Fix broken configuration cache due Android Studio +
AGP issues. Now Android Studio previews require latest AGP versions
(8.5.2, 8.6.0-rc01, 8.7.0-alpha04):
https://issuetracker.google.com/issues/348208777
Updating the compose.version too, otherwise the tests would fail locally
with the new screenshots.
__
This is a consequence of updating to a newer skia/skiko version in
compose-multiplatform-core.
K/JS and K/Wasm have differences in the packaging logic, and therefore
we need to account for it when unpacking Skiko files.
Fixes [CMP-5649](https://youtrack.jetbrains.com/issue/CMP-5649)
## Testing
- Added a test, which checks the state of k/js distribution
This should be tested by QA
The PR adds a generation special properties with maps a string ID to the
resource for each type of resources:
```kotlin
val Res.allDrawableResources: Map<String, DrawableResource>
val Res.allStringResources: Map<String, StringResource>
val Res.allStringArrayResources: Map<String, StringArrayResource>
val Res.allPluralStringResources: Map<String, PluralStringResource>
val Res.allFontResources: Map<String, FontResource>
```
<!-- Optional -->
Fixes https://github.com/JetBrains/compose-multiplatform/issues/4880
Fixes https://youtrack.jetbrains.com/issue/CMP-1607
## Testing
I checked it in the sample project but this should be tested by QA (KMP
and JVM only projects)
## Release Notes
### Features - Resources
- Now the gradle plugin generates resources map to find a resource by a
string ID
Add file associations support to Compose Desktop
<!-- Optional -->
Fixes#773
## Testing
Tested on the [sample
project](https://github.com/zhelenskiy/file-associations-demo).
Behaviours per OSs:
- MacOS Sonoma: associations work for distributables.
- Windows 11: associations work after the installation of the MSI.
- Kubuntu: associations do not work, but everything else works fine.
However, IDEA also does not have associations there, so I assume this is
fine.
I didn't write any unit tests because I don’t know which of them you are
expecting me to write. So, I'm looking forward to your feedback and
suggestions.
<!-- Optional -->
This should be tested by QA
## Release Notes
<!--
Optional, if omitted - won't be included in the changelog
Sections:
- Highlights
- Known issues
- Breaking changes
- Features
- Fixes
Subsections:
- Multiple Platforms
- iOS
- Desktop
- Web
- Resources
- Gradle Plugin
-->
### Highlight - Desktop
- Introduction of the new DSL function in `nativeDistributions` block:
```kotlin
fun fileAssociation(mimeType: String, extension: String, description:
String): Unit
```
With the new API it is possible to customize compose resources
directories. For example:
```kotlin
abstract class GenerateAndroidRes : DefaultTask() {
@get:Inject
abstract val layout: ProjectLayout
@get:OutputDirectory
val outputDir = layout.buildDirectory.dir("generatedAndroidResources")
@TaskAction
fun run() {...}
}
compose.resources {
customDirectory(
sourceSetName = "androidMain",
directoryProvider = tasks.register<GenerateAndroidRes>("generateAndroidRes").map { it.outputDir.get() }
)
customDirectory(
sourceSetName = "desktopMain",
directoryProvider = provider { layout.projectDirectory.dir("desktopResources") }
)
}
```
<!-- Optional -->
Fixes https://github.com/JetBrains/compose-multiplatform/issues/4718
Fixes https://github.com/JetBrains/compose-multiplatform/issues/4564
## Release Notes
### Features - Resources
- Add a customization for resources directories. Now it is possible to
use e.g downloaded resources.
We had two build services:
1) to check unsupported compose compiler plugins were applied
2) to check a native cache kind configuration
Both of them are outdated and we may get rid of them.
Fixes https://github.com/JetBrains/compose-multiplatform/issues/4815
## Release Notes
### Fixes - Gradle Plugin
- Delete outdated build services
Fixes#4886
## Testing
- Built the gradle plugin to mavenLocal
- used it in the reproducer of #4886, - the issue is gonve
This should be tested by QA
## Release Notes
### Fixes - Gradle Plugin
- Make sure tryGetSkikoRuntimeIfNeeded is executed only during the task
execution
Fixes https://github.com/JetBrains/compose-multiplatform/issues/4548
## Testing
Add compose resources with name such as "package", "is" or "item_$xxx"
and check that app compiles and works fine. Accessors should be properly
escaped
## Release Notes
### Fixes - Resources
- Fix resource accessors escaping. Now it is possible to use resources
with names: "package", "is", "item_$xxx" etc
By mistake the generation resources directory was linked to "podInstall"
task instead "podspec".
Fixes https://github.com/JetBrains/compose-multiplatform/issues/4720
## Testing
- create a new Compose App project with an iOS integration via Cocoapods
- add some multiplatform resources
- clean all caches and build dirs
- call "pod install"
- check that first run of the iOS app works fine
## Release Notes
### Fixes - Resources
- Create an empty resource dir with "podspec" task instead "podInstall"
AGP 7 isn't supported by Jetpack Compose 1.7 (which we'll use in CMP
1.7) and by Lifecycle 2.8.
After this CI is merged, I will:
- revert the revert of [the skiko API
fix](https://github.com/JetBrains/compose-multiplatform-core/pull/1328)
in jb-main
- raise the AGP version on TeamCity
### Details
It was discovered after merging [the skiko API
fix](https://github.com/JetBrains/compose-multiplatform-core/pull/1328).
We had `D8: java.lang.NullPointerException` error on TeamCity. After
investigating dependencies, it appears that previous the dependencies
were incorrect:
```
org.jetbrains.compose.material:material -> androidx.compose.material:material:1.6.7 -> androidx.lifecycle:lifecycle-livedata-core:2.6.1
```
And the new are correct, but aren't supported by AGP 7:
```
org.jetbrains.compose.material:material -> org.jetbrains.compose.ui -> org.jetbrains.androidx.lifecycle:lifecycle-common -> androidx.lifecycle:lifecycle-common:2.8.0 -> androidx.lifecycle:lifecycle-livedata-core:2.8.0
```
The dependency chains was printed by this command on the
`commonResources` test project:
```
./gradlew dependencyInsight --configuration demoDebugRuntimeClasspath --dependency androidx.lifecycle:lifecycle-livedata-core
```
## Testing
1. Create a pure Jetpack Compose project via Android Studio Hedgehog |
2023.1.1 Patch 2
2. Set Jetpack Compose to 1.7.0-beta01
3. Downgrade AGP to 7.4.0
4. Run
5. See the error:
```
ERROR:C:\Users\igord\.gradle\caches\transforms-4\7fcc63c0892ce9266300d6463c3c751d\transformed\lifecycle-livedata-core-2.8.0-runtime.jar: D8: java.lang.NullPointerException: Cannot invoke "String.length()" because "<parameter1>" is null
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform lifecycle-livedata-core-2.8.0.aar (androidx.lifecycle:lifecycle-livedata-core:2.8.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingNoClasspathTransform: C:\Users\igord\.gradle\caches\transforms-3\4aae1223695d47acd0b149bb5811ca5f\transformed\lifecycle-livedata-core-2.8.0-runtime.jar.
> Error while dexing.
```
6. Change AGP to 8.1.0
7. The run is successful.
## Release Notes
### Breaking changes - Android
- Minimal supported AGP raised to 8.1.0
Fixes: https://github.com/JetBrains/compose-multiplatform/issues/4823
In https://github.com/JetBrains/compose-multiplatform/pull/4796 we
intentionally started to configure the web app for all k/js and k/wasm
targets. The configuration involves adding a dependency on skiko-wasm
runtime and unpacking it.
Some projects don't need skiko-wasm-runtime (like those based on
compose.html or just compose.runtime).
**Solution:**
We check if there is a dependency on org.jetbrains.compose.ui libraries
(including transitive dependencies). If we find it, then we enable
skikoUnpack task. Otherwise it's disabled.
## Testing
- Build the gradle plugin locally (with this change)
- Used it in our html landing example:
https://github.com/JetBrains/compose-multiplatform/blob/master/examples/html/landing
- Run `./gradlew jsBrowserDistribution`, check
`.../compose-multiplatform/examples/html/landing/build/dist/js/productionExecutable`
and see NO skiko.* files added there
- Then add `implementation(compose.foundation)` dependency in
build.gradle.jts and run `./gradlew clean jsBrowserDistribution` again -
the build/dist contains skiko.* now
Since 1.6.10 Compose for Web goes to Alpha and experimental
configuration is not needed anymore. We'll configure the web targets by
default when they're added to projects.
## Testing
- I built the plugin to mavenLocal. And used it in a couple of our
samples.
- After gradle sync completes, I observe the Deprecation warning in
build.gradle.kts on `compose.experimental.web` usages (see a screenshot
below)
<img width="1022" alt="Screenshot 2024-05-10 at 15 41 14"
src="https://github.com/JetBrains/compose-multiplatform/assets/7372778/e8ede073-8d34-4dd7-ae74-c83ca0ff5c96">
Then I remove deprecated API usages and test that the project works
without it:
- run `./gradlew clean` just in case
- run the app: `./gradlew wasmJsBrowserRun` and `./gradlew jsBrowserRun`
- both run fine
- build the production distribution: `./gradlew
wasmJsBrowserDistribution`
- `cd ..../build/dist/wasmJs/productionExecutable` and run `python -m
http.server`, open a browser at `http://localhost:8000` - the app should
work the same way it works with gradle tasks above
<!-- Optional -->
This should be tested by QA
## Release Notes
### Highlights - Web
- Compose for Web goes to Alpha!
Some experimental Compose Multiplatform Gradle plugin APIs for web app
configuration were deprecated. Their usage is not required anymore.
The PR sets a static path to the compose resources for the cocoapods
integration because there maybe only one integration framework for a
gradle module.
Fixes https://github.com/JetBrains/compose-multiplatform/issues/4720
## Release Notes
### Fixes - Resources
- _(prerelease fix)_ Fix resources with cocoapods integration
The Compose Multiplatform Resources with the mulimodule.publication
support is a new feature and may have some not found problems. The PR
introduces a gradle property to switch back to the previous behavior:
`org.jetbrains.compose.resources.multimodule.disable=true`
## Testing
After update to Kotlin 2.0.0 and CMP 1.6.10 all projects will be
switched to the new logic with the multimodule support.
Gradle info output should contain a message:
```
Configure KMP resources
```
If the new feature breaks user's projects they may add
`org.jetbrains.compose.resources.multimodule.disable=true` to the
`gradle.properties` to disable it. After that Gradle info output will
contain:
```
Configure compose resources
```
## Release Notes
### Resources
To disable the Compose Resources publication and the multimodule support
in cases of problems add
`org.jetbrains.compose.resources.multimodule.disable=true` to the root
`gradle.properties`.