Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Kotlin 2.0.0 #1827

Merged
merged 16 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/baseline-profile.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Baseline profile generation

on:
# every day at 00:43
# Every Sunday at 00:43
schedule:
- cron: '43 0 * * *'
- cron: '43 0 * * 0'
workflow_dispatch:
pull_request:
paths:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ jobs:
:android-app:app:bundle \
-x assembleNonMinifiedRelease \
-x bundleNonMinifiedRelease \
-Pandroidx.baselineprofile.skipgeneration=true
-Pandroidx.baselineprofile.skipgeneration=true \
--no-configuration-cache

- name: Clean secrets
if: always()
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ playground.xcworkspace
# .swiftpm

.build/
.kotlin/

# fastlane
#
Expand Down
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19,563 changes: 10,881 additions & 8,682 deletions android-app/app/src/main/generated/baselineProfiles/baseline-prof.txt

Large diffs are not rendered by default.

19,563 changes: 10,881 additions & 8,682 deletions android-app/app/src/main/generated/baselineProfiles/startup-prof.txt

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions android-app/app/src/main/kotlin/app/tivi/home/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ class MainActivity : TiviActivity() {
val backstack = rememberSaveableBackStack(listOf(DiscoverScreen))
val navigator = rememberCircuitNavigator(backstack)

component.tiviContent(
backstack,
navigator,
{ url ->
component.tiviContent.Content(
backstack = backstack,
navigator = navigator,
onOpenUrl = { url ->
val intent = CustomTabsIntent.Builder().build()
intent.launchUrl(this@MainActivity, Uri.parse(url))
},
Modifier.semantics {
modifier = Modifier.semantics {
// Enables testTag -> UiAutomator resource id
@OptIn(ExperimentalComposeUiApi::class)
testTagsAsResourceId = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ object AppScenarios {
// -------------
device.testSeasons() || return
device.navigateFromSeasonsToEpisodeDetails()

// -------------
// Episode details
// -------------
device.testEpisodeDetails() || return
}
}

Expand Down Expand Up @@ -105,25 +100,6 @@ private fun UiDevice.navigateFromSeasonsToEpisodeDetails() {
waitForIdle()
}

private fun UiDevice.testEpisodeDetails(): Boolean {
waitForObject(By.res("episode_details"))

// Swipe the bottom sheet 'up', then 'down'
runAction(By.res("episode_details")) {
setGestureMargins(this)
scroll(Direction.DOWN, 0.8f)
}
waitForIdle()

runAction(By.res("episode_details")) {
setGestureMargins(this)
scroll(Direction.UP, 0.8f)
}
waitForIdle()

return true
}

fun UiDevice.waitForObject(selector: BySelector, timeout: Duration = 5.seconds): UiObject2 {
if (wait(Until.hasObject(selector), timeout)) {
return findObject(selector)
Expand Down
36 changes: 2 additions & 34 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// SPDX-License-Identifier: Apache-2.0


import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
id("app.tivi.root")

Expand All @@ -18,37 +16,7 @@ plugins {
alias(libs.plugins.gms.googleServices) apply false
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.spotless) apply false
alias(libs.plugins.composeMultiplatform) apply false
alias(libs.plugins.compose.multiplatform) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.licensee) apply false
}

buildscript {
dependencies {
// Yuck. Need to force kotlinpoet:1.16.0 as that is what buildconfig uses.
// CMP 1.6.0-x uses kotlinpoet:1.14.x. Gradle seems to force 1.14.x which then breaks
// buildconfig.
classpath("com.squareup:kotlinpoet:1.16.0")
}
}

allprojects {
tasks.withType<KotlinCompilationTask<*>>().configureEach {
compilerOptions {
// Treat all Kotlin warnings as errors
allWarningsAsErrors = true

if (project.providers.gradleProperty("tivi.enableComposeCompilerReports").isPresent) {
freeCompilerArgs.addAll(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
layout.buildDirectory.asFile.get().absolutePath + "/compose_metrics",
)
freeCompilerArgs.addAll(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
layout.buildDirectory.asFile.get().absolutePath + "/compose_metrics",
)
}
}
}
}
18 changes: 18 additions & 0 deletions common/ui/screens/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0


import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType

plugins {
id("app.tivi.android.library")
id("app.tivi.kotlin.multiplatform")
Expand All @@ -16,6 +18,22 @@ kotlin {
}
}
}

targets.configureEach {
val isAndroidTarget = platformType == KotlinPlatformType.androidJvm
compilations.configureEach {
compileTaskProvider.configure {
compilerOptions {
if (isAndroidTarget) {
freeCompilerArgs.addAll(
"-P",
"plugin:org.jetbrains.kotlin.parcelize:additionalAnnotation=app.tivi.screens.Parcelize",
)
}
}
}
}
}
}

android {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2023, Christopher Banes and the Tivi project contributors
// SPDX-License-Identifier: Apache-2.0

package app.tivi.screens

@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.BINARY)
annotation class Parcelize()

This file was deleted.

34 changes: 17 additions & 17 deletions common/ui/screens/src/commonMain/kotlin/app/tivi/screens/Screens.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,57 @@ package app.tivi.screens

import com.slack.circuit.runtime.screen.Screen

@CommonParcelize
@Parcelize
object AccountScreen : TiviScreen(name = "AccountUi()")

@CommonParcelize
@Parcelize
object DiscoverScreen : TiviScreen(name = "Discover()")

@CommonParcelize
@Parcelize
data class EpisodeDetailsScreen(val id: Long) : TiviScreen(name = "EpisodeDetails()") {
override val arguments get() = mapOf("id" to id)
}

@CommonParcelize
@Parcelize
data class EpisodeTrackScreen(val id: Long) : TiviScreen(name = "EpisodeTrack()") {
override val arguments get() = mapOf("id" to id)
}

@CommonParcelize
@Parcelize
object LibraryScreen : TiviScreen(name = "Library()")

@CommonParcelize
@Parcelize
object PopularShowsScreen : TiviScreen(name = "PopularShows()")

@CommonParcelize
@Parcelize
object RecommendedShowsScreen : TiviScreen(name = "RecommendedShows()")

@CommonParcelize
@Parcelize
object SearchScreen : TiviScreen(name = "Search()")

@CommonParcelize
@Parcelize
object SettingsScreen : TiviScreen(name = "Settings()")

@CommonParcelize
@Parcelize
object LicensesScreen : TiviScreen(name = "LicensesScreen()")

@CommonParcelize
@Parcelize
object DevSettingsScreen : TiviScreen(name = "DevelopmentSettings()")

@CommonParcelize
@Parcelize
object DevLogScreen : TiviScreen(name = "DevelopmentLog()")

@CommonParcelize
@Parcelize
data class UrlScreen(val url: String) : TiviScreen(name = "UrlScreen()") {
override val arguments get() = mapOf("url" to url)
}

@CommonParcelize
@Parcelize
data class ShowDetailsScreen(val id: Long) : TiviScreen(name = "ShowDetails()") {
override val arguments get() = mapOf("id" to id)
}

@CommonParcelize
@Parcelize
data class ShowSeasonsScreen(
val id: Long,
val selectedSeasonId: Long? = null,
Expand All @@ -67,10 +67,10 @@ data class ShowSeasonsScreen(
)
}

@CommonParcelize
@Parcelize
object TrendingShowsScreen : TiviScreen(name = "TrendingShows()")

@CommonParcelize
@Parcelize
object UpNextScreen : TiviScreen(name = "UpNext()")

abstract class TiviScreen(val name: String) : Screen {
Expand Down
10 changes: 0 additions & 10 deletions common/ui/screens/src/iosMain/kotlin/app/tivi/screens/Platform.kt

This file was deleted.

10 changes: 0 additions & 10 deletions common/ui/screens/src/jvmMain/kotlin/app/tivi/screens/Platform.kt

This file was deleted.

1 change: 1 addition & 0 deletions core/logging/api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ kotlin {
val commonMain by getting {
dependencies {
api(libs.kotlin.coroutines.core)
api(libs.kotlinx.datetime)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

package app.tivi.util

import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.Flow
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant

interface RecordingLogger : Logger {
val buffer: StateFlow<List<LogMessage>>
val buffer: Flow<List<LogMessage>>
}

enum class Severity {
Expand All @@ -22,4 +24,5 @@ data class LogMessage(
val severity: Severity,
val message: String,
val throwable: Throwable?,
val timestamp: Instant = Clock.System.now(),
)
Loading
Loading