Skip to content
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

Allow customizing Compose compiler plugin #2347

Merged
merged 1 commit into from
Oct 4, 2022

Conversation

AlexeyTsvetkov
Copy link
Collaborator

By default, the Compose Multiplatform Gradle plugin uses org.jetbrains.compose.compiler:compiler:<COMPOSE_VERSION> as a compiler plugin .
However, a new version of Kotlin might be incompatible with the default version of compiler plugin. Previously, that forced users to update to a new version of Compose Gradle plugin & Compose libraries in order to use a new version of Kotlin. Accordingly, Compose framework developers had to release a new version of all libraries, when a new version of Kotlin is released.

Some time ago the Compose team at Google made it possible to update a compiler plugin without updating the Gradle plugin and/or all Compose libraries https://developer.android.com/jetpack/androidx/releases/compose-kotlin

This change allows to specify a custom compiler artifact by using the following DSL:

compose {
    kotlinCompilerPlugin.set("<VERSION<")
    // or
    kotlinCompilerPlugin.set("<GROUP_ID>:<ARTIFACT_ID>:<VERSION>")
}

By default, the Compose Multiplatform Gradle plugin
uses `org.jetbrains.compose.compiler:compiler:<COMPOSE_VERSION>`
as a compiler plugin .
However, a new version of Kotlin might be incompatible with
the default version of compiler plugin. Previously, that forced
users to update to a new version of Compose Gradle plugin & Compose libraries
in order to use a new version of Kotlin. Accordingly, Compose framework developers
had to release a new version of all libraries, when a new version of Kotlin is released.

Some time ago the Compose team at Google made it possible to update a compiler plugin
without updating the Gradle plugin and/or all Compose libraries
https://developer.android.com/jetpack/androidx/releases/compose-kotlin

This change allows to specify a custom compiler artifact by using the following DSL:
```
compose {
    kotlinCompilerPlugin.set("<VERSION<")
    // or
    kotlinCompilerPlugin.set("<GROUP_ID>:<ARTIFACT_ID>:<VERSION>")
}
```
@igordmn
Copy link
Collaborator

igordmn commented Sep 29, 2022

kotlinCompilerPlugin.set("<VERSION<")

Can we use a property? It is more idiomatic for Gradle Kotlin DSL:

kotlinCompilerPlugin = "1.3.1"

@AlexeyTsvetkov
Copy link
Collaborator Author

@igordmn I'm not sure. Gradle seems to be moving in direction of switching to Provider API everywhere in Gradle 9. Also they are going to add an assignment operator overload to Property type, so soon users will be able to write kotlinCompilerPlugin = "1.3.1", while retaining laziness of Provider API

@igordmn
Copy link
Collaborator

igordmn commented Sep 29, 2022

kotlinCompilerPlugin.set("<GROUP_ID>:<ARTIFACT_ID>:")

We should also prepare a page with tutorial how to to that in with mapping table. Also, worth to add our own exception in Gradle plugin with a link to that page.

@igordmn
Copy link
Collaborator

igordmn commented Sep 29, 2022

@igordmn I'm not sure.

Ok, let's keep the current way

@AlexeyTsvetkov AlexeyTsvetkov merged commit 58b0a22 into master Oct 4, 2022
@AlexeyTsvetkov AlexeyTsvetkov deleted the custom-compiler-artifact-gradle branch October 4, 2022 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants