blob: 35b2f2a6d3d24d8abf376467a34d19a94a0024a3 [file] [log] [blame] [view]
AndroidX Core Team80b22952025-04-25 09:38:50 -07001# KGP Integration
2
3go/androidx-kgp-integration
4
5<!--*
6# Document freshness: For more information, see go/fresh-source.
7freshness: { owner: 'aurimas', owner: 'juliamcclellan', owner: 'fsladkey' reviewed: '2025-04-24' }
8*-->
9
10[TOC]
11
12To catch Kotlin upgrade issues before upgrade time, AndroidX team has set up an
13integration test with the latest version of Kotlin gradle plugin available on
14the
15[JetBrains dev repository](https://packages.jetbrains.team/maven/p/kt/dev/org/jetbrains/kotlin/kotlin-gradle-plugin/maven-metadata.xml).
16
17The integration tests run on GitHub and can be found
18[here](https://github.com/androidx/androidx/actions/workflows/kgp-nightly-integration.yml).
19Currently they build the `collection` project.
20
21Because some code cannot be made compatible with both the current version and
22the latest version, a
23[patch file](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:.github/integration-patches/kgp-nightly.patch)
24is applied before the test runs.
25
26## Fixing failing integration tests
27
28The test can fail for a few reasons.
29
30#### Changes in KGP which can be made compatible in androidx-main
31
32Simply make the change (e.g. suppression) in aosp and merge the change.
33
34#### Changes in KGP which cannot be made in androidx-main, and/or failure to apply changes
35
36* Upgrade to the latest Kotlin version used by the integration test with
37 `./development/update_kotlin.sh <KOTLIN_VERSION>`
38* If there is an existing patch file, apply it with `git apply
39 .github/integration-patches/kgp-nightly.patch`
40 * If the patch file cannot be applied due to merge conflicts, see the
41 instructions
42 [here](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:.github/integration-patches/).
43* Make any necessary changes
44* Ensure `collection` builds locally
45* Run the following (or something similar) to update the patch file
46
47```
48# copy new patch file to a temporary file or directly to clipboard
49git diff HEAD~2 -- :^.github :^development :^gradle/libs.versions.toml > tmp.patch
50# start a new branch and replace the contents of the patch file
51repo start update-patch-file
52cat tmp.patch > .github/integration-patches/kgp-nightly.patch
53```
54
55* Commit the changes to the new branch
56* Validate that patch applies by running `git apply --stat
57 .github/integration-patches/kgp-nightly.patch`
58* Upload and merge the change
59* Trigger the
60 [integration branch](https://github.com/androidx/androidx/actions/workflows/kgp-nightly-integration.yml)
61 to validate the changes
62
63#### Bugs in KGP
64
65If a change appears to be an unintentional breakage by KGP, the failure should
66be reported to Jetbrains. If possible, try to work around the failure with one
67of the above methods so that the integration test can continue catching
68additional regressions.