Skip to content

Support Kotlin's inline functions with build script compilation avoidance #17309

@rieske

Description

@rieske

The current implementation of Kotlin build script compilation avoidance has a limitation where it does not work with inline functions. When an inline function is detected, the ABI extractor used in compilation avoidance gives up and the jar where this occurred will no longer participate in compilation avoidance - any change in it will cause the build scripts to be recompiled.

The reason for this limitation is our inability to determine whether some compiled inner class is part of an inline function and whether it should be part of the ABI (and thus a change to it should require recompilation).
This test demonstrates the current case that we are not able to detect when naively treating the body of an inline class as ABI. The lambda declared within an inline function is compiled as a separate class and when visiting that class for ABI computation, we can not tell whether it originates in a public inline function.

Kotlin 1.5.30 may add a flag in kotlin.Metadata that would allow us to identify whether a class is part of an inline function (and thus a part of the ABI).
With this, we should be able to fully treat the inline functions as ABI and allow build logic that uses inline functions to participate in build script compilation avoidance.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions