Skip to content

Conversation

@casper-jr
Copy link
Member

@casper-jr casper-jr commented Sep 22, 2025

🚀 이슈번호

✏️ 변경사항

  • kmp에서 build config와 같은 기능을 사용할 수 있게 해주는 buildkonfig 플러그인 적용
  • ktor client에서 기본 요청에 BuildKonfig를 통해 base url을 사용하도록 지정
  • github ci 에서 ios를 sdk 시뮬레이터로 빌드하도록 수정

📷 스크린샷

✍️ 사용법

🎸 기타

Summary by CodeRabbit

  • Refactor
    • 네트워크 기본 URL을 빌드 구성에서 제공해 모든 요청의 기본 엔드포인트가 통일되었습니다.
    • HTTP 로그 레벨을 ALL에서 BODY로 낮춰 출력되는 로그 양이 줄었습니다.
  • Chores
    • BuildKonfig 기반 빌드 설정이 추가되어 런타임 구성값(예: BASE_URL)을 빌드에 포함합니다.
    • 버전 카탈로그에 BuildKonfig 항목이 추가되어 의존성 관리가 확장되었습니다.
  • CI
    • CI 워크플로에서 local.properties를 생성해 base.url 값을 환경별로 일관되게 설정합니다.

@casper-jr casper-jr self-assigned this Sep 22, 2025
@casper-jr casper-jr added the CHORE 문서, 라이브러리 의존성 변경 등의 작업 label Sep 22, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 22, 2025

Walkthrough

루트와 모듈 Gradle, 버전 카탈로그에 BuildKonfig 항목을 추가했습니다. composeApp은 gradleLocalProperties로 base.url을 읽어 BuildKonfig의 BASE_URL으로 노출하고, HttpClientFactory의 기본 요청 URL과 Ktor 로깅 레벨을 조정했습니다. CI에 local.properties 생성 단계가 추가되었습니다.

Changes

Cohort / File(s) Change Summary
루트 Gradle 플러그인 선언
build.gradle.kts
플러그인 블록에 alias(libs.plugins.buildkonfig) apply false 추가(루트에서 플러그인 등록, 적용은 서브프로젝트에서 선택).
버전 카탈로그
gradle/libs.versions.toml
[versions], [libraries], [plugins]buildkonfig = "0.17.1" 및 라이브러리/플러그인 엔트리 추가.
composeApp 모듈 빌드 설정
composeApp/build.gradle.kts
alias(libs.plugins.buildkonfig) 추가; gradleLocalPropertiesbase.url 읽어 buildkonfig { packageName = "org.whosin.client"; defaultConfigs { BASE_URL STRING } } 설정 및 기본값 https://example.com 제공.
네트워크 초기화 변경
composeApp/src/commonMain/kotlin/.../HttpClientFactory.kt
val BASE_URL = BuildKonfig.BASE_URL 추가, defaultRequest의 기본 URL로 사용하도록 변경; Ktor 로깅 레벨 ALLBODY로 조정.
사소한 주석/임포트 변경
composeApp/src/commonMain/kotlin/.../DummyDataSource.kt
BuildKonfig 임포트(현재 미사용) 및 주석 추가; 런타임 동작 불변.
CI 환경 설정
.github/workflows/ci.yml
android-build 및 ios-build 작업에 Create local.properties 단계 추가: PR이면 base.url=https://example.com, 비-PR이면 secrets.BASE_URL 필요(없으면 실패). iOS xcodebuild 인수 포맷 정리(줄바꿈).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as 개발자
  participant CI as CI 워크플로
  participant Gradle as Gradle
  participant BK as BuildKonfig
  participant App as HttpClientFactory
  participant Ktor as Ktor Client
  participant API as 원격 API

  note right of CI #f0f4ff: local.properties 생성
  CI->>CI: 이벤트 검사\n(PR: base.url=https://example.com\nelse: base.url=secrets.BASE_URL (필수))
  CI->>Gradle: 빌드 트리거
  Gradle->>BK: BuildKonfig 생성 (BASE_URL 포함)
  App->>BK: BuildKonfig.BASE_URL 읽기
  App->>Ktor: defaultRequest -> url = BASE_URL\nlogging level = BODY
  Ktor->>API: HTTP 요청
  API-->>Ktor: 응답
  Ktor-->>App: 응답 반환
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

CI

Poem

작은 값 하나가 빌드에 스며들어,
로컬 속성은 길을 가리키네.
BuildKonfig가 건네는 BASE_URL로,
클라이언트는 조용히 요청을 보내고,
로그는 살짝 낮춰 BODY만 속삭인다 🌐✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning 몇몇 변경사항은 링크된 이슈의 범위를 벗어나거나 부수적인 영향이 있어 주의가 필요합니다: HttpClientLogging 레벨을 ALL에서 BODY로 낮춘 변경과 composeApp의 DummyDataSource에 추가된 미사용 BuildKonfig import 및 주석은 이 PR의 명시적 목표에 포함되어 있지 않습니다. 특히 CI 워크플로에서 non-PR 경로에 secrets.BASE_URL이 없으면 빌드를 실패시키도록 한 변경은 의도치 않게 CI 안정성을 해칠 수 있어 별도 검토가 필요합니다. 해결: 미사용 import와 불필요한 주석은 제거하고 로깅 레벨 변경은 별도 커밋이나 이슈로 분리하거나 변경 이유를 PR 본문에 명확히 기재하세요. CI 스텝은 secrets가 없을 때 example.com 같은 안전한 폴백을 사용하거나 빌드 실패 조건을 제거해서 비PR/외부 환경에서 불필요한 실패가 발생하지 않도록 수정하세요. iOS 빌드 명령 포맷 변경은 기능적 영향이 적으나 스타일 변경이라면 별도 PR로 분리하는 것을 권장합니다.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed PR 제목 "[CHORE] buildkonfig 플러그인 추가, base url 설정"은 변경사항의 핵심인 BuildKonfig 추가와 base URL 설정을 명확하게 요약하고 있어 본 변경사항과 일치합니다. 제목은 짧고 구체적이며 불필요한 잡음이나 이모지 없이 팀원이 히스토리를 빠르게 이해하기에 적절합니다. 따라서 제목은 이 PR의 주요 목적을 잘 전달하고 있습니다.
Linked Issues Check ✅ Passed 이 PR은 링크된 이슈 #9의 목적인 "KMP에서 BuildConfig 유사 기능 제공"을 충족합니다: gradle/libs.versions.toml에 buildkonfig 항목을 추가했고 루트 및 composeApp 빌드스크립트에 plugin alias와 buildkonfig 블록을 도입했으며 코드에서는 BuildKonfig.BASE_URL을 HttpClientFactory 기본 요청에 사용하도록 반영했습니다. 또한 local.properties를 CI에서 생성해 base.url 값을 주입하도록 하는 변경으로 실제 사용 흐름을 지원하고 있습니다. 따라서 링크된 이슈의 코드 관련 요구사항은 충족된 것으로 보입니다.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
composeApp/src/commonMain/kotlin/org/whosin/client/data/remote/DummyDataSource.kt (1)

8-8: 불필요한 import 제거하기

BuildKonfig를 import했지만 실제로는 사용하지 않고 있습니다. 코드 정리를 위해 이 import를 제거하는 것이 좋겠습니다.

-import org.whosin.client.BuildKonfig
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 939825c and 3890a93.

📒 Files selected for processing (5)
  • build.gradle.kts (1 hunks)
  • composeApp/build.gradle.kts (2 hunks)
  • composeApp/src/commonMain/kotlin/org/whosin/client/core/network/HttpClientFactory.kt (2 hunks)
  • composeApp/src/commonMain/kotlin/org/whosin/client/data/remote/DummyDataSource.kt (2 hunks)
  • gradle/libs.versions.toml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: android-build
🔇 Additional comments (9)
gradle/libs.versions.toml (2)

21-21: 올바른 최신 버전 사용 확인됨

BuildKonfig 0.17.1 버전이 2025년 4월에 릴리스된 최신 버전으로 확인되었습니다. 적절한 버전 선택이네요!


62-62: 플러그인 정의가 일관성 있게 추가됨

라이브러리와 플러그인 정의가 모두 추가되어 있고 버전 참조도 올바르게 연결되어 있습니다.

build.gradle.kts (1)

10-10: 루트 프로젝트에 플러그인 선언 잘 추가됨

apply false로 설정하여 하위 프로젝트에서 필요시 사용할 수 있도록 올바르게 설정되어 있습니다.

composeApp/src/commonMain/kotlin/org/whosin/client/data/remote/DummyDataSource.kt (1)

18-19: 유용한 주석 추가됨

base URL 사용에 대한 두 가지 옵션을 명확하게 보여주는 주석이 추가되어 좋습니다. 향후 다른 개발자들이 이해하기 쉬울 것 같네요.

composeApp/src/commonMain/kotlin/org/whosin/client/core/network/HttpClientFactory.kt (3)

17-20: BuildKonfig 통합이 깔끔하게 구현됨

BASE_URL을 BuildKonfig에서 가져와서 객체 레벨에서 상수로 정의한 접근 방식이 좋습니다. 코드의 재사용성과 가독성이 향상되었네요.


42-42: 로깅 레벨 변경 확인

로그 레벨이 ALL에서 BODY로 변경되었는데, 이는 네트워크 디버깅에 적절한 수준입니다. 너무 자세한 로그를 피하면서도 필요한 정보는 확인할 수 있을 것 같습니다.


46-46: 기본 URL 설정이 올바르게 적용됨

defaultRequest에서 BASE_URL을 사용하도록 설정되어 있어, 이제 클라이언트가 기본적으로 설정된 베이스 URL을 사용할 수 있습니다.

composeApp/build.gradle.kts (2)

1-1: 필요한 import가 적절히 추가됨

gradleLocalProperties를 사용하기 위한 import가 올바르게 추가되어 있습니다.


13-13: buildkonfig 플러그인 적용 확인됨

플러그인이 올바르게 적용되어 있습니다.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

83-92: 동일한 이슈가 iOS 잡에도 있습니다 + 중복 로직 DRY 권장.

위와 같은 빈 값 처리 문제가 그대로 반복됩니다. 동일 수정 적용을 권장하며, 두 잡에서 공유하는 step은 재사용 가능한 composite action 또는 리유저블 워크플로우로 빼면 관리가 수월합니다.

수정 예시는 안드로이드 잡과 동일합니다:

-    - name: Create local.properties
-      run: |
-        if [ "${{ github.event_name }}" = "pull_request" ]; then
-          echo "base.url=https://example.com" > local.properties
-        else
-          echo "base.url=${{ secrets.BASE_URL }}" > local.properties
-          if [ ! -s local.properties ]; then
-            echo "base.url=https://example.com" > local.properties
-          fi
-        fi
+    - name: Create local.properties
+      run: |
+        if [ "${{ github.event_name }}" = "pull_request" ]; then
+          echo "base.url=https://example.com/" > local.properties
+        else
+          if [ -z "${{ secrets.BASE_URL }}" ]; then
+            echo "❌ secrets.BASE_URL is missing. Failing the build."; exit 1
+          fi
+          echo "base.url=${{ secrets.BASE_URL }}" > local.properties
+        fi

추가 팁:

  • 로그에 secret 값은 기본 마스킹되지만, 안전을 위해 필요 시 ::add-mask::를 추가해도 됩니다.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3890a93 and fe8e6a3.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml (2 hunks)
  • composeApp/build.gradle.kts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • composeApp/build.gradle.kts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: ios-build
  • GitHub Check: android-build

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

37-47: 중복 스텝 DRY 권장

두 잡의 Create local.properties가 완전히 동일합니다. 재사용 워크플로우(.github/workflows/setup-local-properties.yml)나 컴포지트 액션으로 공통화하면 유지보수 용이합니다.

Also applies to: 84-94

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5615459 and adccb2b.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ios-build
🔇 Additional comments (3)
.github/workflows/ci.yml (3)

37-47: 빈값 체크·fail-fast 반영 확인 — 좋습니다

-z로 비어있는 시크릿을 선제 차단하고 실패 처리한 점이 안전합니다. 두 잡(android/ios) 모두 동일하게 적용되어 일관성도 OK.

Also applies to: 84-94


39-41: PR 이벤트 기본 URL에 트레일링 슬래시 누락 — 문서/코드와 불일치

PR 설명은 https://example.com/(슬래시 포함)인데, 워크플로우는 슬래시 없이 씁니다. URL 결합 정책을 단일화하세요.

다음처럼 수정 권장:

-          echo "base.url=https://example.com" > local.properties
+          echo "base.url=https://example.com/" > local.properties

동일 변경을 iOS 잡에도 반영해 주세요.

Also applies to: 86-88


37-47: BASE_URL 포맷·레거시 오타 점검 — 스크립트 수정 및 재검증 요청

원본 스크립트 실행 중 rg의 PCRE2 컴파일 오류와 "unrecognized file type: kt"가 발생해 자동 확인이 불완전했습니다. 아래 수정 스크립트를 실행한 출력 결과를 첨부해 제출하세요.

대상: .github/workflows/ci.yml (37–47, 84–94)

#!/bin/bash
set -euo pipefail

file=.github/workflows/ci.yml

echo "1) 워크플로우에서 슬래시 없는 기본 URL 탐지:"
matches=$(rg -n --no-messages 'base\.url=https://example\.com' "$file" || true)
if [ -z "$matches" ]; then
  echo "OK: 예시 URL 없음"
else
  while IFS=: read -r path lineno line; do
    suffix=${line#*example.com}
    firstchar=${suffix:0:1}
    if [ -z "$suffix" ] || [ "$firstchar" != "/" ]; then
      echo "WARN: ${path}:${lineno} - base.url에 '/' 누락 가능 -> ${line}"
    else
      echo "OK: ${path}:${lineno} - 슬래시 포함"
    fi
  done <<< "$matches"
fi

echo -e "\n2) 레거시 오타(httpsL//) 탐지:"
rg -n --no-messages 'httpsL//' || echo "OK: 오타 없음"

echo -e "\n3) BASE_URL 사용 패턴 스캔(참고용):"
rg -n -C2 --no-messages '\b(BuildKonfig\.BASE_URL|defaultRequest|takeFrom\(|appendPathSegment|appendPath|\.url\()' \
  --glob '!**/build/**' --glob '**/*.kt' --glob '**/*.kts' || echo "패턴 없음"

echo -e "\n=> 검토 포인트: BASE_URL이 항상 '/'로 끝나거나, 기본 요청 구성에서 슬래시를 보정하는지 확인하세요."

@casper-jr casper-jr merged commit 91855de into WhosInRoom:develop Sep 22, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CHORE 문서, 라이브러리 의존성 변경 등의 작업

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CHORE] BaseUrl 사용을 위한 라이브러리 추가

1 participant