Skip to content
Open
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
2 changes: 0 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

import com.google.devtools.ksp.gradle.KspExtension
import com.ninecraft.booket.convention.getLocalProperty
import org.gradle.kotlin.dsl.configure
Expand Down
3 changes: 0 additions & 3 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
@Suppress("DSL_SCOPE_VIOLATION", "INLINE_FROM_HIGHER_PLATFORM")

plugins {
`kotlin-dsl`
alias(libs.plugins.gradle.dependency.handler.extensions)
}

dependencies {
compileOnly(libs.android.gradle.plugin)
compileOnly(libs.kotlin.gradle.plugin)
compileOnly(libs.compose.compiler.gradle.plugin)
compileOnly(libs.ksp.gradle.plugin)
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import com.android.build.api.dsl.ApplicationExtension
import com.ninecraft.booket.convention.ApplicationConstants
import com.ninecraft.booket.convention.Plugins
import com.ninecraft.booket.convention.applyPlugins
import com.ninecraft.booket.convention.configureAndroid
Expand All @@ -11,10 +10,7 @@ import org.gradle.kotlin.dsl.configure
internal class AndroidApplicationConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
applyPlugins(
Plugins.ANDROID_APPLICATION,
Plugins.KOTLIN_ANDROID,
)
applyPlugins(Plugins.ANDROID_APPLICATION)

extensions.configure<ApplicationExtension> {
configureAndroid(this)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import com.android.build.gradle.LibraryExtension
import com.android.build.api.dsl.LibraryExtension
import com.ninecraft.booket.convention.Plugins
import com.ninecraft.booket.convention.applyPlugins
import com.ninecraft.booket.convention.configureCompose
Expand Down
12 changes: 2 additions & 10 deletions build-logic/src/main/kotlin/AndroidLibraryConventionPlugin.kt
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
import com.android.build.gradle.LibraryExtension
import com.android.build.api.dsl.LibraryExtension
import com.ninecraft.booket.convention.Plugins
import com.ninecraft.booket.convention.applyPlugins
import com.ninecraft.booket.convention.configureAndroid
import com.ninecraft.booket.convention.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure

internal class AndroidLibraryConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
applyPlugins(
Plugins.ANDROID_LIBRARY,
Plugins.KOTLIN_ANDROID,
)
applyPlugins(Plugins.ANDROID_LIBRARY)

extensions.configure<LibraryExtension> {
configureAndroid(this)

defaultConfig.apply {
targetSdk = libs.versions.targetSdk.get().toInt()
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import com.android.build.gradle.LibraryExtension
import com.ninecraft.booket.convention.ApplicationConstants
import com.ninecraft.booket.convention.Plugins
import com.ninecraft.booket.convention.applyPlugins
import com.ninecraft.booket.convention.configureAndroid
import com.ninecraft.booket.convention.implementation
import com.ninecraft.booket.convention.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies

internal class AndroidRetrofitConventionPlugin : Plugin<Project> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@ package com.ninecraft.booket.convention

import com.android.build.api.dsl.CommonExtension
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.withType
import org.gradle.kotlin.dsl.dependencies
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

internal fun Project.configureAndroid(extension: CommonExtension<*, *, *, *, *, *>) {
internal fun Project.configureAndroid(extension: CommonExtension) {
extension.apply {
compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
defaultConfig.apply {
minSdk = libs.versions.minSdk.get().toInt()
}

compileOptions {
compileOptions.apply {
sourceCompatibility = ApplicationConstants.javaVersion
targetCompatibility = ApplicationConstants.javaVersion
}

extensions.configure<KotlinProjectExtension> {
jvmToolchain(ApplicationConstants.JAVA_VERSION_INT)
tasks.withType<KotlinCompile>().configureEach {
compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,34 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

internal fun Project.configureCompose(
extension: CommonExtension<*, *, *, *, *, *>,
) {
internal fun Project.configureCompose(extension: CommonExtension) {
extension.apply {
dependencies {
implementation(platform(libs.androidx.compose.bom))
implementation(libs.bundles.androidx.compose)
debugImplementation(libs.androidx.compose.ui.tooling)
}
}

configure<ComposeCompilerGradlePluginExtension> {
includeSourceInformation.set(true)
extensions.configure<ComposeCompilerGradlePluginExtension> {
includeSourceInformation.set(true)

metricsDestination.file("build/composeMetrics")
reportsDestination.file("build/composeReports")
metricsDestination.file("build/composeMetrics")
reportsDestination.file("build/composeReports")

stabilityConfigurationFiles.addAll(
project.rootProject.layout.projectDirectory.file("stability.config.conf"),
)
}
stabilityConfigurationFiles.addAll(
project.rootProject.layout.projectDirectory.file("stability.config.conf"),
)
}
Comment on lines +20 to +29
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

ComposeCompilerGradlePluginExtension metricsDestination reportsDestination official behavior Gradle plugin

💡 Result:

In the Compose compiler Gradle plugin DSL (composeCompiler { ... }), both metricsDestination and reportsDestination are DirectoryProperty outputs that are only produced when you set them (i.e., they opt-in to dumping files). [1]

  • metricsDestination: when specified, the Compose compiler dumps “build metrics” for the current module (including a module.json with stats like processed composables/classes, stable classes/parameters, skippable functions, etc.). For Kotlin Multiplatform, metrics are written under a target/compilation subdirectory layout derived from KotlinTarget.disambiguationClassifier and KotlinCompilation.compilationName (example: <dest>/jvm/main, <dest>/jvm/custom). [2]

  • reportsDestination: when specified, the Compose compiler dumps “build reports” about the compilation, such as which composable functions are skippable, restartable, readonly, etc., useful for manual runtime-performance analysis. [3]

Sources:
[1] ComposeCompilerGradlePluginExtension API page (Kotlin Gradle Plugins API reference) (kotlinlang.org)
[2] metricsDestination API doc (kotlinlang.org)
[3] reportsDestination API doc (kotlinlang.org)

Citations:


🏁 Script executed:

# First, let's read the full Compose.kt file to understand the context
fd "Compose.kt" --type f | head -5

Repository: YAPP-Github/Reed-Android

Length of output: 138


🏁 Script executed:

# Search for any gradle property usage related to compose metrics
rg "enableComposeCompilerMetrics|enableComposeCompilerReports|metricsDestination|reportsDestination" --type kotlin -A 2 -B 2

Repository: YAPP-Github/Reed-Android

Length of output: 3039


🏁 Script executed:

# Check for gradle.properties or similar configuration files
fd "gradle.properties|local.properties" --type f

Repository: YAPP-Github/Reed-Android

Length of output: 85


🏁 Script executed:

cat -n build-logic/src/main/kotlin/com/ninecraft/booket/convention/Compose.kt

Repository: YAPP-Github/Reed-Android

Length of output: 2909


ComposeCompilerGradlePluginExtension의 DSL 설정과 compiler args의 불일치 수정 필요

현재 코드에서 metricsDestinationreportsDestination은 라인 23-24에서 항상 설정되지만, 실제 gradle 속성(enableComposeComposeCompilerMetrics, enableComposeCompilerReports)은 buildComposeMetricsParameters() 내 compiler args에만 적용됩니다. DSL에서 destination을 설정하면 공식 문서에 따라 파일 생성이 활성화되므로, 현재 구조는 gradle 속성의 toggle 의도와 맞지 않습니다. 또한 DSL 경로(build/composeMetrics)와 compiler args 경로(compose-metrics/relative/path)가 다르므로 중복 생성 가능성도 있습니다.

DSL 설정을 gradle 속성에 따라 조건부로 적용하거나, 경로를 통일하는 것이 필요합니다.

조건부 설정 예시
 extensions.configure<ComposeCompilerGradlePluginExtension> {
     includeSourceInformation.set(true)
 
-    metricsDestination.file("build/composeMetrics")
-    reportsDestination.file("build/composeReports")
+    val enableMetrics = project.providers
+        .gradleProperty("enableComposeCompilerMetrics")
+        .orNull == "true"
+    if (enableMetrics) {
+        metricsDestination.file("build/composeMetrics")
+    }
+
+    val enableReports = project.providers
+        .gradleProperty("enableComposeCompilerReports")
+        .orNull == "true"
+    if (enableReports) {
+        reportsDestination.file("build/composeReports")
+    }
 
     stabilityConfigurationFiles.addAll(
         project.rootProject.layout.projectDirectory.file("stability.config.conf"),
     )
 }
🤖 Prompt for AI Agents
In `@build-logic/src/main/kotlin/com/ninecraft/booket/convention/Compose.kt`
around lines 20 - 29, The ComposeCompilerGradlePluginExtension DSL is always
setting metricsDestination and reportsDestination (metricsDestination,
reportsDestination, includeSourceInformation) which conflicts with the
compiler-arg toggles implemented in buildComposeMetricsParameters()
(enableComposeComposeCompilerMetrics, enableComposeCompilerReports) and leads to
duplicated/uneven paths; make the DSL destinations conditional or unify the
paths: check the boolean gradle properties (enableComposeComposeCompilerMetrics
and enableComposeCompilerReports) before calling
extensions.configure<ComposeCompilerGradlePluginExtension> to set
metricsDestination.file("build/composeMetrics") and
reportsDestination.file("build/composeReports"), or alternatively use the same
path values produced by buildComposeMetricsParameters() so they are consistent
(ensure symbols referenced: ComposeCompilerGradlePluginExtension,
includeSourceInformation, metricsDestination, reportsDestination,
buildComposeMetricsParameters, enableComposeComposeCompilerMetrics,
enableComposeCompilerReports).


tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
freeCompilerArgs.addAll(
buildComposeMetricsParameters(),
)
}
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
freeCompilerArgs.addAll(
buildComposeMetricsParameters(),
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ object Plugins {
const val JAVA_LIBRARY = "java-library"

const val KOTLIN_JVM = "org.jetbrains.kotlin.jvm"
const val KOTLIN_ANDROID = "org.jetbrains.kotlin.android"
const val KOTLINX_SERIALIZATION = "org.jetbrains.kotlin.plugin.serialization"
const val KOTLIN_COMPOSE = "org.jetbrains.kotlin.plugin.compose"

Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ plugins {
alias(libs.plugins.kotlin.ktlint)
alias(libs.plugins.compose.stability.analyzer) apply false
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.android.application) apply false
Expand Down
2 changes: 0 additions & 2 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.library)
alias(libs.plugins.booket.android.library.compose)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.ninecraft.booket.core.common.extensions
import android.content.ContentValues
import android.content.Context
import android.content.Intent
import androidx.core.net.toUri
import android.net.Uri
import com.ninecraft.booket.core.common.BuildConfig
import android.graphics.Bitmap
import android.os.Build
Expand Down Expand Up @@ -62,6 +62,6 @@ fun Context.saveImageToGallery(bitmap: ImageBitmap) {

fun Context.openPlayStore() {
val intent =
Intent(Intent.ACTION_VIEW, "market://details?id=${BuildConfig.PACKAGE_NAME}".toUri())
Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=${BuildConfig.PACKAGE_NAME}"))
startActivity(intent)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sealed class UiText {
data class DirectString(val value: String) : UiText()

class StringResource(
@StringRes val resId: Int,
@param: StringRes val resId: Int,
vararg val args: Any,
) : UiText()

Expand Down
2 changes: 0 additions & 2 deletions core/data/api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.library)
}
Expand Down
2 changes: 0 additions & 2 deletions core/data/impl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.library)
alias(libs.plugins.metro)
Expand Down
2 changes: 0 additions & 2 deletions core/datastore/impl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.library)
alias(libs.plugins.metro)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import kotlinx.serialization.json.Json
@SingleIn(DataScope::class)
@Inject
class DefaultBookRecentSearchDataSource(
@BookRecentSearchDataStore private val dataStore: DataStore<Preferences>,
@param: BookRecentSearchDataStore private val dataStore: DataStore<Preferences>,
) : BookRecentSearchDataSource {
override val recentSearches: Flow<List<String>> = dataStore.data
.handleIOException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import kotlinx.serialization.json.Json
@SingleIn(DataScope::class)
@Inject
class DefaultLibraryRecentSearchDataSource(
@LibraryRecentSearchDataStore private val dataStore: DataStore<Preferences>,
@param: LibraryRecentSearchDataStore private val dataStore: DataStore<Preferences>,
) : LibraryRecentSearchDataSource {
override val recentSearches: Flow<List<String>> = dataStore.data
.handleIOException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import kotlinx.coroutines.flow.map
@SingleIn(DataScope::class)
@Inject
class DefaultNotificationDataSource(
@NotificationDataStore private val dataStore: DataStore<Preferences>,
@param: NotificationDataStore private val dataStore: DataStore<Preferences>,
) : NotificationDataSource {
override val isUserNotificationEnabled: Flow<Boolean> = dataStore.data
.handleIOException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import kotlinx.coroutines.flow.map
@SingleIn(DataScope::class)
@Inject
class DefaultOnboardingDataSource(
@OnboardingDataStore private val dataStore: DataStore<Preferences>,
@param: OnboardingDataStore private val dataStore: DataStore<Preferences>,
) : OnboardingDataSource {
override val onboardingState: Flow<OnboardingState> = dataStore.data
.handleIOException()
Expand Down
2 changes: 0 additions & 2 deletions core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.library)
alias(libs.plugins.booket.android.library.compose)
Expand Down
2 changes: 0 additions & 2 deletions core/di/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.library)
alias(libs.plugins.metro)
Expand Down
2 changes: 0 additions & 2 deletions core/network/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

import com.ninecraft.booket.convention.getLocalProperty


Expand Down
2 changes: 0 additions & 2 deletions core/ocr/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

import com.ninecraft.booket.convention.getLocalProperty

plugins {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.ninecraft.booket.core.di.DataScope
@SingleIn(DataScope::class)
@Inject
class CloudOcrRecognizer(
@ApplicationContext private val context: Context,
@param: ApplicationContext private val context: Context,
private val service: CloudVisionService,
) {
suspend fun recognizeText(imageUri: Uri): Result<CloudVisionResponse> = runSuspendCatching {
Expand Down
2 changes: 0 additions & 2 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.library)
alias(libs.plugins.booket.android.library.compose)
Expand Down
2 changes: 0 additions & 2 deletions feature/detail/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.feature)
alias(libs.plugins.booket.kotlin.library.serialization)
Expand Down
2 changes: 0 additions & 2 deletions feature/edit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.feature)
alias(libs.plugins.booket.kotlin.library.serialization)
Expand Down
2 changes: 0 additions & 2 deletions feature/home/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.feature)
alias(libs.plugins.kotlin.serialization)
Expand Down
2 changes: 0 additions & 2 deletions feature/library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.feature)
alias(libs.plugins.kotlin.serialization)
Expand Down
2 changes: 0 additions & 2 deletions feature/login/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

import com.ninecraft.booket.convention.getLocalProperty

plugins {
Expand Down
2 changes: 0 additions & 2 deletions feature/main/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.feature)
}
Expand Down
2 changes: 0 additions & 2 deletions feature/onboarding/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.feature)
alias(libs.plugins.kotlin.serialization)
Expand Down
2 changes: 0 additions & 2 deletions feature/record/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.feature)
alias(libs.plugins.kotlin.serialization)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import com.ninecraft.booket.feature.screens.R
import com.slack.circuit.runtime.screen.Screen

enum class MainTab(
@DrawableRes val iconResId: Int,
@DrawableRes val selectedIconResId: Int,
@StringRes val labelResId: Int,
@param: DrawableRes val iconResId: Int,
@param: DrawableRes val selectedIconResId: Int,
@param: StringRes val labelResId: Int,
internal val contentDescription: String,
val screen: Screen,
) {
Expand Down
2 changes: 0 additions & 2 deletions feature/search/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

import com.ninecraft.booket.convention.getLocalProperty


Expand Down
2 changes: 0 additions & 2 deletions feature/settings/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.feature)
alias(libs.plugins.booket.kotlin.library.serialization)
Expand Down
2 changes: 0 additions & 2 deletions feature/splash/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.feature)
}
Expand Down
2 changes: 0 additions & 2 deletions feature/webview/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
alias(libs.plugins.booket.android.feature)
alias(libs.plugins.booket.kotlin.library.serialization)
Expand Down
Loading
Loading