Skip to content

Commit

Permalink
Update to Kotlin 1.9/Compose 1.5/Compose Wear 1.2/AGP 8.1.1 (#3814)
Browse files Browse the repository at this point in the history
- Update to Kotlin 1.9
 - Update to Compose 1.5 and Compose Wear 1.2, both depend on and are required for Kotlin 1.9. Compose Wear includes lazy classes moving to a different package so updated imports.
 - Update to AGP 8.1.1 to remove compatibility warning
 - Update Navigation Compose to 2.7.1 as it uses Compose 1.5 internally
 - Update Accompanist to 0.32 as it uses Compose 1.5 internally
 - Switch Room to KSP instead of kapt because this (latest stable) release doesn't work with Kotlin 1.9 otherwise. As a result, we no longer need to specifically enable incremental compilation.
  • Loading branch information
jpelgrom authored Aug 24, 2023
1 parent d115e7a commit fb71b9c
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 57 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ plugins {
alias(libs.plugins.hilt).apply(false)
alias(libs.plugins.kotlin.kapt).apply(false)
alias(libs.plugins.kotlin.parcelize).apply(false)
alias(libs.plugins.ksp).apply(false)
}

allprojects {
Expand Down
14 changes: 4 additions & 10 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.kapt)
alias(libs.plugins.ksp)
alias(libs.plugins.hilt)
}

Expand All @@ -22,15 +23,8 @@ android {
buildConfigField("String", "RATE_LIMIT_URL", "\"$homeAssistantAndroidRateLimitUrl\"")
buildConfigField("String", "VERSION_NAME", "\"$versionName-$versionCode\"")

javaCompileOptions {
annotationProcessorOptions {
arguments(
mapOf(
"room.incremental" to "true",
"room.schemaLocation" to "$projectDir/schemas"
)
)
}
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}
}

Expand Down Expand Up @@ -67,7 +61,7 @@ dependencies {

api(libs.androidx.room.runtime)
api(libs.androidx.room.ktx)
kapt(libs.androidx.room.compiler)
ksp(libs.androidx.room.compiler)

api(libs.androidx.work.runtime.ktx)

Expand Down
16 changes: 9 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]
accompanist = "0.30.1"
accompanist = "0.32.0"
activity-compose = "1.7.2"
androidBeaconLibrary = "2.19.6"
androidJunit5 = "1.9.3.0"
androidPlugin = "8.1.0"
androidPlugin = "8.1.1"
androidSdk-compile = "34"
androidSdk-min = "21"
androidSdk-target = "33"
Expand All @@ -16,8 +16,8 @@ blurView = "version-1.6.6"
car-versions = "1.3.0-rc01"
changeLog = "3.4"
community-material-typeface = "7.0.96.0-kotlin"
compose-bom = "2023.06.01"
compose-compiler = "1.4.8"
compose-bom = "2023.08.00"
compose-compiler = "1.5.2"
constraintlayout = "2.1.4"
converterJackson = "2.9.0"
coreKtx = "1.10.1"
Expand All @@ -34,13 +34,14 @@ iconics = "5.4.0"
jackson-module-kotlin = "2.13.5"
javaVersion = "11"
kotlinx-coroutines = "1.7.3"
kotlin = "1.8.22"
kotlin = "1.9.0"
ksp = "1.9.0-1.0.13"
ktlint = "11.5.1"
lifecycle = "2.6.1"
loggingInterceptor = "4.11.0"
material = "1.9.0"
media3 = "1.1.0"
navigation-compose = "2.6.0"
navigation-compose = "2.7.1"
okhttp = "4.11.0"
picasso = "2.8"
play-services-threadnetwork = "16.0.0"
Expand All @@ -55,7 +56,7 @@ room = "2.5.2"
sentry-android = "6.28.0"
watchfaceComplicationsDataSourceKtx = "1.1.1"
wear = "1.2.0"
wear-compose-foundation = "1.1.2"
wear-compose-foundation = "1.2.0"
wear-tiles = "1.2.0-alpha07"
wearPhoneInteractions = "1.0.1"
wearInput = "1.2.0-alpha02"
Expand All @@ -72,6 +73,7 @@ hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }

[libraries]
Expand Down
6 changes: 0 additions & 6 deletions wear/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ android {
versionName = project.version.toString()
// We add 1 because the app and wear versions need to have different version codes.
versionCode = (System.getenv("VERSION_CODE")?.toIntOrNull() ?: 1) + 1

javaCompileOptions {
annotationProcessorOptions {
arguments(mapOf("room.incremental" to "true"))
}
}
}

buildFeatures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.Button
import androidx.wear.compose.material.ButtonDefaults
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.LocalContentColor
import androidx.wear.compose.material.PositionIndicator
import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.ScalingLazyColumn
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.items
import androidx.wear.compose.material.rememberScalingLazyListState
import androidx.wear.compose.navigation.SwipeDismissableNavHost
import androidx.wear.compose.navigation.composable
import androidx.wear.compose.navigation.rememberSwipeDismissableNavController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.Icon
import androidx.wear.compose.material.InlineSlider
import androidx.wear.compose.material.InlineSliderDefaults
Expand All @@ -28,7 +29,6 @@ import androidx.wear.compose.material.Text
import androidx.wear.compose.material.ToggleButton
import androidx.wear.compose.material.ToggleButtonDefaults
import androidx.wear.compose.material.ToggleChipDefaults
import androidx.wear.compose.material.rememberScalingLazyListState
import com.mikepenz.iconics.compose.Image
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import io.homeassistant.companion.android.common.R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.PositionIndicator
import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.items
import androidx.wear.compose.material.rememberScalingLazyListState
import io.homeassistant.companion.android.common.data.integration.Entity
import io.homeassistant.companion.android.theme.WearAppTheme
import io.homeassistant.companion.android.util.playPreviewEntityScene1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.CircularProgressIndicator
import androidx.wear.compose.material.MaterialTheme
import androidx.wear.compose.material.PositionIndicator
import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.ScalingLazyListState
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.rememberScalingLazyListState
import com.mikepenz.iconics.compose.Image
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import io.homeassistant.companion.android.common.data.integration.Entity
Expand All @@ -58,7 +57,7 @@ fun MainView(
isHapticEnabled: Boolean,
isToastEnabled: Boolean
) {
val scalingLazyListState: ScalingLazyListState = rememberScalingLazyListState()
val scalingLazyListState = rememberScalingLazyListState()

var expandedFavorites: Boolean by rememberSaveable { mutableStateOf(true) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.wear.compose.foundation.lazy.itemsIndexed
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.Icon
Expand All @@ -16,8 +18,6 @@ import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.ToggleChip
import androidx.wear.compose.material.ToggleChipDefaults
import androidx.wear.compose.material.itemsIndexed
import androidx.wear.compose.material.rememberScalingLazyListState
import com.mikepenz.iconics.compose.Image
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import io.homeassistant.companion.android.theme.WearAppTheme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.CircularProgressIndicator
import androidx.wear.compose.material.PositionIndicator
import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.ScalingLazyListState
import androidx.wear.compose.material.rememberScalingLazyListState
import io.homeassistant.companion.android.common.R
import io.homeassistant.companion.android.common.sensors.SensorManager
import io.homeassistant.companion.android.database.sensor.Sensor
Expand All @@ -32,7 +31,7 @@ fun SensorManagerUi(
sensorManager: SensorManager,
onSensorClicked: (String, Boolean) -> Unit
) {
val scalingLazyListState: ScalingLazyListState = rememberScalingLazyListState()
val scalingLazyListState = rememberScalingLazyListState()
WearAppTheme {
Scaffold(
positionIndicator = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.PositionIndicator
import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.ScalingLazyListState
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.rememberScalingLazyListState
import io.homeassistant.companion.android.common.sensors.SensorManager
import io.homeassistant.companion.android.sensors.SensorReceiver
import io.homeassistant.companion.android.theme.WearAppTheme
Expand All @@ -27,7 +26,7 @@ import io.homeassistant.companion.android.common.R as commonR
fun SensorsView(
onClickSensorManager: (SensorManager) -> Unit
) {
val scalingLazyListState: ScalingLazyListState = rememberScalingLazyListState()
val scalingLazyListState = rememberScalingLazyListState()

WearAppTheme {
Scaffold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.Icon
import androidx.wear.compose.material.PositionIndicator
import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.ScalingLazyListState
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.ToggleChip
import androidx.wear.compose.material.ToggleChipDefaults
import androidx.wear.compose.material.items
import androidx.wear.compose.material.rememberScalingLazyListState
import com.mikepenz.iconics.compose.Image
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import io.homeassistant.companion.android.common.data.integration.Entity
Expand All @@ -38,7 +37,7 @@ fun SetFavoritesView(
// Remember expanded state of each header
val expandedStates = rememberExpandedStates(mainViewModel.supportedDomains())

val scalingLazyListState: ScalingLazyListState = rememberScalingLazyListState()
val scalingLazyListState = rememberScalingLazyListState()

WearAppTheme {
Scaffold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.Button
import androidx.wear.compose.material.ButtonDefaults
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.PositionIndicator
import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.rememberScalingLazyListState
import com.mikepenz.iconics.compose.Image
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import io.homeassistant.companion.android.data.SimplifiedEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.Icon
import androidx.wear.compose.material.PositionIndicator
import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.ScalingLazyListState
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.ToggleChip
import androidx.wear.compose.material.ToggleChipDefaults
import androidx.wear.compose.material.rememberScalingLazyListState
import com.mikepenz.iconics.compose.Image
import com.mikepenz.iconics.typeface.IIcon
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
Expand Down Expand Up @@ -77,7 +76,7 @@ fun SettingsView(
onClickTemplateTile: () -> Unit,
onAssistantAppAllowed: (Boolean) -> Unit
) {
val scalingLazyListState: ScalingLazyListState = rememberScalingLazyListState()
val scalingLazyListState = rememberScalingLazyListState()

WearAppTheme {
Scaffold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.PositionIndicator
import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.rememberScalingLazyListState
import com.mikepenz.iconics.compose.Image
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import io.homeassistant.companion.android.common.R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.wear.compose.material.ScalingLazyListState
import androidx.wear.compose.foundation.lazy.ScalingLazyListState
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.TimeText
import androidx.wear.compose.material.rememberScalingLazyListState
import androidx.wear.compose.material.scrollAway

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.Button
import androidx.wear.compose.material.ButtonDefaults
import androidx.wear.compose.material.MaterialTheme
import androidx.wear.compose.material.PositionIndicator
import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.rememberScalingLazyListState
import io.homeassistant.companion.android.R
import io.homeassistant.companion.android.home.views.TimeText
import io.homeassistant.companion.android.views.ThemeLazyColumn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.items
import com.mikepenz.iconics.compose.Image
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import io.homeassistant.companion.android.common.data.integration.Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.input.rotary.onRotaryScrollEvent
import androidx.compose.ui.unit.dp
import androidx.wear.compose.material.ScalingLazyColumn
import androidx.wear.compose.material.ScalingLazyListScope
import androidx.wear.compose.material.ScalingLazyListState
import androidx.wear.compose.material.rememberScalingLazyListState
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.ScalingLazyListScope
import androidx.wear.compose.foundation.lazy.ScalingLazyListState
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import kotlinx.coroutines.launch

@Composable
Expand Down

0 comments on commit fb71b9c

Please sign in to comment.