mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Use feature flags in compose compiler plugin
Some checks failed
CI / Build app (push) Has been cancelled
Some checks failed
CI / Build app (push) Has been cancelled
And slight cleanup
This commit is contained in:
parent
f74071ab0a
commit
8f9a325895
1 changed files with 7 additions and 11 deletions
|
@ -14,6 +14,7 @@ import org.gradle.kotlin.dsl.provideDelegate
|
||||||
import org.gradle.kotlin.dsl.the
|
import org.gradle.kotlin.dsl.the
|
||||||
import org.gradle.kotlin.dsl.withType
|
import org.gradle.kotlin.dsl.withType
|
||||||
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
|
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
|
||||||
|
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeFeatureFlag
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
@ -75,25 +76,20 @@ internal fun Project.configureCompose(commonExtension: CommonExtension<*, *, *,
|
||||||
}
|
}
|
||||||
|
|
||||||
extensions.configure<ComposeCompilerGradlePluginExtension> {
|
extensions.configure<ComposeCompilerGradlePluginExtension> {
|
||||||
// Enable strong skipping mode
|
featureFlags.set(setOf(ComposeFeatureFlag.OptimizeNonSkippingGroups))
|
||||||
enableStrongSkippingMode.set(true)
|
|
||||||
|
|
||||||
// Enable experimental compiler opts
|
|
||||||
// https://developer.android.com/jetpack/androidx/releases/compose-compiler#1.5.9
|
|
||||||
enableNonSkippingGroupOptimization.set(true)
|
|
||||||
|
|
||||||
val enableMetrics = project.providers.gradleProperty("enableComposeCompilerMetrics").orNull.toBoolean()
|
val enableMetrics = project.providers.gradleProperty("enableComposeCompilerMetrics").orNull.toBoolean()
|
||||||
val enableReports = project.providers.gradleProperty("enableComposeCompilerReports").orNull.toBoolean()
|
val enableReports = project.providers.gradleProperty("enableComposeCompilerReports").orNull.toBoolean()
|
||||||
|
|
||||||
val rootProjectDir = rootProject.layout.buildDirectory.asFile.get()
|
val rootBuildDir = rootProject.layout.buildDirectory.asFile.get()
|
||||||
val relativePath = projectDir.relativeTo(rootDir)
|
val relativePath = projectDir.relativeTo(rootDir)
|
||||||
|
|
||||||
if (enableMetrics) {
|
if (enableMetrics) {
|
||||||
val buildDirPath = rootProjectDir.resolve("compose-metrics").resolve(relativePath)
|
rootBuildDir.resolve("compose-metrics").resolve(relativePath).let(metricsDestination::set)
|
||||||
metricsDestination.set(buildDirPath)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableReports) {
|
if (enableReports) {
|
||||||
val buildDirPath = rootProjectDir.resolve("compose-reports").resolve(relativePath)
|
rootBuildDir.resolve("compose-reports").resolve(relativePath).let(reportsDestination::set)
|
||||||
reportsDestination.set(buildDirPath)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue