Fix compose compiler compatibility.

This commit is contained in:
oxy
2024-06-09 21:00:53 +08:00
parent 6efd47a1ad
commit f169567928
17 changed files with 40 additions and 77 deletions

View File

@ -104,10 +104,6 @@ android {
packaging { packaging {
resources.excludes += "META-INF/**" resources.excludes += "META-INF/**"
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
applicationVariants.all { applicationVariants.all {
outputs outputs
.map { it as com.android.build.gradle.internal.api.ApkVariantOutputImpl } .map { it as com.android.build.gradle.internal.api.ApkVariantOutputImpl }

View File

@ -1,3 +1,5 @@
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
@ -14,29 +16,33 @@ plugins {
subprojects { subprojects {
tasks.withType<KotlinCompile>().configureEach { tasks.withType<KotlinCompile>().configureEach {
val composeMetricsPath = kotlinExtension.sourceSets {
project.layout.buildDirectory.dir("compose_metrics").get().asFile.path all {
val composeStabilityConfigurationPath = languageSettings {
"${project.rootDir.path}/compose_compiler_config.conf" optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
compilerOptions { optIn("androidx.compose.foundation.ExperimentalFoundationApi")
freeCompilerArgs.addAll( optIn("androidx.compose.foundation.layout.ExperimentalLayoutApi")
"-Xcontext-receivers", optIn("androidx.compose.material3.ExperimentalMaterial3Api")
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi", optIn("androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi")
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi", optIn("androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi")
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api", optIn("androidx.tv.material3.ExperimentalTvMaterial3Api")
"-opt-in=com.google.accompanist.permissions.ExperimentalPermissionsApi", optIn("com.google.accompanist.permissions.ExperimentalPermissionsApi")
"-opt-in=androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi", }
"-opt-in=androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi", }
"-opt-in=androidx.compose.material3.adaptive.navigation.suite.ExperimentalMaterial3AdaptiveNavigationSuiteApi", }
"-opt-in=androidx.tv.material3.ExperimentalTvMaterial3Api", }
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", plugins.withId("org.jetbrains.kotlin.plugin.compose") {
"-P", configure<ComposeCompilerGradlePluginExtension> {
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$composeMetricsPath", enableStrongSkippingMode = true
"-P", enableNonSkippingGroupOptimization = true
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$composeMetricsPath", enableIntrinsicRemember = true
"-P", includeSourceInformation = true
"plugin:androidx.compose.compiler.plugins.kotlin:stabilityConfigurationPath=$composeStabilityConfigurationPath" val file = rootProject.layout.projectDirectory.file("compose_compiler_config.conf")
) if (file.asFile.exists()) {
stabilityConfigurationFile.set(file)
}
metricsDestination.set(layout.buildDirectory.dir("compose_metrics"))
reportsDestination.set(layout.buildDirectory.dir("compose_metrics"))
} }
} }
} }

View File

@ -1,5 +1,6 @@
kotlin.collections.*
android.net.Uri android.net.Uri
androidx.media3.common.Format androidx.media3.common.Format
org.jupnp.model.meta.Device
androidx.media3.exoplayer.offline.Download androidx.media3.exoplayer.offline.Download
kotlin.collections.* net.mm2d.upnp.Device
kotlinx.datetime.LocalDateTime

View File

@ -34,10 +34,6 @@ android {
buildFeatures { buildFeatures {
compose = true compose = true
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
} }
dependencies { dependencies {

View File

@ -41,10 +41,6 @@ android {
packaging { packaging {
resources.excludes += "META-INF/**" resources.excludes += "META-INF/**"
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
} }
dependencies { dependencies {

View File

@ -37,10 +37,6 @@ android {
packaging { packaging {
resources.excludes += "META-INF/**" resources.excludes += "META-INF/**"
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
} }
dependencies { dependencies {

View File

@ -36,10 +36,6 @@ android {
packaging { packaging {
resources.excludes += "META-INF/**" resources.excludes += "META-INF/**"
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
} }
dependencies { dependencies {

View File

@ -36,10 +36,6 @@ android {
packaging { packaging {
resources.excludes += "META-INF/**" resources.excludes += "META-INF/**"
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
} }
dependencies { dependencies {

View File

@ -36,10 +36,6 @@ android {
packaging { packaging {
resources.excludes += "META-INF/**" resources.excludes += "META-INF/**"
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
} }
dependencies { dependencies {

View File

@ -39,10 +39,6 @@ android {
packaging { packaging {
resources.excludes += "META-INF/**" resources.excludes += "META-INF/**"
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
} }
dependencies { dependencies {

View File

@ -38,10 +38,6 @@ android {
packaging { packaging {
resources.excludes += "META-INF/**" resources.excludes += "META-INF/**"
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
} }
dependencies { dependencies {

View File

@ -5,6 +5,7 @@ import android.app.Activity
import android.content.ComponentName import android.content.ComponentName
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.snapshotFlow import androidx.compose.runtime.snapshotFlow
import androidx.core.content.pm.ShortcutInfoCompat import androidx.core.content.pm.ShortcutInfoCompat
import androidx.core.content.pm.ShortcutManagerCompat import androidx.core.content.pm.ShortcutManagerCompat
@ -334,6 +335,7 @@ class PlaylistViewModel @Inject constructor(
internal val query = MutableStateFlow("") internal val query = MutableStateFlow("")
internal val scrollUp: MutableStateFlow<Event<Unit>> = MutableStateFlow(handledEvent()) internal val scrollUp: MutableStateFlow<Event<Unit>> = MutableStateFlow(handledEvent())
@Immutable
data class ChannelParameters( data class ChannelParameters(
val playlistUrl: String, val playlistUrl: String,
val query: String, val query: String,
@ -341,6 +343,7 @@ class PlaylistViewModel @Inject constructor(
val categories: List<String>, val categories: List<String>,
) )
@Immutable
data class CategoryWithChannels( data class CategoryWithChannels(
val category: String, val category: String,
val channels: Flow<PagingData<Channel>>, val channels: Flow<PagingData<Channel>>,

View File

@ -36,10 +36,6 @@ android {
packaging { packaging {
resources.excludes += "META-INF/**" resources.excludes += "META-INF/**"
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
} }
dependencies { dependencies {

View File

@ -31,10 +31,6 @@ android {
buildFeatures { buildFeatures {
compose = true compose = true
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
} }
dependencies { dependencies {

View File

@ -119,7 +119,7 @@ fun TextField(
), ),
keyboardOptions = KeyboardOptions( keyboardOptions = KeyboardOptions(
keyboardType = keyboardType, keyboardType = keyboardType,
autoCorrect = false, autoCorrectEnabled = false,
imeAction = imeAction ?: if (singleLine) ImeAction.Done else ImeAction.Default imeAction = imeAction ?: if (singleLine) ImeAction.Done else ImeAction.Default
), ),
interactionSource = interactionSource, interactionSource = interactionSource,
@ -223,7 +223,7 @@ fun PlaceholderField(
), ),
keyboardOptions = KeyboardOptions( keyboardOptions = KeyboardOptions(
keyboardType = keyboardType, keyboardType = keyboardType,
autoCorrect = false, autoCorrectEnabled = false,
imeAction = imeAction imeAction = imeAction
), ),
interactionSource = interactionSource, interactionSource = interactionSource,
@ -413,7 +413,7 @@ private fun TvTextFieldImpl(
) )
), ),
keyboardOptions = KeyboardOptions( keyboardOptions = KeyboardOptions(
autoCorrect = false, autoCorrectEnabled = false,
imeAction = ImeAction.Search imeAction = ImeAction.Search
), ),
keyboardActions = keyboardActions, keyboardActions = keyboardActions,

View File

@ -1,3 +1,5 @@
@file: Suppress("DEPRECATION")
package com.m3u.material.transformation package com.m3u.material.transformation
import android.content.Context import android.content.Context
@ -12,7 +14,6 @@ import androidx.core.graphics.createBitmap
import coil.size.Size import coil.size.Size
import coil.transform.Transformation import coil.transform.Transformation
@Suppress("DEPRECATION")
class BlurTransformation @JvmOverloads constructor( class BlurTransformation @JvmOverloads constructor(
private val context: Context, private val context: Context,
private val radius: Float = DEFAULT_RADIUS, private val radius: Float = DEFAULT_RADIUS,

View File

@ -37,10 +37,6 @@ android {
packaging { packaging {
resources.excludes += "META-INF/**" resources.excludes += "META-INF/**"
} }
composeCompiler {
enableStrongSkippingMode = true
includeSourceInformation = true
}
} }
dependencies { dependencies {