Skip to content

Commit 48374b8

Browse files
committed
[BOOK-479] refactor: localProperty 조회 함수 공통화
1 parent c3ca075 commit 48374b8

File tree

6 files changed

+42
-21
lines changed

6 files changed

+42
-21
lines changed

app/build.gradle.kts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")
22

3-
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
43
import com.google.devtools.ksp.gradle.KspExtension
4+
import com.ninecraft.booket.convention.getLocalProperty
55
import org.gradle.kotlin.dsl.configure
66
import java.util.Properties
77

@@ -32,6 +32,7 @@ android {
3232
getByName("debug") {
3333
isDebuggable = true
3434
applicationIdSuffix = ".dev"
35+
buildConfigField("String", "GOOGLE_WEB_CLIENT_ID", getLocalProperty("DEBUG_GOOGLE_WEB_CLIENT_ID"))
3536
manifestPlaceholders += mapOf(
3637
"appName" to "@string/app_name_dev",
3738
)
@@ -42,6 +43,7 @@ android {
4243
isMinifyEnabled = true
4344
isShrinkResources = true
4445
signingConfig = signingConfigs.getByName("release")
46+
buildConfigField("String", "GOOGLE_WEB_CLIENT_ID", getLocalProperty("RELEASE_GOOGLE_WEB_CLIENT_ID"))
4547
manifestPlaceholders += mapOf(
4648
"appName" to "@string/app_name",
4749
)
@@ -53,8 +55,8 @@ android {
5355
}
5456

5557
defaultConfig {
56-
buildConfigField("String", "KAKAO_NATIVE_APP_KEY", getApiKey("KAKAO_NATIVE_APP_KEY"))
57-
manifestPlaceholders["KAKAO_NATIVE_APP_KEY"] = getApiKey("KAKAO_NATIVE_APP_KEY").trim('"')
58+
buildConfigField("String", "KAKAO_NATIVE_APP_KEY", getLocalProperty("KAKAO_NATIVE_APP_KEY"))
59+
manifestPlaceholders["KAKAO_NATIVE_APP_KEY"] = getLocalProperty("KAKAO_NATIVE_APP_KEY").trim('"')
5860
}
5961

6062
buildFeatures {
@@ -109,7 +111,3 @@ dependencies {
109111
api(libs.circuit.codegen.annotation)
110112
ksp(libs.circuit.codegen.ksp)
111113
}
112-
113-
fun getApiKey(propertyKey: String): String {
114-
return gradleLocalProperties(rootDir, providers).getProperty(propertyKey)
115-
}

build-logic/src/main/kotlin/com/ninecraft/booket/convention/Extensions.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.ninecraft.booket.convention
22

3+
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
34
import org.gradle.accessors.dm.LibrariesForLibs
45
import org.gradle.api.Project
56
import org.gradle.kotlin.dsl.the
@@ -10,3 +11,7 @@ internal val Project.libs
1011
internal fun Project.applyPlugins(vararg plugins: String) {
1112
plugins.forEach(pluginManager::apply)
1213
}
14+
15+
fun Project.getLocalProperty(propertyKey: String): String {
16+
return gradleLocalProperties(rootDir, providers).getProperty(propertyKey)
17+
}

core/network/build.gradle.kts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")
22

3-
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
3+
import com.ninecraft.booket.convention.getLocalProperty
44

55

66
plugins {
@@ -18,11 +18,11 @@ android {
1818

1919
buildTypes {
2020
debug {
21-
buildConfigField("String", "SERVER_BASE_URL", getServerBaseUrl("DEBUG_SERVER_BASE_URL"))
21+
buildConfigField("String", "SERVER_BASE_URL", getLocalProperty("DEBUG_SERVER_BASE_URL"))
2222
}
2323

2424
release {
25-
buildConfigField("String", "SERVER_BASE_URL", getServerBaseUrl("RELEASE_SERVER_BASE_URL"))
25+
buildConfigField("String", "SERVER_BASE_URL", getLocalProperty("RELEASE_SERVER_BASE_URL"))
2626
}
2727
}
2828
}
@@ -36,7 +36,3 @@ dependencies {
3636
libs.logger,
3737
)
3838
}
39-
40-
fun getServerBaseUrl(propertyKey: String): String {
41-
return gradleLocalProperties(rootDir, providers).getProperty(propertyKey)
42-
}

core/ocr/build.gradle.kts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")
22

3-
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
4-
3+
import com.ninecraft.booket.convention.getLocalProperty
54

65
plugins {
76
alias(libs.plugins.booket.android.library)
@@ -13,7 +12,7 @@ android {
1312
namespace = "com.ninecraft.booket.core.ocr"
1413

1514
defaultConfig {
16-
buildConfigField("String", "CLOUD_VISION_API_KEY", getApiKey("CLOUD_VISION_API_KEY"))
15+
buildConfigField("String", "CLOUD_VISION_API_KEY", getLocalProperty("CLOUD_VISION_API_KEY"))
1716
}
1817

1918
buildFeatures {
@@ -30,7 +29,3 @@ dependencies {
3029
libs.logger,
3130
)
3231
}
33-
34-
fun getApiKey(propertyKey: String): String {
35-
return gradleLocalProperties(rootDir, providers).getProperty(propertyKey)
36-
}

feature/login/build.gradle.kts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")
22

3+
import com.ninecraft.booket.convention.getLocalProperty
4+
35
plugins {
46
alias(libs.plugins.booket.android.feature)
57
alias(libs.plugins.kotlin.serialization)
@@ -8,6 +10,20 @@ plugins {
810

911
android {
1012
namespace = "com.ninecraft.booket.feature.login"
13+
14+
buildTypes {
15+
getByName("debug") {
16+
buildConfigField("String", "GOOGLE_WEB_CLIENT_ID", getLocalProperty("DEBUG_GOOGLE_WEB_CLIENT_ID"))
17+
}
18+
19+
getByName("release") {
20+
buildConfigField("String", "GOOGLE_WEB_CLIENT_ID", getLocalProperty("RELEASE_GOOGLE_WEB_CLIENT_ID"))
21+
}
22+
}
23+
24+
buildFeatures {
25+
buildConfig = true
26+
}
1127
}
1228

1329
dependencies {

feature/search/build.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")
22

3+
import com.ninecraft.booket.convention.getLocalProperty
4+
5+
36
plugins {
47
alias(libs.plugins.booket.android.feature)
58
alias(libs.plugins.kotlin.serialization)
@@ -8,6 +11,14 @@ plugins {
811

912
android {
1013
namespace = "com.ninecraft.booket.feature.search"
14+
15+
buildFeatures {
16+
buildConfig = true
17+
18+
defaultConfig {
19+
buildConfigField("String", "REED_KAKAOTALK_CHANNEL_URL", getLocalProperty("REED_KAKAOTALK_CHANNEL_URL"))
20+
}
21+
}
1122
}
1223

1324
dependencies {

0 commit comments

Comments
 (0)