Skip to content
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
6 changes: 6 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ android {
getByName("release") {
signingConfig = signingConfigs.getByName("release")
}

create("qa") {
initWith(getByName("release"))
signingConfig = signingConfigs.getByName("release")
matchingFallbacks += listOf("release")
}
}
}

Expand Down
20 changes: 20 additions & 0 deletions core/data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import com.yapp.app.setNamespace
import org.gradle.internal.extensions.stdlib.capitalized
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.Properties

plugins {
id("yapp.android.library")
Expand All @@ -14,6 +15,25 @@ android {
buildFeatures {
buildConfig = true
}

buildTypes {
val localProperties = Properties()
localProperties.load(
project.rootProject.file("local.properties").bufferedReader()
)

getByName("debug") {
buildConfigField("String", "BASE_URL", "\"${localProperties["base.url.debug"]}\"")
}
getByName("release") {
buildConfigField("String", "BASE_URL", "\"${localProperties["base.url.release"]}\"")
}
create("qa") {
initWith(getByName("release"))
matchingFallbacks += listOf("release")
buildConfigField("String", "BASE_URL", "\"${localProperties["base.url.qa"]}\"")
}
Comment on lines +31 to +35
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

현재 QA 의 initWith 값이 릴리즈를 바라보는 이유를 알 수 있을까요 ?
현재는 Base URL 뿐이긴 한데 추가되면 릴리즈를 전부 바라보게 될거 같아서요

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

릴리즈로 빌드되지만 BASE_URL은 개발 서버를 바라보도록 해야한다고 하셔서
release 환경과 동일하되, BASE_URL만 덮어쓰기하는 방식으로 했습니다!

}
Comment on lines +19 to +36
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

새로운 QA 빌드 타입 추가

local.properties 파일에서 각 빌드 타입별 BASE_URL 값을 읽어와 빌드 타입별로 다른 서버 환경을 사용할 수 있도록 설정했습니다. 특히 QA 빌드 타입을 release 빌드 타입 기반으로 생성하고, matchingFallbacks을 통해 의존성 해결에 필요한 빌드 타입 설정을 올바르게 구성했습니다.

그러나 local.properties 파일의 값이 없는 경우에 대한 예외 처리가 없습니다. 다음과 같이 기본값 설정이나 예외 처리 로직을 추가하는 것이 좋겠습니다.

 buildTypes {
     val localProperties = Properties()
     localProperties.load(
         project.rootProject.file("local.properties").bufferedReader()
     )

+    val defaultDebugUrl = "https://dev-yappuworld.yapp.co.kr/"
+    val defaultReleaseUrl = "https://api-yappuworld.yapp.co.kr/"
+    val defaultQaUrl = "https://dev-yappuworld.yapp.co.kr/"
+
     getByName("debug") {
-        buildConfigField("String", "BASE_URL", "\"${localProperties["base.url.debug"]}\"")
+        buildConfigField("String", "BASE_URL", "\"${localProperties.getProperty("base.url.debug", defaultDebugUrl)}\"")
     }
     getByName("release") {
-        buildConfigField("String", "BASE_URL", "\"${localProperties["base.url.release"]}\"")
+        buildConfigField("String", "BASE_URL", "\"${localProperties.getProperty("base.url.release", defaultReleaseUrl)}\"")
     }
     create("qa") {
         initWith(getByName("release"))
         matchingFallbacks += listOf("release")
-        buildConfigField("String", "BASE_URL", "\"${localProperties["base.url.qa"]}\"")
+        buildConfigField("String", "BASE_URL", "\"${localProperties.getProperty("base.url.qa", defaultQaUrl)}\"")
     }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
buildTypes {
val localProperties = Properties()
localProperties.load(
project.rootProject.file("local.properties").bufferedReader()
)
getByName("debug") {
buildConfigField("String", "BASE_URL", "\"${localProperties["base.url.debug"]}\"")
}
getByName("release") {
buildConfigField("String", "BASE_URL", "\"${localProperties["base.url.release"]}\"")
}
create("qa") {
initWith(getByName("release"))
matchingFallbacks += listOf("release")
buildConfigField("String", "BASE_URL", "\"${localProperties["base.url.qa"]}\"")
}
}
buildTypes {
val localProperties = Properties()
localProperties.load(
project.rootProject.file("local.properties").bufferedReader()
)
val defaultDebugUrl = "https://dev-yappuworld.yapp.co.kr/"
val defaultReleaseUrl = "https://api-yappuworld.yapp.co.kr/"
val defaultQaUrl = "https://dev-yappuworld.yapp.co.kr/"
getByName("debug") {
buildConfigField("String", "BASE_URL", "\"${localProperties.getProperty("base.url.debug", defaultDebugUrl)}\"")
}
getByName("release") {
buildConfigField("String", "BASE_URL", "\"${localProperties.getProperty("base.url.release", defaultReleaseUrl)}\"")
}
create("qa") {
initWith(getByName("release"))
matchingFallbacks += listOf("release")
buildConfigField("String", "BASE_URL", "\"${localProperties.getProperty("base.url.qa", defaultQaUrl)}\"")
}
}

}

protobuf {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ import javax.inject.Singleton
@InstallIn(SingletonComponent::class)
internal object NetworkModule {

private val BASE_URL: String
get() = if (BuildConfig.DEBUG) {
"https://dev-yappuworld.yapp.co.kr/"
} else {
"https://api-yappuworld.yapp.co.kr/"
}
private const val BASE_URL: String = BuildConfig.BASE_URL

@Singleton
@Provides
Expand Down