Skip to content

Commit

Permalink
Address some build warnings and cleanup (#1412)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntsyLich authored Oct 31, 2024
1 parent 06efc3b commit a1c6089
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 90 deletions.
43 changes: 20 additions & 23 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@file:Suppress("ChromeOsAbiSupport")

import mihon.buildlogic.getBuildTime
import mihon.buildlogic.getCommitCount
import mihon.buildlogic.getGitSha
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("mihon.android.application")
Expand Down Expand Up @@ -142,6 +143,24 @@ android {
}
}

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi",
"-opt-in=androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi",
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
"-opt-in=coil3.annotation.ExperimentalCoilApi",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
)
}
}

dependencies {
implementation(projects.i18n)
implementation(projects.core.archive)
Expand Down Expand Up @@ -279,28 +298,6 @@ androidComponents {
}
}

tasks {
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api(-markers)
withType<KotlinCompile> {
compilerOptions.freeCompilerArgs.addAll(
"-Xcontext-receivers",
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi",
"-opt-in=androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi",
"-opt-in=coil3.annotation.ExperimentalCoilApi",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
)
}
}

buildscript {
dependencies {
classpath(kotlinx.gradle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ sealed class Image(
}

sealed interface Location {
@ConsistentCopyVisibility
data class Pictures private constructor(val relativePath: String) : Location {
companion object {
fun create(relativePath: String = ""): Pictures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ internal fun Project.configureAndroid(commonExtension: CommonExtension<*, *, *,
compilerOptions {
jvmTarget.set(AndroidConfig.JvmTarget)
freeCompilerArgs.addAll(
"-opt-in=kotlin.RequiresOptIn",
"-Xcontext-receivers",
"-opt-in=kotlin.RequiresOptIn",
)

// Treat all Kotlin warnings as errors (disabled by default)
Expand Down
7 changes: 4 additions & 3 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ plugins {

android {
namespace = "eu.kanade.tachiyomi.core.common"
}

kotlinOptions {
freeCompilerArgs += listOf(
"-Xcontext-receivers",
kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ fun WebView.setDefaultSettings() {
with(settings) {
javaScriptEnabled = true
domStorageEnabled = true
databaseEnabled = true
useWideViewPort = true
loadWithOverviewMode = true
cacheMode = WebSettings.LOAD_DEFAULT
Expand Down
15 changes: 6 additions & 9 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,16 @@ android {
}
}

kotlin {
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlinx.serialization.ExperimentalSerializationApi")
}
}

dependencies {
implementation(projects.sourceApi)
implementation(projects.domain)
implementation(projects.core.common)

api(libs.bundles.sqldelight)
}

tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions.freeCompilerArgs.addAll(
"-Xcontext-receivers",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
)
}
}
15 changes: 6 additions & 9 deletions domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ android {
}
}

kotlin {
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi")
}
}

dependencies {
implementation(projects.sourceApi)
implementation(projects.core.common)
Expand All @@ -30,12 +36,3 @@ dependencies {
testImplementation(libs.bundles.test)
testImplementation(kotlinx.coroutines.test)
}

tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions.freeCompilerArgs.addAll(
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xcontext-receivers",
)
}
}
13 changes: 6 additions & 7 deletions i18n/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import mihon.buildlogic.generatedBuildDir
import mihon.buildlogic.tasks.getLocalesConfigTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
id("mihon.library")
Expand All @@ -20,6 +20,11 @@ kotlin {
}
}
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}

val generatedAndroidResourceDir = generatedBuildDir.resolve("android/res")
Expand Down Expand Up @@ -49,10 +54,4 @@ tasks {
preBuild {
dependsOn(localesConfigTask)
}

withType<KotlinCompile> {
compilerOptions.freeCompilerArgs.addAll(
"-Xexpect-actual-classes",
)
}
}
2 changes: 1 addition & 1 deletion i18n/src/commonMain/moko-resources/base/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@
<string name="backup_restore_missing_trackers">Trackers not logged into:</string>
<string name="backup_restore_content_full">You may need to install any missing extensions and log in to tracking services afterwards to use them.</string>
<string name="restore_completed">Restore completed</string>
<string name="restore_duration">%02d min, %02d sec</string>
<string name="restore_duration">%1$02d min, %2$02d sec</string>
<string name="backup_in_progress">Backup is already in progress</string>
<string name="backup_choice">What do you want to backup?</string>
<string name="app_settings">App settings</string>
Expand Down
32 changes: 14 additions & 18 deletions presentation-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ android {
}
}

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi",
"-opt-in=androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi",
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
)
}
}

dependencies {
api(projects.core.common)
api(projects.i18n)
Expand All @@ -30,21 +44,3 @@ dependencies {

implementation(kotlinx.immutables)
}

tasks {
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api(-markers)
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions.freeCompilerArgs.addAll(
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi",
"-opt-in=androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi",
"-opt-in=coil3.annotation.ExperimentalCoilApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.material3.ExposedDropdownMenuBox
import androidx.compose.material3.ExposedDropdownMenuDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MenuAnchorType
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.RadioButton
import androidx.compose.material3.Text
Expand Down Expand Up @@ -219,7 +220,7 @@ fun SelectItem(
) {
OutlinedTextField(
modifier = Modifier
.menuAnchor()
.menuAnchor(MenuAnchorType.PrimaryNotEditable)
.fillMaxWidth()
.padding(
horizontal = SettingsItemsPaddings.Horizontal,
Expand Down
15 changes: 7 additions & 8 deletions source-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
id("mihon.library")
kotlin("multiplatform")
Expand Down Expand Up @@ -29,6 +31,11 @@ kotlin {
}
}
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}

android {
Expand All @@ -38,11 +45,3 @@ android {
consumerProguardFile("consumer-proguard.pro")
}
}

tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions.freeCompilerArgs.addAll(
"-Xexpect-actual-classes",
)
}
}
19 changes: 10 additions & 9 deletions source-local/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
id("mihon.library")
kotlin("multiplatform")
Expand Down Expand Up @@ -27,6 +29,14 @@ kotlin {
}
}
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs.addAll(
"-Xexpect-actual-classes",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
)
}
}

android {
Expand All @@ -37,12 +47,3 @@ android {
consumerProguardFiles("consumer-rules.pro")
}
}

tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions.freeCompilerArgs.addAll(
"-Xexpect-actual-classes",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
)
}
}

0 comments on commit a1c6089

Please sign in to comment.