Skip to content

Commit

Permalink
Use compose convention plugin for freeCompilerArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedre committed Jan 14, 2024
1 parent f4b53ab commit b5de994
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import com.quran.labs.androidquran.buildutil.applyKotlinCommon
import com.quran.labs.androidquran.buildutil.withLibraries
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionAware
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions

class AndroidLibraryComposeConventionPlugin : Plugin<Project> {

Expand All @@ -25,6 +27,15 @@ class AndroidLibraryComposeConventionPlugin : Plugin<Project> {
withLibraries { libs ->
composeOptions.kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}

(this as ExtensionAware).extensions.configure<KotlinJvmOptions>("kotlinOptions") {
freeCompilerArgs += listOf(
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api"
)
}
}

applyKotlinCommon()
Expand Down
11 changes: 1 addition & 10 deletions feature/downloadmanager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ plugins {
id 'com.squareup.anvil'
}

android {
namespace 'com.quran.mobile.feature.downloadmanager'
kotlinOptions {
freeCompilerArgs += [
"-Xopt-in=androidx.compose.ui.ExperimentalComposeUiApi",
"-Xopt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-Xopt-in=androidx.compose.material3.ExperimentalMaterial3Api"
]
}
}
android.namespace 'com.quran.mobile.feature.downloadmanager'

anvil { generateDaggerFactories = true }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.compose.material.Surface
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
Expand All @@ -26,7 +25,6 @@ import com.quran.mobile.feature.downloadmanager.R
import com.quran.mobile.feature.downloadmanager.model.DownloadedSheikhUiModel
import com.quran.mobile.feature.downloadmanager.ui.common.DownloadCommonRow

@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun SheikhDownloadSummary(
downloadedSheikhUiModel: DownloadedSheikhUiModel,
Expand Down
12 changes: 1 addition & 11 deletions feature/qarilist/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@ plugins {
id 'com.squareup.anvil'
}

android {
namespace 'com.quran.mobile.feature.qarilist'

kotlinOptions {
freeCompilerArgs += [
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
"-Xopt-in=androidx.compose.material3.ExperimentalMaterial3Api"
]
}
}
android.namespace 'com.quran.mobile.feature.qarilist'

anvil { generateDaggerFactories = true }

Expand Down

0 comments on commit b5de994

Please sign in to comment.