-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from GetStream/agp/8.4.1
Migrate to Kotlin 2.0.0 and Compose compiler plugin
- Loading branch information
Showing
15 changed files
with
81 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 8 additions & 35 deletions
43
build-logic/convention/src/main/kotlin/io/getstream/whatsappclone/AndroidCompose.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,27 @@ | ||
package io.getstream.whatsappclone | ||
|
||
import com.android.build.api.dsl.CommonExtension | ||
import java.io.File | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.VersionCatalogsExtension | ||
import org.gradle.kotlin.dsl.getByType | ||
import org.gradle.kotlin.dsl.assign | ||
import org.gradle.kotlin.dsl.configure | ||
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension | ||
|
||
/** | ||
* Configure Compose-specific options | ||
*/ | ||
internal fun Project.configureAndroidCompose( | ||
commonExtension: CommonExtension<*, *, *, *, *>, | ||
commonExtension: CommonExtension<*, *, *, *, *, *>, | ||
) { | ||
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
pluginManager.apply("org.jetbrains.kotlin.plugin.compose") | ||
|
||
commonExtension.apply { | ||
buildFeatures { | ||
compose = true | ||
} | ||
|
||
composeOptions { | ||
kotlinCompilerExtensionVersion = libs.findVersion("androidxComposeCompiler").get().toString() | ||
} | ||
|
||
kotlinOptions { | ||
freeCompilerArgs = freeCompilerArgs + buildComposeMetricsParameters() | ||
} | ||
} | ||
} | ||
|
||
private fun Project.buildComposeMetricsParameters(): List<String> { | ||
val metricParameters = mutableListOf<String>() | ||
val enableMetricsProvider = project.providers.gradleProperty("enableComposeCompilerMetrics") | ||
val enableMetrics = (enableMetricsProvider.orNull == "true") | ||
if (enableMetrics) { | ||
val metricsFolder = File(project.buildDir, "compose-metrics") | ||
metricParameters.add("-P") | ||
metricParameters.add( | ||
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" + metricsFolder.absolutePath | ||
) | ||
} | ||
|
||
val enableReportsProvider = project.providers.gradleProperty("enableComposeCompilerReports") | ||
val enableReports = (enableReportsProvider.orNull == "true") | ||
if (enableReports) { | ||
val reportsFolder = File(project.buildDir, "compose-reports") | ||
metricParameters.add("-P") | ||
metricParameters.add( | ||
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + reportsFolder.absolutePath | ||
) | ||
extensions.configure<ComposeCompilerGradlePluginExtension> { | ||
enableStrongSkippingMode = true | ||
reportsDestination = layout.buildDirectory.dir("compose_compiler") | ||
} | ||
return metricParameters.toList() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.